Comments (3)
From http://pytorch.org/docs/nn.html:
At evaluation time (.eval()), the default behaviour of the InstanceNorm module stays the same i.e. running mean/variance is NOT used for normalization. One can force using stored mean and variance with .train(False) method.
However, the results might not look so good since instance norm isn't really meant to be used this way -- this will induce a big gap between how you trained instance norm and how it is being used at test time.
If it doesn't look good, you could try retraining in a way that removes this gap. One way would be "virtual instance norm", where you normalize one image based on the running statistics from a held out set of other images (same as virtual batchnorm from this paper).
Good luck and I'll be interested to know if you have success!
from cyclegan.
Hi, torch implementation of Instance Norm is easily hackable and can use stored mean/var instead of independent normalization at test time. I think you just need to set self.bn
to eval mode in https://github.com/junyanz/CycleGAN/blob/master/util/InstanceNormalization.lua#L102 or somewhere in updateOutput
function. Stored statistics worked quite well for stylization.
Ideally, you want to get statistics from an entire image, you can create a dataset of tiles and compute global statistcs. I saw a script by @szagoruyko which does it, but could not find it now.
from cyclegan.
@DmitryUlyanov Thanks for the notes.
@Quasimondo I guess the tiling operation will still cause the boundary artifacts even without instanceNorm.
Let's say your images are 512x512. I would recommend that you train your model on 256x256 cropped images. During the test time, you are still able to test it on large images (512x512), as testing requires less GPU memory, compared to training. In this case, you might want to set loadSize=512
and fineSize=256
for both training and test. Even you train a model on 256x256 images, you can still apply it fully convolutionally to a picture with arbitrary size.
See issue #19 for more discussion.
from cyclegan.
Related Issues (20)
- Blurry image B, but clear image A reconstruction HOT 1
- try to use my own dataset on colab but fail.
- CSV file
- Test size is smaller than train size
- test is failing with libjpeg pkg is missing
- cuDNN lib error when selected CPU
- torch install
- cublas runtime error : library not initialized at /home/username/torch/extra/cutorch/lib/THC/THCGeneral.c:405
- Are there some points between "Tensorflow-simple" and "official implementation"?
- __global__ function call is not configured HOT 1
- Could you provide the tutorial and source codes of evaluation models for CycleGAN and CyCADA?
- network applicability HOT 1
- About the loss of the generator HOT 1
- Failure cases portraying war criminal
- About generate video
- pythorch to onnx conversion HOT 1
- Holes showing up while training HOT 4
- combine_A_and_B issue
- Google Colab Notebook
- Resource not found HOT 1
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.