ImageAI实现目标检测

A python library built to empower developers to build applications and systems with self-contained Deep Learning and Computer Vision capabilities using simple and few lines of code. 

https://github.com/OlafenwaMoses/ImageAI

model:https://github.com/OlafenwaMoses/ImageAI/releases

from imageai.Detection import ObjectDetection
import os

execution_path = os.getcwd()

detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path, "resnet50_coco_best_v2.0.1.h5") )
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path, "image2.jpg"))

for eachObject in detections:
    print(eachObject["name"] + " : " + eachObject["percentage_probability"])

猜你喜欢

转载自blog.csdn.net/qccz123456/article/details/81235188