yu4u / noise2noise

An unofficial and partial Keras implementation of "Noise2Noise: Learning Image Restoration without Clean Data"
MIT License
1.07k stars 237 forks source link

I can't use other images for training #25

Open sta9 opened 5 years ago

sta9 commented 5 years ago

Hi, I am trying to train with loss = l0 using my own image instead of image_dir: 291 and test_dir: Set14. Then the following code will appear and training will not proceed.

Epoch 00001: UpdateAnnealingParameter reducing gamma to 2.0.

I don't know what this is going on. How can I help my training to succeed?

yu4u commented 5 years ago

As described in the paper, I also used annealed version of the "L0 loss". The parameter gamma is reduced to 0 while training proceeds.

https://github.com/yu4u/noise2noise/blob/master/model.py#L10-L33

image

sta9 commented 5 years ago

Thank you for answering. But why does not training progress just by changing the image? Even though loss = l0 before the change of the image training was going well.

yu4u commented 5 years ago

Sorry but I did not understand you question. Did mean that there is no need for annealing?

sta9 commented 5 years ago

Sorry for the incomprehensible question. I need annealing. What I wanted to tell you is that training will not proceed just by changing the image regardless of L0loss.

yu4u commented 5 years ago

Thank you for your answer. I got it. Would you pull the repository to use the latest version of this project. I'm not sure whether it solves the problem, but there were a bug that images except ".jpg" images cannot be used.

sta9 commented 5 years ago

Thanks a lot!! After changing from '.bmp' to '.jpg', training advanced.

AllenJac commented 5 years ago

For training, could I use the existing weight to initialize the network weight, how to do it?

yu4u commented 5 years ago

I added a new argument to resume training.

https://github.com/yu4u/noise2noise/blob/master/train.py#L45-L46

AllenJac commented 5 years ago

Thanks for adding them. Should we add anything else?

yu4u commented 5 years ago

Nothing.

AllenJac commented 5 years ago

But it doesn't have any effect on the whole training process. It is not included in main function. For example, if I use the weight file you trained by srresnet, it still can run with unet. There won't be any error in any situation. It seems like this code doesn't exist or get involved.

yu4u commented 5 years ago

It is not included in main function

I did not understand what you intended. Weights would be loaded.

https://github.com/yu4u/noise2noise/blob/master/train.py#L75-L76

Loading resnet weights to unet model causes the following error.

ValueError: You are trying to load a weight file containing 85 layers into a model with 23 layers.
AllenJac commented 5 years ago

L75-L76 make sense this time. Thank you very much!

WeiyinChen007 commented 3 years ago

I want to change the input to one-dimensional data instead of pictures. What should I do?