Occlusion_Net
Occlusion_Net copied to clipboard
Inference on Videos
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
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.
this might be an issue with no bounding box detected in the video frame. I would suggest adding a check to verify if the frame in the video has any detection if not just to continue.