PeterL1n / BackgroundMattingV2

Real-Time High-Resolution Background Matting
MIT License
6.85k stars 952 forks source link

用4K视频+inference_video.py 总是报错 #97

Closed zhanghonglishanzai closed 3 years ago

zhanghonglishanzai commented 3 years ago

python /home/ubuntu/BM/BackgroundMattingV2/inference_video.py \ --model-type mattingrefine \ --model-backbone resnet50 \ --model-backbone-scale 0.25 \ --model-refine-mode sampling \ --model-refine-sample-pixels 80000 \ --model-checkpoint "/home/ubuntu/BM/pytorch_resnet50.pth" \ --video-src "/home/ubuntu/BM/content/4K_pre-process/b5.mp4" \ --video-bgr "/home/ubuntu/BM/content/4K_pre-process/b5.png" \ --output-dir "/home/ubuntu/BM/content/4K_pre-process/output/" \ --output-type com fgr pha err ref

`(modnet_offline_5) ubuntu@ubuntu:~/BM/content/4K_pre-process$ python /home/ubuntu/BM/BackgroundMattingV2/inference_video.py \

    --model-type mattingrefine \
    --model-backbone resnet50 \
    --model-backbone-scale 0.25 \
    --model-refine-mode sampling \
    --model-refine-sample-pixels 80000 \
    --model-checkpoint "/home/ubuntu/BM/pytorch_resnet50.pth" \
    --video-src "/home/ubuntu/BM/content/4K_pre-process/b5.mp4" \
    --video-bgr "/home/ubuntu/BM/content/4K_pre-process/b5.png" \
    --output-dir "/home/ubuntu/BM/content/4K_pre-process/output/" \
    --output-type com fgr pha err ref

93%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 359/388 [03:05<00:15, 1.93it/s] Traceback (most recent call last): File "/home/ubuntu/BM/BackgroundMattingV2/inference_video.py", line 182, in for input_batch in tqdm(DataLoader(dataset, batch_size=1, pin_memory=True)): File "/home/ubuntu/anaconda3/envs/modnet_offline_5/lib/python3.6/site-packages/tqdm/std.py", line 1171, in iter for obj in iterable: File "/home/ubuntu/anaconda3/envs/modnet_offline_5/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/home/ubuntu/anaconda3/envs/modnet_offline_5/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 475, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/ubuntu/anaconda3/envs/modnet_offline_5/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/ubuntu/anaconda3/envs/modnet_offline_5/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/ubuntu/BM/BackgroundMattingV2/dataset/zip.py", line 17, in getitem x = tuple(d[idx % len(d)] for d in self.datasets) File "/home/ubuntu/BM/BackgroundMattingV2/dataset/zip.py", line 17, in x = tuple(d[idx % len(d)] for d in self.datasets) File "/home/ubuntu/BM/BackgroundMattingV2/dataset/video.py", line 27, in getitem raise IndexError(f'Idx: {idx} out of length: {len(self)}') IndexError: Idx: 359 out of length: 388`

这个错误之前在其他人的issues中看到过,请问有解决方案了吗

PeterL1n commented 3 years ago

这个错误可以忽略,视频应该已经Export成功了。

zinuoli commented 2 years ago

您好,您后面还有遇到类似的问题吗,我也遇到这个错误,并且视频质量不是很好