ImageAI icon indicating copy to clipboard operation
ImageAI copied to clipboard

CustomDetector did not work?

Open sissiwup opened this issue 3 years ago • 0 comments

`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

sissiwup avatar Sep 01 '21 21:09 sissiwup