SunnyHaze / IML-ViT

Official repository of paper “IML-ViT: Benchmarking Image manipulation localization by Vision Transformer”
MIT License
184 stars 23 forks source link

Regarding the issue of TP and GT size matching #19

Closed hcztxdy closed 2 months ago

hcztxdy commented 3 months ago

Hello, I had a problem with the mismatch between the TP and GT sizes while training, but the GT is not at all 800x518 in size, do you know what's going on Traceback (most recent call last): File "main_train.py", line 269, in main(args) File "main_train.py", line 220, in main args=args File "/opt/data/private/LL/IML-ViT-main/engine_train.py", line 37, in train_one_epoch for data_iter_step, (samples, masks, edge_mask, shape) in enumerate(metric_logger.log_every(data_loader, print_freq, header)): File "/opt/data/private/LL/IML-ViT-main/utils/misc.py", line 146, in log_every for obj in iterable: File "/root/anaconda3/envs/pytorch-LL/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 628, in next data = self._next_data() File "/root/anaconda3/envs/pytorch-LL/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1333, in _next_data return self._process_data(data) File "/root/anaconda3/envs/pytorch-LL/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1359, in _process_data data.reraise() File "/root/anaconda3/envs/pytorch-LL/lib/python3.7/site-packages/torch/_utils.py", line 543, in reraise raise exception AssertionError: Caught AssertionError in DataLoader worker process 0. Original Traceback (most recent call last): File "/root/anaconda3/envs/pytorch-LL/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop data = fetcher.fetch(index) File "/root/anaconda3/envs/pytorch-LL/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 58, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/root/anaconda3/envs/pytorch-LL/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 58, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/opt/data/private/LL/IML-ViT-main/utils/datasets.py", line 88, in getitem assert tp_shape == gt_shape, "tp and gt image shape must be the same, but got {} and {}".format(tp_shape, gt_shape) AssertionError: tp and gt image shape must be the same, but got (256, 384) and (800, 518)

SunnyHaze commented 3 months ago

Hi, thanks for your attention to our work.

As stated in the error stack, the sizes of the tampered image and the ground truth image in the provided dataset do not match. The following solutions might help you resolve this issue:

If you are using mani_dataset to read the dataset, consider whether the images and masks in the /Tp and /Gt folders have matching names, or at least have the same order when sorted. If that is not the issue, consider whether the corresponding images and masks have inconsistent sizes. You can set this variable to True to check the specific filenames: link to the variable.

Hope this helps you, if you have further issue, feel free to reach out.

hcztxdy commented 2 months ago

Thank you for the answer, it should be my negligence, this problem has been solved

fangfangbuaibiancheng commented 1 month ago

Thank you for the answer, it should be my negligence, this problem has been solved

Hello, I encountered a similar problem in my project and would like to know how you solved it. Would you please share your experience and solution? Thank you!