Object detection slow processing video [closed]

asked 2019-05-16 21:22:08 -0600

I'm running the sample code that comes with the Object Detection model, I made a modification to read a video instead of a webcam the problem is that the window opens and plays the video but in extreme slow (really is very slow , does not exceed 1 fps I think)

 video = cv2.VideoCapture(PATH_TO_VIDEO)


while(video.isOpened()):

    ret, frame = video.read()
    frame_expanded = np.expand_dims(frame, axis=0)

    # Perform the actual detection by running the model with the image as input
    (boxes, scores, classes, num) = sess.run(
[detection_boxes, detection_scores, detection_classes, num_detections],
    feed_dict={image_tensor: frame_expanded})

    # Draw the results of the detection (aka 'visulaize the results')
    vis_util.visualize_boxes_and_labels_on_image_array(
frame,
np.squeeze(boxes),
np.squeeze(classes).astype(np.int32),
np.squeeze(scores),
category_index,
use_normalized_coordinates=True,
line_thickness=8,
min_score_thresh=0.60)

    # All the results have been drawn on the frame, so it's time to display it.
    cv2.imshow('Object detector', frame)

    # Press 'q' to quit
    if cv2.waitKey(1) == ord('q'):
        break

video.release()
cv2.destroyAllWindows()
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by LBerger
close date 2019-05-17 02:14:25.071435

Comments

1

sess.run is not an opencv function. We cannot help you. And check video size (width and height)

LBerger gravatar imageLBerger ( 2019-05-17 02:14:18 -0600 )edit