Comments (12)
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.
I write a batch test function.
batch_test
from cyclegan-tensorflow.
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.
@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.
Thanks a lot~ But it will be helpful if we have a test part~
from cyclegan-tensorflow.
Sure! What kind of test do you want?
from cyclegan-tensorflow.
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.
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.
from cyclegan-tensorflow.
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.
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.
You may refer to the this gist, which can infer a batch of images in the same directory.
from cyclegan-tensorflow.
Related Issues (20)
- Missing the ngf parameter for F generator HOT 2
- CPU 100%, but training never starts HOT 2
- verbosity error HOT 4
- can be used to remove the watermark ? HOT 1
- Nothing in cityscapes downloaded by download_dataset.sh HOT 1
- Error happen trying to export. HOT 1
- Control dependencies in CycleGAN optimizer
- image size, default: 256
- 怎么使用预训练的模型啊
- Observing backward pass while running inference.py with a pb file, which is consuming lot of time
- NO FILE IN THE Checkpoints AFTER Train
- ops.py重的Instance Normalization是不是有个地方搞错了? HOT 2
- Use python train.py --load_model XXXX problem
- can this
- Can this code work with gray scale image or rectangle img?
- How to deal with high contrast background colors?
- How to convert the ckpt model into savedmodel HOT 1
- The training doesn't start
- Training doesn't start HOT 1
- pretrained examples: freezed or not? any data preprocessing?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cyclegan-tensorflow.