My problem is that I have ymin,xmin,ymax,xmax and boxes shapes.
I can't extract objects detected, it just display all image not boxes.
What I tried:
image_url = "https://upload.wikimedia.org/wikipedia/commons/6/60/Naxos_Taverna.jpg" #@param
downloaded_image_path = download_and_resize_image(image_url, 1280, 856, True)
import cv2
...
for i in range(min(boxes.shape[0], max_boxes)):
if scores[i] >= min_score:
ymin, xmin, ymax, xmax = tuple(boxes[i])
display_str = "{}: {}%".format(class_names[i].decode("ascii"),
int(100 * scores[i]))
color = colors[hash(class_names[i]) % len(colors)]
image_pil = Image.fromarray(np.uint8(image)).convert("RGB")
print(image_pil)
image = np.array(image_pil)
print(type(image))
import cv2
rect = cv2.rectangle(image, ((xmin), (ymin)), ((xmax), (ymax)), (0, 0, 255), 1)
print(ymin, xmin, ymax, xmax)
cv2_imshow(rect)
I use this API: https://www.tensorflow.org/hub/tutorials/object_detection
Example of one object detection ymin, xmin, ymax, xmax : 0.6325336 0.2925815 0.92287964 0.40271035 object type : b'Chair'