1
I need to manipulate an image and identify the objects inside it. But the answer I get comes with white space and I’m not able to handle to remove these white spaces.
Code:
from imageai.Detection import ObjectDetection
import numpy as np
import os
import cv2
executing_path = os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join (executing_path, "resnet50_coco_best_v2.0.1.h5"))
detector.loadModel()
custom_objects = detector.CustomObjects(bottle=True)
detections = detector.detectCustomObjectsFromImage(custom_objects=custom_objects,input_image=os.path.join(executing_path, "mercado1.jpg"),
output_image_path=os.path.join(executing_path, "mercado111.jpg"),
minimum_percentage_probability=10, display_percentage_probability=True, display_object_name=False)
for eachObject in detections:
y = eachObject["box_points"]
print(y)
Answer:
[ 990 33 1011 91]
[970 52 990 91]
[ 986 49 1006 92]
[1011 32 1040 91]
How I’d like it to stay:
[990 33 1011 91]
[970 52 990 91]
[986 49 1006 92]
[1011 32 1040 91]
I’m using Imageai to search for objects in the image.