Comments (5)
Which keras version are you using ?
It could have something to do with the Batch Norm mode (in early versions, you have a mode to compute BN statistics for inference in the same way as for training, i.e. use a per batch mean and standard dev. If you are in this mode, then when you make predictions, the estimated BN statistics given only one image may not be very good)
Do you have image samples ?
Do you get the same quality if you save with cv2.imwrite ?
from deeplearningimplementations.
Keras version is 1.2.2
For using cv2.imwrite
i have to multiply out by 255, but the saved images look more or less the same.
Here are the images(at 350th epoch) generated by the plot_generated_batch
-
Here are the same generated images at same epoch by the above code -
Also, I now run the above code every 50 epochs during training itself using the generator_model so as to remove any errors that may be caused due to saving and loading models.
from deeplearningimplementations.
If I'm not mistaken, during training, predictions are made in batch before being saved:
X_pred = generator.predict(X_batch) # X_batch is maybe (16,3,256,256) for i in range(X_pred.shape[0]): cv2.imwrite(X_pred[i])
However you call predict
on a single image.
2 possibilities:
- You are in the BN mode where moving mean and stddev are computed at training to be re-used at test time. In this case I would expect the same results whether you predict on a single image of a whole batch of image.
- You are in the BN mode where moving mean and stddev are computed at test time for each new batch you pass. You will get different results depending on how many images are in your test batch. That may explain your artifacts.
Did you try running your image saving code on multiple images at the same time (i.e. data has more than 1 sample on axis=0) ? Do check the mode argument in the BatchNorm layer.
I met a few float/int issues before but these led to images far more deteriorated than the ones you show.
from deeplearningimplementations.
Alright, it was the case 2. Predicting in a batch led to no artifacts, and patches. I predicted on multiple images together and it worked. 👍
Also, having a batch of 4 gave slightly better results in terms of colors than a batch of 16. I guess that has something to do with having a batch_size of 4 during training too.
Thank you!
from deeplearningimplementations.
Hi Sachin,
I'm a newbie in the field of deep learning. Out of pure interest I have started to work on pix2pix. I need a small help. I completed the training of my model and now I want to test it on single new images. Can you please brief me how to do it. To be particular I'm working on the Layout-Building example.I used your testing code above to test my model too.Unfortunately the output that I obtained seem to vary a lot from the actual expected output.
Thank you.
Tharun
from deeplearningimplementations.
Related Issues (20)
- Can you provide test code?
- WGAN-GP update formula wrong? HOT 2
- tf.sqrt in WGAN-GP gradient penalty formula throws NaNs HOT 2
- Densenet: takes at least 3 arguments (4 given) HOT 2
- Densenet: growth_rate
- Discriminator Implementation Error HOT 1
- CelebA dataset is not accessible HOT 2
- Wasserstein distance formula
- concat_axis missing for the transition layer call inside Densenet HOT 2
- KeyError: '__flags'
- InfoGAN: wrong argument descriptions in help
- densenet on cifar10
- Training tends to yellow colors
- main.py error HOT 1
- Colorful - Yellow results
- How to load my local dataset instead of the Cifar10 dataset and feed it to the DenseNet
- deconv forward_pass
- Quantitative evaluations verified?
- Explaning discriminator model
- How to generate images using model.predict just as the validation ones?
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 deeplearningimplementations.