ImageAI
ImageAI copied to clipboard
CustomDetector did not work?
`import pika
import os import datetime from PIL import Image import argparse import requests from imageai.Detection import ObjectDetection
execution_path = os.getcwd() detector = ObjectDetection() detector.setModelTypeAsYOLOv3() detector.setModelPath(os.path.join(execution_path, "yolo.h5")) detector.loadModel(detection_speed="faster") custom = detector.CustomObjects(person=True)
def callback(ch, method, properties, body):
item = body.decode("utf-8")
if item is None:
print("End Worker")
return
try:
task = (item.split(";"))
timestamp = task[0]
akt = datetime.datetime.now()
done = "--"
# LOOK
if task[1] == "LOOK":
img = Image.open(task[2]);
returned_image, detections = detector.detectCustomObjectsFromImage(
custom_objects=custom,
input_type="array",
# input_image=task[2],
input_image=img,
output_type="array",
minimum_percentage_probability=70)`
Error: Ensure you specified correct input image, input type, output type and/or output image path