Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the process of training a new style image's model? #74

Open
lcb931023 opened this issue Nov 19, 2016 · 3 comments
Open

What's the process of training a new style image's model? #74

lcb931023 opened this issue Nov 19, 2016 · 3 comments

Comments

@lcb931023
Copy link

Hello!

Thanks for building this project.
I needed to run neural style transfer on a few style images faster, so I found this and was hoping I could train a style model for each of my images.
Looking through the training guide however there are some parts I don't quite understand.

With the virtual environment activated, you can use the script scripts/make_style_dataset.py to create an HDF5 file from a directory of training images and a directory of validation images:

  • In my use case, is the directory of training just that one style image I want to apply?
  • What should validation images be?
  • Or are these supposed to be the COCO dataset?

--height, --width: All images will be resized to this size.

What's the importance of these two parameters?

Thanks!

@Runescaped
Copy link

Runescaped commented Nov 20, 2016

  • No, the training directory is one that holds a buncha images. If you look at line 14 and 15 of make_style_dataset.py, it looks like the creators used the train2014 and val2014 COCO image sets.
  • Idk what validation images should be...this is probably discussed in the research paper.
  • Yes, the training and validation folders are for image sets, though you dont have to use the COCO dataset. That's just the one that the creators used for their examples.

Once you have created the HDF5 dataset file from your image sets, you then run the train.lua script. This is where you input the HDF5 file you just created, your style image (multiple style images not currently supported), and a model (default one is VGG16). This script outputs a t7 file which you then use on various content images.

@htoyryla
Copy link
Contributor

Validation images are useful for checking, during training, how well the training is working with images other than those used for training. They do not affect the model itself, only function as a cross-check (see if the loss values for validation are comparable to the losses in training, then training is going on well).

@htoyryla
Copy link
Contributor

There are varying opinions how many images are needed for training. The COCO set has 80 000 images. I have at times used my own set of around 2500 images, mainly landscapes and other places. It works well too, results are slightly but not too different.

Dmitry Ulyanov, the author of texture_nets (which works quite similar to fast-neural-style) has said that best results can be obtained from a quite small (like 16 or even smaller) training set. In texture_nets it is a bit easier to experiment with different trainings sets, as no hdf5 file is needed, a directory of training images is enough. Then one can even train with exactly those images one plans to transform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants