Skip to content
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

How to output masks using vis_util.visualize_boxes_and_labels_on_image_array? #1

Open
jericovalino opened this issue Apr 15, 2019 · 1 comment

Comments

@jericovalino
Copy link

I cannot output the masks using vis_util.visualize_boxes_and_labels_on_image_array.
It seems that the size of the masks is different from the size of the image

this is the error :
ValueError: The image has spatial dimensions (480, 640) but the mask has dimensions (15, 15)

here is my code.. please correct it.

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


    (masks, boxes, scores, classes, num) = sess.run([detection_masks,
                                                    detection_boxes,
                                                    detection_scores,
                                                    detection_classes,
                                                    num_detections],
                                                    feed_dict={image_tensor: frame_expanded})

    masks = np.squeeze(masks).astype(np.uint8)

    vis_util.visualize_boxes_and_labels_on_image_array(
        frame,
        np.squeeze(boxes),
        np.squeeze(classes).astype(np.int32),
        np.squeeze(scores),
        category_index,
        instance_masks=masks,
        use_normalized_coordinates=True,
        line_thickness=2)


    cv2.imshow('Object detector', frame)


    if cv2.waitKey(1) == ord('q'):
        break
@jericovalino
Copy link
Author

@reigngt09

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant