Skip to content

Inference on Videos #23

Description

@simurgh7

Hi,
Thanks a lot for creating this repository.
I was trying to run inference on this code by using video data and modifying the scripts. However, after a few frames later it runs into error like this -
Traceback (most recent call last):
File "infer_video.py", line 168, in
main()
File "infer_video.py", line 111, in main
result = coco_demo.overlay_keypoints_graph(img, top_predictions,vis_color ,target='car')
File "/code/lib/predictor.py", line 317, in overlay_keypoints_graph
keypoints = predictions.get_field("keypoints")
File "/maskrcnn-benchmark/maskrcnn_benchmark/structures/bounding_box.py", line 43, in get_field
return self.extra_fields[field]
KeyError: 'keypoints'

The modified snippet looks like this -
cap = cv2.VideoCapture(url_list[0])
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter(output_dir + "/"+ now+"out.avi", fourcc, 30.0, (640, 480))
count = 0
while(True):
ret, img = cap.read()
if ret:
predictions = coco_demo.compute_prediction(img)
top_predictions = coco_demo.select_top_predictions(predictions)
result = coco_demo.overlay_keypoints_graph(img, top_predictions,vis_color ,target='car')
out.write(result)
#cv2.imshow('result',result)
count += 1
else:
break
cap.release()
out.release()
print(now)
now = datetime.datetime.now().strftime("%Y-%m-%d
%H-%M-%S")
print(now)

Any idea how to get around this one? Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions