Skip to content

How to output masks using vis_util.visualize_boxes_and_labels_on_image_array? #1

@jericovalino

Description

@jericovalino

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

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