SCLBD / DeepfakeBench

A comprehensive benchmark of deepfake detection
Other
470 stars 62 forks source link

I'm encountering some trouble in the implementation of the face x-ray model in the code. #21

Open fanfan1998 opened 1 year ago

fanfan1998 commented 1 year ago

Even when the training and test sets are exactly the same, the detector fails to achieve the desired results. In fact, the model is not trained at all. This is shown in the figure below: 691bab1634e52a1d1c7d984cdecfc7f 2569356d3eefc0359c905ec786fa2b1 Here's my settings on face x-ray, not sure if it's just me: 4144479cc7b0c23ce5d9404eec39e49 5b3d68e909b602dc186dfdd586b4837 9e16de65c169871f6e92dd8915221f9

fanfan1998 commented 1 year ago

Also, the naming of the .pkl file in generate_xray_nearest.py is a bit confusing, can you give a clearer version of this, thanks!

YZY-stack commented 1 year ago

Have you used the pre-trained weights of Face X-ray? If needed, I will update the processed file of this landmark dict, which saves the info for each image.

YZY-stack commented 9 months ago

@fanfan1998 To generate these pickle files, you can run the generate_xray_nearest.py file. If you want to check/use the files I have already generated, please refer to the link.

gbljdgb commented 6 months ago

@fanfan1998 Hello, I am also experiencing the same problem and was wondering if you have resolved the issue?

image
J-T-kullo commented 1 month ago

I meet the question as follows, could someone help me, thanks!

image

J-T-kullo commented 1 month ago

when I use the .pkl offered,I meet the new question,please!

Load HRnet 2024-08-22 08:57:24,265 - INFO - ===> Epoch[0] start! 2024-08-22 08:57:24,482 - INFO - data_dict saved to ./logs/training/facexray_None_2024-08-22-08-57-14/train/FF-NT/data_dict_train.pickle 0%| | 0/9950 [00:00<?, ?it/s] Traceback (most recent call last): File "training/train.py", line 324, in main() File "training/train.py", line 306, in main test_data_loaders=test_data_loaders, File "/root/data1/DeepfakeBench-main/training/trainer/trainer.py", line 239, in train_epoch for iteration, data_dict in tqdm(enumerate(train_data_loader),total=len(train_data_loader)): File "/root/miniconda3/envs/DeepfakeBench/lib/python3.7/site-packages/tqdm/std.py", line 1178, in iter for obj in iterable: File "/root/miniconda3/envs/DeepfakeBench/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 652, in next data = self._next_data() File "/root/miniconda3/envs/DeepfakeBench/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1347, in _next_data return self._process_data(data) File "/root/miniconda3/envs/DeepfakeBench/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1373, in _process_data data.reraise() File "/root/miniconda3/envs/DeepfakeBench/lib/python3.7/site-packages/torch/_utils.py", line 461, in reraise raise exception TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "/root/miniconda3/envs/DeepfakeBench/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop data = fetcher.fetch(index) File "/root/miniconda3/envs/DeepfakeBench/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/root/miniconda3/envs/DeepfakeBench/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/root/data1/DeepfakeBench-main/training/dataset/ff_blend.py", line 486, in getitem manipulate_img, boundary, imid_bg = self.process_images(imid_fg, imid_bg, index) File "/root/data1/DeepfakeBench-main/training/dataset/ff_blend.py", line 393, in process_images fg_im, fg_shape, bg_im, bg_shape = self.preprocess_images(imid_fg, imid_bg) File "/root/data1/DeepfakeBench-main/training/dataset/ff_blend.py", line 256, in preprocess_images fg_im = self.load_rgb(imid_fg.replace('landmarks', 'frames').replace('npy', 'png')) File "/root/data1/DeepfakeBench-main/training/dataset/ff_blend.py", line 176, in load_rgb image_buf = np.frombuffer(image_bin, dtype=np.uint8) TypeError: a bytes-like object is required, not 'NoneType'