Giter Site home page Giter Site logo

Comments (12)

vanhuyz avatar vanhuyz commented on May 25, 2024 1

Hi Ross,
I've checked your code. It looks like you try to create many different graphs in the loop, and each graph only does inference for 1 image.
https://github.com/rosswendt/CycleGAN-TensorFlow/blob/batched_inference/inference.py#L46

I think there is a more efficient way to do batch inference by using only 1 graph.
But we have to modify export_graph.py a bit. At the moment, the exported graph only accepts 1 image as input. But we can make it accept multiple images as input by:

# https://github.com/vanhuyz/CycleGAN-TensorFlow/blob/master/export_graph.py#L33
- input_image = tf.placeholder(tf.float32, shape=[FLAGS.image_size, FLAGS.image_size, 3], name='input_image')
+ input_images = tf.placeholder(tf.float32, shape=[None, FLAGS.image_size, FLAGS.image_size, 3], name='input_images')

...
- output_image = cycle_gan.G.sample(tf.expand_dims(input_image, 0))
+ output_images = cycle_gan.G.sample(input_images) 
# (we may have to modify sample method in generator.py too)

Sorry that I can't check whether it works right now, but what do you think?

from cyclegan-tensorflow.

jihaonew avatar jihaonew commented on May 25, 2024 1

I write a batch test function.
batch_test

from cyclegan-tensorflow.

irfanICMLL avatar irfanICMLL commented on May 25, 2024

AND! When will the model stop? What is the meaning of "coord.should_stop"? Are there any parts we can use to test?
Hoping for your reply, thanks!

from cyclegan-tensorflow.

vanhuyz avatar vanhuyz commented on May 25, 2024

@irfanICMLL after training, you can export model from checkpoint using export_graph.py script as described in https://github.com/vanhuyz/CycleGAN-TensorFlow/blob/master/README.md#export-model.

After that, you can use the model to transfer images as https://github.com/vanhuyz/CycleGAN-TensorFlow/blob/master/README.md#inference.

You can stop the training anytime you want by Ctrl+C. You can use TensorBoard to see the training process with generated images on the Image tab.

Please let me know if you have any trouble :)

from cyclegan-tensorflow.

irfanICMLL avatar irfanICMLL commented on May 25, 2024

Thanks a lot~ But it will be helpful if we have a test part~

from cyclegan-tensorflow.

vanhuyz avatar vanhuyz commented on May 25, 2024

Sure! What kind of test do you want?

from cyclegan-tensorflow.

irfanICMLL avatar irfanICMLL commented on May 25, 2024

The datasets are divided into train set and test set. Do you use the test set? I guess the test set is design to test the effects of the model. For example, after the training, if we ues a test part. We can see a genA represents the generated results from testB and a genB represents the generated results from testA. Then we can make collateral experiments and get the results easily instead of watching at the Tensorboard.

from cyclegan-tensorflow.

vanhuyz avatar vanhuyz commented on May 25, 2024

Yes, I used the test set for that purpose too. The inference.py script can be used to generate an image from testA. To convert a whole directory, we need to modify that script a bit. Is that what you mean?

from cyclegan-tensorflow.

irfanICMLL avatar irfanICMLL commented on May 25, 2024

from cyclegan-tensorflow.

rosswendt avatar rosswendt commented on May 25, 2024

I have an inference.py that can do batches. I'm new to using tensorflow (and python) so I'm not sure if it's the most optimal. When it runs, there's a message saying "Creating Tensorflow Device" for each batch. It's at https://github.com/rosswendt/CycleGAN-TensorFlow/blob/batched_inference/inference.py. Let me know what you think.

from cyclegan-tensorflow.

rosswendt avatar rosswendt commented on May 25, 2024

Hi Van!

Thanks so much for checking the code out. And thanks for the work you've done and continue to do on this project. It's very cool to have a tensorflow implementation of CycleGAN.

I'm working through some of the tensorflow tutorials so I can better make modifications to the script. I'm trying to learn some python best practices as well, since I'm a bit new to it too.

I'll try out your tweaks this coming week, in addition to learning a bit more tensorflow and python stuff. Hopefully I will be able to write things cleaner and better performing as I learn more.

Thanks again for taking a look at my script with all the work you've done on this tensorflow CycleGAN implementation.

from cyclegan-tensorflow.

chenzeyuczy avatar chenzeyuczy commented on May 25, 2024

You may refer to the this gist, which can infer a batch of images in the same directory.

from cyclegan-tensorflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.