Drawing bounding box with ImageAI

333 Views Asked by At

I am using ImageAI to draw bounding boxes on images.

from imageai.Detection import ObjectDetection
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()

# Load model
model_path = 'resnet50_coco_best_v2.0.1.h5'
detector.setModelPath(model_path)
detector.loadModel()

This raises an error:

----> 6 detector.setModelPath(model_path)
ValueError: invalid path, path not pointing to a valid file.

However, 'resnet50_coco_best_v2.0.1.h5' file exists (https://github.com/OlafenwaMoses/ImageAI/releases/tag/1.0).

Could you suggest I can fix this error? Thank you.

1

There are 1 best solutions below

1
On

You'll have to download it and set the path to the file in model_path . For example if you have the file in the same folder as the script the path would be './resnet50_coco_best_v2.0.1.h5'