Imageai: Please help me out to solve the error

Created on 6 Oct 2019  路  3Comments  路  Source: OlafenwaMoses/ImageAI

This is the code

from imageai.Detection import VideoObjectDetection
import os

execution_path = os.getcwd()

detector = VideoObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath(os.path.join(execution_path, "resnet50_coco_best_v2.0.1.h5"))

custom_objects = detector.CustomObjects(car=True, motorcycle=True, truck=True)

video_path = detector.detectCustomObjectsFromVideo(
            custom_objects=custom_objects,
            input_file_path=os.path.join(execution_path, "cars.avi"),
            save_detected_video=False,
            frames_per_second=30,
            log_progress=True)

print(video_path)

and this is the error

An error occured. It may be that your input video is invalid. Ensure you specified a proper string value for 'output_file_path' is 'save_detected_video' is not False. "
ValueError: An error occured. It may be that your input video is invalid. Ensure you specified a proper string value for 'output_file_path' is 'save_detected_video' is not False. Also ensure your per_frame, per_second, per_minute or video_complete_analysis function is properly configured to receive the right parameters.

All 3 comments

@shivam9804 Do you have the latest version installed v.2.1.5?

  • Kindly install via the latest version via pip pip3 install imageai --upgrade
  • Also, ensure the input video is in the specified path

@OlafenwaMoses Thank you for the response, it solved my problem.

Am happy to know that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bestbugwriter picture bestbugwriter  路  5Comments

huangl6 picture huangl6  路  6Comments

jakubstech picture jakubstech  路  6Comments

Combinacijus picture Combinacijus  路  3Comments

palacinka picture palacinka  路  3Comments