DeblurGAN icon indicating copy to clipboard operation
DeblurGAN copied to clipboard

combine A_B folder problem,can anyone give a help

Open CCRainy opened this issue 5 years ago • 6 comments

I want to use my model ,then I make the real picture folder and the corresponding fake pictures folder I run the command (python datasets/combine_A_and_B.py --fold_A /path/to/data/A --fold_B /path/to/data/B --fold_AB /path/to/data ) with my real and fake pictures folder
but the combine_A_and_B.py get some problem

I want to know the the real meaning of the two arguments --fold_A /path/to/data/A and --fold_B /path/to/data/B the two arguments is the different meaning between the coding and the definition

Thank you for help!

CCRainy avatar Dec 16 '18 07:12 CCRainy

From what I can tell, the combine_A_and_B.py script was lifted from this repository, https://github.com/EliasVansteenkiste/CycleGANwithPerceptionLoss

At the end of the README for that repo, they offer this documentation for the script:

We provide a python script to generate pix2pix training data in the form of pairs of images {A,B}, where A and B are two different depictions of the same underlying scene. For example, these might be pairs {label map, photo} or {bw image, color image}. Then we can learn to translate A to B or B to A: 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. Once the data is formatted this way, call:

python datasets/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, ready for training.

Hope this helps!

Colelyman avatar Dec 19 '18 20:12 Colelyman

From what I can tell, the combine_A_and_B.py script was lifted from this repository, https://github.com/EliasVansteenkiste/CycleGANwithPerceptionLoss

At the end of the README for that repo, they offer this documentation for the script:

We provide a python script to generate pix2pix training data in the form of pairs of images {A,B}, where A and B are two different depictions of the same underlying scene. For example, these might be pairs {label map, photo} or {bw image, color image}. Then we can learn to translate A to B or B to A: 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. Once the data is formatted this way, call:

python datasets/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, ready for training.

Hope this helps!

Thanks for your help! The preliminary issue has been solved.

CCRainy avatar Dec 22 '18 05:12 CCRainy

hello, I would like to create two new folders A and B under folder data,and then set up train,val,test and other files under each folder, data--- A---train,val,test B---train,val,test then run the command: python datasets/combine_A_and_B.py --fold_A /path/to/data/A --fold_B /path/to/data/B --fold_AB /path/to/data there are the following errors: File "datasets/combine_A_and_B.py", line 18, in splits = os.listdir(args.fold_A) FileNotFoundError: [Errno 2] No such file or directory: '/path/to/data/A'

Thank you for help!

Jane1023 avatar Feb 24 '19 02:02 Jane1023

'path/to/data/A' means that you should put the path to the directory A (or other file contains your data) here

hiendoan95 avatar Jul 20 '19 06:07 hiendoan95

I made a little very simple script so you can put your data in the right format. Check it out: https://github.com/piperod/DeblurGAN/blob/master/datasets/split_train_test_val.py

run this script, then run combine script. Then you are ready to train .

piperod avatar Sep 09 '19 17:09 piperod

Where should the blurred images be put in folder A or folder B? Does the network learn to translate image from A to B? In that case, I keep Ground truth in B and Blurred images in A?

VikasRajashekar avatar Oct 03 '19 09:10 VikasRajashekar