Closed Yiir-1 closed 1 year ago
@Yiir-1 Hello Sir, I have the same error as you. How did you solve this issue (ZeroDivisionError: integer division or modulo by zero), can you share how to solve it?
@Yiir-1 Hello Sir, I have the same error as you. How did you solve this issue (ZeroDivisionError: integer division or modulo by zero), can you share how to solve it?
I soved it .You should config the background path in data_path.pth
@Yiir-1 how did you use the checkpoints from stage 1 in stage 2. Can you provide full command to run stage 2?
I got the following error message after I configure data_path.pth and run train_base.py as follow:
!python train_base.py \ --dataset-name videomatte240k \ --model-backbone resnet50 \ --model-name mattingbase-resnet50-videomatte240k \ --model-pretrain-initialization "/content/drive/MyDrive/BackgroundMattingV2-master/pretrain/best_deeplabv3_resnet50_voc_os16.pth" \ --epoch-end 8
Loaded state_dict: 353/374 matched 0% 0/29749 [00:01<?, ?it/s] Traceback (most recent call last): File "train_base.py", line 261, in
train()
File "train_base.py", line 138, in train
for i, ((true_pha, true_fgr), true_bgr) in enumerate(tqdm(dataloader_train)):
File "/usr/local/lib/python3.8/dist-packages/tqdm/std.py", line 1171, in iter
for obj in iterable:
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 435, in next
data = self._next_data()
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py", line 475, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/content/drive/MyDrive/BackgroundMattingV2-master/dataset/zip.py", line 17, in getitem
x = tuple(d[idx % len(d)] for d in self.datasets)
File "/content/drive/MyDrive/BackgroundMattingV2-master/dataset/zip.py", line 17, in
x = tuple(d[idx % len(d)] for d in self.datasets)
ZeroDivisionError: integer division or modulo by zero
I don't know why it is wrong, I have configured data_path.pth to point my dataset as follows:
'videomatte240k': { 'train': { 'fgr': '/content/drive/MyDrive/BackgroundMattingV2-master/VideoMatte240K_JPEG_SD/train/fgr', 'pha': '/content/drive/MyDrive/BackgroundMattingV2-master/VideoMatte240K_JPEG_SD/train/pha' }, 'valid': { 'fgr': '/content/drive/MyDrive/BackgroundMattingV2-master/VideoMatte240K_JPEG_SD/test/fgr', 'pha': '/content/drive/MyDrive/BackgroundMattingV2-master/VideoMatte240K_JPEG_SD/test/pha' } },
please help me, thanks!