Closed uselessai closed 2 years ago
Let's break it down. Here is the definition of the dataset:
'ffhq_encode': {
'transforms': transforms_config.EncodeTransforms,
'train_source_root': dataset_paths['ffhq'],
'train_target_root': dataset_paths['ffhq'],
'test_source_root': dataset_paths['celeba_test'],
'test_target_root': dataset_paths['celeba_test']
}
We need two paths for each of the train and test sets since one path points to the source images and one points to the target images. In our case, since we are learning to invert images, they're simply the same path. We have two different paths because if you wanted to perform image-to-image translation, for example, you could've set the paths to be different.
It's kind of difficult to decipher your error. I would start by making sure that your defined your paths correctly and that your datasets are not empty.
Thanks for the quick response. When I change the config files to:
data_config.py 'train_source_root': dataset_paths['train_data'], 'train_target_root': dataset_paths['train_data'], 'test_source_root': dataset_paths['test_data'], 'test_target_root': dataset_paths['test_data']
paths_config.py 'train_data': Path('market/train'), 'test_data': Path('market/test'),
I got this error
[Errno 2] No such file or directory: '/home/laura/stylegan3-editing/market/train/market/train/1026.jpg'
Is duplicating the folders. The correct folder is
/home/laura/stylegan3-editing/market/train/1026.jpg
Is because I was using a relative path If I change to an absolute path it works perfectly.
I am trying to train the model with my own stylegan3 model but I got the next error. I have trying using only a small batch of images but it does not work.
Maybe is because the path config? I do not know why the config file has 2 train and test paths (source and target) I am not sure where the target root should point at.. 'train_source_root': dataset_paths['mypath'], 'train_target_root': dataset_paths['mypath'],
This is the error that I got.
python ./inversion/scripts/train_restyle_psp.py --dataset_type market_encode --encoder_type ResNetBackboneEncoder --exp_dir experiments/artificiales --batch_size 2 --test_batch_size 2 --workers 2 --test_workers 2 --val_interval 5000 --save_interval 10000 --start_from_latent_avg True --lpips_lambda 0.8 --l2_lambda 1 --id_lambda 0.1 --input_nc 4 --n_iters_per_batch 3 --output_size 64 --stylegan_weights ./network-snapshot-002160Stylegan3.pt {'batch_size': 2, 'board_interval': 50, 'checkpoint_path': None, 'dataset_type': 'market_encode', 'device': None, 'encoder_type': 'ResNetBackboneEncoder', 'exp_dir': PosixPath('experiments/artificiales'), 'id_lambda': 0.1, 'image_interval': 100, 'input_nc': 4, 'l2_lambda': 1.0, 'learning_rate': 0.0001, 'lpips_lambda': 0.8, 'max_steps': 500000, 'max_val_batches': None, 'moco_lambda': 0, 'n_iters_per_batch': 3, 'optim_name': 'ranger', 'output_size': 64, 'save_interval': 10000, 'start_from_latent_avg': True, 'stylegan_weights': PosixPath('network-snapshot-002160Stylegan3.pt'), 'test_batch_size': 2, 'test_workers': 2, 'train_decoder': False, 'val_interval': 5000, 'w_norm_lambda': 0, 'workers': 2} Loading encoders weights from irse50! Loading StyleGAN3 generator from path: network-snapshot-002160Stylegan3.pt Done! Setting up PyTorch plugin "filtered_lrelu_plugin"... Done. Loading ResNet ArcFace Loading dataset for market_encode Number of training samples: 1283 Number of test samples: 275 Traceback (most recent call last): File "./inversion/scripts/train_restyle_psp.py", line 29, in <module> main() File "/home/laura/anaconda3/envs/sg3_env/lib/python3.6/site-packages/pyrallis/argparsing.py", line 160, in wrapper_inner response = fn(cfg, *args, **kwargs) File "./inversion/scripts/train_restyle_psp.py", line 25, in main coach.train() File "./inversion/training/coach_restyle_psp.py", line 120, in train for batch_idx, batch in enumerate(self.train_dataloader): File "/home/laura/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 521, in __next__ data = self._next_data() File "/home/laura/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data return self._process_data(data) File "/home/laura/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data data.reraise() File "/home/laura/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/_utils.py", line 434, in reraise raise exception IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/laura/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop data = fetcher.fetch(index) File "/home/laura/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/laura/anaconda3/envs/sg3_env/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "./inversion/datasets/images_dataset.py", line 21, in __getitem__ to_path = self.target_paths[index] IndexError: list index out of range
Thanks in advance.