Comments (10)
I suspect the encoding of your video is not supported. What is the video's codec and resolution?
from backgroundmattingv2.
This is directly from my camera (43MB):
Then I re-rendered the clip with kdenlive (10MB):
It's still crashing with the same error.
from backgroundmattingv2.
If it is convenient, send me your video and background image to [email protected]
from backgroundmattingv2.
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.
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.
@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.
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.
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.
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.
@jinzishuai Yeah it is some opencv problem.
from backgroundmattingv2.
Related Issues (20)
- I can't download the pretrained model from google drive, can you put the model on baidu drive?
- 视频的实时抠图 HOT 3
- how to understand the "err_map"
- Details of the training process
- How to add .gif/.mp4 video as background image? HOT 1
- How to train the model? HOT 2
- 请帮忙推荐收费的抠图软件哪个最好用
- How to eval this code?
- torch.multiprocessing.spawn.ProcessExitedException: process 1 terminated with signal SIGABRT HOT 1
- bug
- 用视频测试,alpha边缘不稳定,该如何解决
- Onnx version of Resnet models
- AttributeError: module 'kornia' has no attribute 'resize' HOT 1
- AttributeError: 'tqdm' object has no attribute 'disable' HOT 2
- inference_video.py:IndexError: Idx: 0 out of length: 1
- train_refine.py运行一段时间过后就会卡死不动 HOT 1
- The link for the trained model is broken HOT 4
- About align_corners setting?
- 请问V2版本resnet怎么转成onnx模型?
- Is your dataset VideoMatte240k MIT Licensed? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backgroundmattingv2.