Pytorch-cyclegan-and-pix2pix: NotADirectoryError occurs when using combine_A_and_B.py

Created on 13 Jul 2019  Â·  3Comments  Â·  Source: junyanz/pytorch-CycleGAN-and-pix2pix

I am preparing my own datasets and I want to combine my own sketch and photo images into one picture for trainning on the pix2pix model. I read the "Prepare your own datasets for pix2pix"instruction carefully, also, I searched the issues similar but there is no help. So I open a new issue for help.

My folder directories are as follow:

the sketch images are in the
/pytorch-CycleGAN-and-pix2pix/datasets/combine/A/train
and there are 72 images named like frame_0028.jpg.

the photo images are in the
/pytorch-CycleGAN-and-pix2pix/datasets/combine/B/train
and there are 72 corresponding object photo images with same name in A.

and the output folder:
/pytorch-CycleGAN-and-pix2pix/datasets/combine/AB

My commands try

my first try command is:
python datasets/combine_A_and_B.py --fold_A ./datasets/combine/A --fold_B ./datasets/combine/B --fold_AB ./datasets/combine/AB

but terminal says:
[fold_A] = ./datasets/combine/A
[fold_B] = ./datasets/combine/B
[fold_AB] = ./datasets/combine/AB
[num_imgs] = 1000000
[use_AB] = False
Traceback (most recent call last):
File "datasets/combine_A_and_B.py", line 22, in
img_list = os.listdir(img_fold_A)
NotADirectoryError: [Errno 20] Not a directory: './datasets/combine/A/.DS_Store'

I think maybe I should specify the train folder, so my second try command is:
python datasets/combine_A_and_B.py --fold_A ./datasets/combine/A/train --fold_B ./datasets/combine/B/train --fold_AB ./datasets/combine/AB

terminal still unhappy:
[fold_A] = ./datasets/combine/A/train
[fold_B] = ./datasets/combine/B/train
[fold_AB] = ./datasets/combine/AB
[num_imgs] = 1000000
[use_AB] = False
Traceback (most recent call last):
File "datasets/combine_A_and_B.py", line 22, in
img_list = os.listdir(img_fold_A)
NotADirectoryError: [Errno 20] Not a directory: './datasets/combine/A/train/frame_0028.jpg'

Could anyone give me some advice? Thanks a lot !

Most helpful comment

Could you try to remove .DS_store and use python datasets/combine_A_and_B.py --fold_A ./datasets/combine/A --fold_B ./datasets/combine/B --fold_AB ./datasets/combine/AB?

All 3 comments

Could you try to remove .DS_store and use python datasets/combine_A_and_B.py --fold_A ./datasets/combine/A --fold_B ./datasets/combine/B --fold_AB ./datasets/combine/AB?

Could you try to remove .DS_store and use python datasets/combine_A_and_B.py --fold_A ./datasets/combine/A --fold_B ./datasets/combine/B --fold_AB ./datasets/combine/AB?

Thanks a lot. I searched the keyword '.DS_store' and got understand what happened.

Solution

  • Go to ./datasets/combine/A, use 'find . -name '*.DS_Store' -type f -delete' to delete it.
  • Go to ./datasets/combine/B, use the command above again.
  • Back to /pytorch-CycleGAN-and-pix2pix/, run python datasets/combine_A_and_B.py --fold_A ./datasets/combine/A --fold_B ./datasets/combine/B --fold_AB ./datasets/combine/AB

then I got what I want.

@diaosiji I am getting same issue with selfie2anime dataset and deleting dstore did not solve problem
https://www.kaggle.com/arnaud58/selfie2anime

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lyhangustc picture lyhangustc  Â·  5Comments

zerxon picture zerxon  Â·  4Comments

davidwessman picture davidwessman  Â·  3Comments

John1231983 picture John1231983  Â·  3Comments

khryang picture khryang  Â·  3Comments