-
Notifications
You must be signed in to change notification settings - Fork 71
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
error when inference on mp4 #9
Comments
Hi @mrfsc, this problem is because detectron2 requires bounding boxes to compute IoU to associate objects between frames for assigning colors. You can refer to the line: https://github.com/facebookresearch/detectron2/blob/221448e4dcfbebf215b8d21ae7e4b1dfbf422d29/detectron2/utils/video_visualizer.py#L104 if boxes is None:
masks_rles = mask_util.encode(
np.asarray(np.asarray(masks.tensor.permute(1, 2, 0)), dtype=np.uint8, order="F")
)
detected = [
_DetectedInstance(classes[i], None, mask_rle=masks_rles[i], color=None, ttl=8)
for i in range(num_instances)
]
else:
detected = [
_DetectedInstance(classes[i], boxes[i], mask_rle=None, color=None, ttl=8)
for i in range(num_instances)
] |
it's been solved by alter video_visualizer.py, thanks very much! by the way, there is a small bug in demo.py line 104: it works by the modification: |
Thanks and I will fix it! |
if boxes is None: 这段代码应该放在哪里啊???我的video_visualizer.py 中L85是这样的: |
The versions of detectron2 is required as v0.3, please confirm the version of your detectron2. You may installed the latest version of detectron2:) |
thx! |
I meet some different error, what should I do to fix this problem? |
I got this error solved by using |
ooooh, Thanks, this solution also solved my problem |
But, when I finished run my code, I can‘t find my result, I want to know how to save my video result? |
If you run
|
This is my order: But when I finished run, nothing here is preserved |
I believe you should see the results in |
oooh, I chang my code like this: |
Can you help me?? I still can't find my video result. |
I meet a problem, this is my order: |
you can try replace "--output video" to "--output video01.mp4" |
Can you tell exacty which changes did you do in video_visualizer.py? |
i meet some error when i run demo.py by:
python demo.py --config-file configs/sparse_inst_r50_giam.yaml --video-input test.mp4 --output results --opt MODEL.WEIGHTS sparse_inst_r50_giam_aug_2b7d68.pth INPUT.MIN_SIZE_TEST 512
it returns:
**[ERROR:0@4.053] global /io/opencv/modules/videoio/src/cap.cpp (595) open VIDEOIO(CV_IMAGES): raised OpenCV exception:
OpenCV(4.5.5) /io/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): results in function 'icvExtractPattern'
0%| | 0/266 [00:00<?, ?it/s]/home/user/InstanceSeg/detectron2/detectron2/structures/image_list.py:114: UserWarning: floordiv is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
max_size = (max_size + (stride - 1)) // stride * stride
/home/user/anaconda3/envs/seg/lib/python3.7/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2228.)
return _VF.meshgrid(tensors, kwargs) # type: ignore[attr-defined]
0%| | 0/266 [00:00<?, ?it/s]
Traceback (most recent call last):
File "demo.py", line 160, in
for vis_frame in tqdm.tqdm(demo.run_on_video(video, args.confidence_threshold), total=num_frames):
File "/home/user/anaconda3/envs/seg/lib/python3.7/site-packages/tqdm-4.63.1-py3.7.egg/tqdm/std.py", line 1195, in iter
for obj in iterable:
File "/home/user/InstanceSeg/SparseInst/sparseinst/d2_predictor.py", line 138, in run_on_video
yield process_predictions(frame, self.predictor(frame))
File "/home/user/InstanceSeg/SparseInst/sparseinst/d2_predictor.py", line 106, in process_predictions
frame, predictions)
File "/home/user/InstanceSeg/detectron2/detectron2/utils/video_visualizer.py", line 86, in draw_instance_predictions
for i in range(num_instances)
File "/home/user/InstanceSeg/detectron2/detectron2/utils/video_visualizer.py", line 86, in
for i in range(num_instances)
TypeError: 'NoneType' object is not subscriptable
The text was updated successfully, but these errors were encountered: