New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZeroDivisionError: integer division or modulo by zero #14
Comments
I suspect the encoding of your video is not supported. What is the video's codec and resolution? |
If it is convenient, send me your video and background image to peterlin9863@gmail.com |
we got exactly the same error. And the video-src and video-bgr I used were directly downloaded from the provided google drive. |
I find the reason. The cv2 can'ts get the information(such as width, height and frame_count ) of the video-src. |
@Qiang-Lin Can you provide the name of the video footage? Are you sure you are using the latest opencv as specified in our |
Yes, the version is the same. |
I just tried dlh.mp4 and ao.mp4 in the provided Google Colab notebook. They work fine. In fact the default example video is dlh.mp4 so you don't even need to upload it yourself. Running ao.mp4 will have index out of length error at the end but that is fine and it is irrelevant to your issue. @Qiang-Lin Did you run it in Colab? |
Hi @PeterL1n are you seeing this index out of length error too? This is my own video source:
I can confirm using ffmpeg that the source video only contains 557 frames so I am not sure how that number of 2241 is calcualted (it is almost 4x557). Is that a problem with my source video? Thanks |
@jinzishuai Yeah it is some opencv problem. |
I have successfully converted a 440x440 video using colab. Now I'm trying with a HD video and received following error:
!python 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 "/content/model.pth"
--video-src "/content/balconay_test.mp4"
--video-bgr "/content/balcony_bg.jpg"
--output-dir "/content/output/"
--output-type com fgr pha err ref
0% 0/1 [00:00<?, ?it/s]Traceback (most recent call last):
File "inference_video.py", line 178, in
for src, bgr in tqdm(DataLoader(dataset, batch_size=1, pin_memory=True)):
File "/usr/local/lib/python3.6/dist-packages/tqdm/std.py", line 1104, in iter
for obj in iterable:
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 435, in next
data = self._next_data()
File "/usr/local/lib/python3.6/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.6/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.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/content/BackgroundMattingV2/dataset/zip.py", line 17, in getitem
x = tuple(d[idx % len(d)] for d in self.datasets)
File "/content/BackgroundMattingV2/dataset/zip.py", line 17, in
x = tuple(d[idx % len(d)] for d in self.datasets)
ZeroDivisionError: integer division or modulo by zero
0% 0/1 [00:00<?, ?it/s]
The text was updated successfully, but these errors were encountered: