Giter VIP home page Giter VIP logo

Comments (10)

PeterL1n avatar PeterL1n commented on May 12, 2024

I suspect the encoding of your video is not supported. What is the video's codec and resolution?

from backgroundmattingv2.

bigboss97 avatar bigboss97 commented on May 12, 2024

This is directly from my camera (43MB):
Screenshot - 20-12-24 18 36 21

Then I re-rendered the clip with kdenlive (10MB):
Screenshot - 20-12-24 18 37 20
It's still crashing with the same error.

from backgroundmattingv2.

PeterL1n avatar PeterL1n commented on May 12, 2024

If it is convenient, send me your video and background image to [email protected]

from backgroundmattingv2.

Qiang-Lin avatar Qiang-Lin commented on May 12, 2024

we got exactly the same error. And the video-src and video-bgr I used were directly downloaded from the provided google drive.

from backgroundmattingv2.

Qiang-Lin avatar Qiang-Lin commented on May 12, 2024

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.

from backgroundmattingv2.

PeterL1n avatar PeterL1n commented on May 12, 2024

@Qiang-Lin Can you provide the name of the video footage? Are you sure you are using the latest opencv as specified in our requirements.txt?

from backgroundmattingv2.

Qiang-Lin avatar Qiang-Lin commented on May 12, 2024

Yes, the version is the same.
Well, I tried dlh.mp4 and ao.mp4 in the fixed-camera folder and got the above problem. However, using other videos like vs2.mp4 can lead to a right result.

from backgroundmattingv2.

PeterL1n avatar PeterL1n commented on May 12, 2024

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?

from backgroundmattingv2.

jinzishuai avatar jinzishuai commented on May 12, 2024

Running ao.mp4 will have index out of length error at the end but that is fine and it is irrelevant to your issue.

Hi @PeterL1n are you seeing this index out of length error too?

This is my own video source:

(bgm2) C:\ZeroBox\src\BackgroundMattingV2> python inference_video.py --model-type mattingrefine --model-backbone resnet101 --model-checkpoint PyTorch\pytorch_resnet101.pth --video-src ..\..\group15B_Short.avi --video-bgr ..\..\background_group15B.png --output-dir output1 --output-type com fgr pha err ref --model-refine-mode full
Directory output1 already exists. Override? [Y/N]: Y
 25%|█████████████████████████████▊                                                                                          | 557/2241 [02:21<07:07,  3.94it/s]
Traceback (most recent call last):
  File "inference_video.py", line 178, in <module>
    for src, bgr in tqdm(DataLoader(dataset, batch_size=1, pin_memory=True)):
  File "C:\Users\jinzi\miniconda3\envs\bgm2\lib\site-packages\tqdm\std.py", line 1171, in __iter__
    for obj in iterable:
  File "C:\Users\jinzi\miniconda3\envs\bgm2\lib\site-packages\torch\utils\data\dataloader.py", line 435, in __next__
    data = self._next_data()
  File "C:\Users\jinzi\miniconda3\envs\bgm2\lib\site-packages\torch\utils\data\dataloader.py", line 475, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "C:\Users\jinzi\miniconda3\envs\bgm2\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\jinzi\miniconda3\envs\bgm2\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\ZeroBox\src\BackgroundMattingV2\dataset\zip.py", line 17, in __getitem__
    x = tuple(d[idx % len(d)] for d in self.datasets)
  File "C:\ZeroBox\src\BackgroundMattingV2\dataset\zip.py", line 17, in <genexpr>
    x = tuple(d[idx % len(d)] for d in self.datasets)
  File "C:\ZeroBox\src\BackgroundMattingV2\dataset\video.py", line 27, in __getitem__
    raise IndexError(f'Idx: {idx} out of length: {len(self)}')
IndexError: Idx: 557 out of length: 2241

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

from backgroundmattingv2.

PeterL1n avatar PeterL1n commented on May 12, 2024

@jinzishuai Yeah it is some opencv problem.

from backgroundmattingv2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.