Почему я получаю TypeError в imageAI?

Я получаю сообщение об ошибке при использовании imageAI.
Я попытался устранить неполадкиfile path и я уверен, что это правильно, что я не так?

Моя ОС Ubuntu 18+ и Python 2+ . Мой код ниже:

питон

import os
from imageai.Detection import ObjectDetection

execution_path = os.getcwd()

custom_path = "/home/tcslab/Desktop/project-test/"

detector = ObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath( os.path.join(execution_path , "yolo.h5"))
detector.loadModel()

# if os.path.isfile(os.path.join(custom_path, "image.jpg")):
#     print(1)

detections = \
    detector.detectObjectsFromImage(extract_detected_objects = True,
                                    input_image=os.path.join(custom_path, "image.jpg"), 
                                    input_type="file", 
                                    output_type="file", 
                                    output_image_path=os.path.join(custom_path, "image.jpg"), 
                                    minimum_percentage_probability=30
                                    )

for eachObject in detections:
    print(eachObject["name"] , " : ", eachObject["percentage_probability"], " : ", eachObject["box_points"] )
    print("--------------------------------")

Я получаю ошибку:

Traceback (most recent call last):   
File "test.py", line 16, in module
detections = detector.detectObjectsFromImage(extract_detected_objects = True, input_image=os.path.join(custom_path, "image.jpg"), input_type="file", output_type="file", output_image_path=os.path.join(custom_path), minimum_percentage_probability=30)
File "/home/tcslab/.local/lib/python2.7/site-packages/imageai/Detection/__init__.py", line 544, in detectObjectsFromImage
"Ensure you specified correct input image, input type, output type and/or output image path ")
ValueError: Ensure you specified correct input image, input type, output type and/or output image path

0 ответов

Другие вопросы по тегам