youyuge34 / Anime-InPainting

An application tool of edge-connect, which can do anime inpainting and drawing. 动漫人物图片自动修复,去马赛克,填补,去瑕疵

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

读取图片的时候报错 ValueError: empty range for randrange() (0,0, 0)

fiveriddle opened this issue · comments

我的图片和掩码都是1.2w,报错场景是这样的,有想过是图片的问题,但没能解决,求助一下博主,谢谢了
start training...

Training epoch: 1
loading error: ./celeb/008621.png
loading error: ./celeb/010481.png
loading error: ./celeb/003145.png
loading error: ./celeb/004050.png
loading error: ./celeb/011577.png
Traceback (most recent call last):
File "train.py", line 4, in
main(mode=1)
File "/mnt/Anime-InPainting/main.py", line 55, in main
model.train()
File "/mnt/Anime-InPainting/src/edge_connect.py", line 101, in train
for items in train_loader:
File "/root/miniconda3/envs/myconda/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 637, in next
return self._process_next_batch(batch)
File "/root/miniconda3/envs/myconda/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
ValueError: Traceback (most recent call last):
File "/mnt/Anime-InPainting/src/dataset.py", line 41, in getitem
item = self.load_item(index)
File "/mnt/Anime-InPainting/src/dataset.py", line 67, in load_item
mask = self.load_mask(img, index)
File "/mnt/Anime-InPainting/src/dataset.py", line 135, in load_mask
mask_index = random.randint(0, len(self.mask_data) - 1)
File "/root/miniconda3/envs/myconda/lib/python3.6/random.py", line 221, in randint
return self.randrange(a, b+1)
File "/root/miniconda3/envs/myconda/lib/python3.6/random.py", line 199, in randrange
raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0,0, 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/miniconda3/envs/myconda/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/root/miniconda3/envs/myconda/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/mnt/Anime-InPainting/src/dataset.py", line 44, in getitem
item = self.load_item(0)
File "/mnt/Anime-InPainting/src/dataset.py", line 67, in load_item
mask = self.load_mask(img, index)
File "/mnt/Anime-InPainting/src/dataset.py", line 135, in load_mask
mask_index = random.randint(0, len(self.mask_data) - 1)
File "/root/miniconda3/envs/myconda/lib/python3.6/random.py", line 221, in randint
return self.randrange(a, b+1)
File "/root/miniconda3/envs/myconda/lib/python3.6/random.py", line 199, in randrange
raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0,0, 0)