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

Regarding Training your Own Images #94

Open
kuruvilla2087 opened this issue Jul 6, 2021 · 4 comments
Open

Regarding Training your Own Images #94

kuruvilla2087 opened this issue Jul 6, 2021 · 4 comments

Comments

@kuruvilla2087
Copy link

Hi Juyanz,

How are you !hope all is fine .

I want to train this algo on different images ,I was thinking how to train them on self images ,
1)What pre-processing steps do i need to take here .Can you please guide me .?
2)The model is not saving to any directory ,Can you please let know where the trained model saves(for our own images) ?

@twentyfiveYang
Copy link

Hello Abraham,
I'm also trying to do the same thing and find a way to train our own images.

The dataset structure required here should be like:
datasetsample

The way to make this kind of dataset you can refer to the image pre-processing method offered by the author @junyanz here: https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/docs/datasets.md

  1. Create folder /path/to/data with subfolders A and B. A and B should each have their own subfolders train, val, test, etc. In /path/to/data/A/train, put training images in style A. In /path/to/data/B/train, put the corresponding images in style B. Repeat same for other data splits (val, test, etc).
    ( Corresponding images in a pair {A,B} must be the same size and have the same filename, e.g., /path/to/data/A/train/1.jpg is considered to correspond to /path/to/data/B/train/1.jpg. )

  2. Once the data is formatted this way, call:

python path/to/combine_A_and_B.py --fold_A /path/to/data/A --fold_B /path/to/data/B --fold_AB /path/to/data

This will combine each pair of images (A,B) into a single image file, which is the dataset ready for training the BicycleGAN.

combine_A_and_B.py file can be found here:
https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix/blob/master/datasets/combine_A_and_B.py

@kuruvilla2087
Copy link
Author

kuruvilla2087 commented Jul 19, 2021 via email

@AvirupJU
Copy link

AvirupJU commented Feb 2, 2022

Thanks @twentyfiveYang. This post helped. I guess many would keep the same directory structure as in CycleGAN as nothing is mentioned in the official readme.

@junyanz
Copy link
Owner

junyanz commented Mar 9, 2022

Thanks for the reply. It follows the pix2pix directory structure rather than CycleGAN's.

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

4 participants