megvii-research / CADDM

Official implementation of ID-unaware Deepfake Detection Model
Apache License 2.0
135 stars 19 forks source link

ValueError: not enough values to unpack (expected 2, got 0) #39

Open S-researcher opened 4 months ago

S-researcher commented 4 months ago

I used rtx3080ti cuda11.1, python==3.8, and the others were configured according to the environment given by the author, but I encountered problems during training

Load deepfake dataset from ./train_images.. Target RGB shape: () Target RGB shape: (480, 712, 3) Target RGB shape: () Traceback (most recent call last): File "train.py", line 151, in train() File "train.py", line 112, in train for index, (batch_data, batch_labels) in enumerate(train_loader): File "/home/lab/anaconda3/envs/DeepfakeBench/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 517, in next data = self._next_data() File "/home/lab/anaconda3/envs/DeepfakeBench/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1199, in _next_data return self._process_data(data) File "/home/lab/anaconda3/envs/DeepfakeBench/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1225, in _process_data data.reraise() File "/home/lab/anaconda3/envs/DeepfakeBench/lib/python3.8/site-packages/torch/_utils.py", line 429, in reraise raise self.exc_type(msg) ValueError: Caught ValueError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/lab/anaconda3/envs/DeepfakeBench/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop data = fetcher.fetch(index) File "/home/lab/anaconda3/envs/DeepfakeBench/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/lab/anaconda3/envs/DeepfakeBench/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/lab/tSun/CADDM-master/dataset.py", line 81, in getitem img, label_dict = prepare_train_input( File "/home/lab/tSun/CADDM-master/lib/data_preprocess/preprocess.py", line 92, in prepare_train_input mfs_result, bbox = multi_scale_facial_swap( File "/home/lab/tSun/CADDM-master/lib/data_preprocess/mfs.py", line 130, in multi_scale_facial_swap h, w = targetRgb.shape[:2] ValueError: not enough values to unpack (expected 2, got 0)

I think it is caused by some images being empty when loading images, but I don't know how to solve it.

Nku-cs-dsc commented 4 months ago

You can traverse your dataset and filter out the source image without the corresponding target image before loading the training set.