junyanz / pytorch-CycleGAN-and-pix2pix

Image-to-Image Translation in PyTorch
Other
22.76k stars 6.29k forks source link

HELP!AssertionError: ./datasets/datasetchd/trainA is not a valid directory #1183

Open huahuaguigui opened 3 years ago

huahuaguigui commented 3 years ago

I followed the instructions and put my dataset in the datasets folder and ran the code(cycleGAN.ipynb) in Google Colab I got the following error

!python train.py --dataroot ./datasets/datasetchd --name b2c --model cycle_gan

------- Options --------------- batch_size: 1
beta1: 0.5
checkpoints_dir: ./checkpoints
continue_train: False
crop_size: 256
dataroot: ./datasets/datasetchd [default: None] dataset_mode: unaligned
direction: AtoB
display_env: main
display_freq: 400
display_id: 1
display_ncols: 4
display_port: 8097
display_server: http://localhost
display_winsize: 256
epoch: latest
epoch_count: 1
gan_mode: lsgan
gpu_ids: 0
init_gain: 0.02
init_type: normal
input_nc: 3
isTrain: True [default: None] lambda_A: 10.0
lambda_B: 10.0
lambda_identity: 0.5
load_iter: 0 [default: 0] load_size: 286
lr: 0.0002
lr_decay_iters: 50
lr_policy: linear
max_dataset_size: inf
model: cycle_gan
n_epochs: 100
n_epochs_decay: 100
n_layers_D: 3
name: b2c [default: experiment_name] ndf: 64
netD: basic
netG: resnet_9blocks
ngf: 64
no_dropout: True
no_flip: False
no_html: False
norm: instance
num_threads: 4
output_nc: 3
phase: train
pool_size: 50
preprocess: resize_and_crop
print_freq: 100
save_by_iter: False
save_epoch_freq: 5
save_latest_freq: 5000
serial_batches: False
suffix:
update_html_freq: 1000
verbose: False
----------------- End ------------------- Traceback (most recent call last): File "train.py", line 29, in dataset = create_dataset(opt) # create a dataset given opt.dataset_mode and other options File "/content/pytorch-CycleGAN-and-pix2pix/data/init.py", line 57, in create_dataset data_loader = CustomDatasetDataLoader(opt) File "/content/pytorch-CycleGAN-and-pix2pix/data/init.py", line 73, in init self.dataset = dataset_class(opt) File "/content/pytorch-CycleGAN-and-pix2pix/data/unaligned_dataset.py", line 29, in init self.A_paths = sorted(make_dataset(self.dir_A, opt.max_dataset_size)) # load images from '/path/to/data/trainA' File "/content/pytorch-CycleGAN-and-pix2pix/data/image_folder.py", line 25, in make_dataset assert os.path.isdir(dir), '%s is not a valid directory' % dir AssertionError: ./datasets/datasetchd/trainA is not a valid directory

Thank you in anvance!

JunlinHan commented 3 years ago

Make sure you have created trainA,trainB inside ./datasets/datasetchd, name them properly.

Kohilab94 commented 1 year ago

Traceback (most recent call last): File "train.py", line 29, in dataset = create_dataset(opt) # create a dataset given opt.dataset_mode and other options File "C:\Users\ADMIN\Downloads\face-sketch-pix2pix-main\face-sketch-pix2pix-main\data__init.py", line 57, in create_dataset data_loader = CustomDatasetDataLoader(opt) File "C:\Users\ADMIN\Downloads\face-sketch-pix2pix-main\face-sketch-pix2pix-main\data\init.py", line 73, in init self.dataset = dataset_class(opt) File "C:\Users\ADMIN\Downloads\face-sketch-pix2pix-main\face-sketch-pix2pix-main\data\aligned_dataset.py", line 22, in init__ self.AB_paths = sorted(make_dataset(self.dir_AB, opt.max_dataset_size)) # get image paths File "C:\Users\ADMIN\Downloads\face-sketch-pix2pix-main\face-sketch-pix2pix-main\data\image_folder.py", line 25, in make_dataset assert os.path.isdir(dir), '%s is not a valid directory' % dir AssertionError: ./datasets/cuhk\train is not a valid directory (pytorch-CycleGAN-and-pix2pix) PS C:\Users\ADMIN\Downloads\face-sketch-pix2pix-main\face-sketch-pix2pix-main>

Someone please help me to solve this error