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 , "11.jpg"), output_image_path=os.path.join(execution_path , "11new.jpg"))
for eachObject in detections:
print(eachObject["name"] + " : " + eachObject["percentage_probability"] )
runfile('C:/OPENCv/untitled2.py', wdir='C:/OPENCv')
cup : 79.31604385375977
cup : 66.11060500144958
cup : 83.2493543624878
cup : 92.63944625854492
person : 99.34452772140503
person : 92.91112422943115
person : 86.39482855796814
person : 98.52168560028076
laptop : 83.08642506599426
person : 86.49797439575195
参考来源:
https://baijiahao.baidu.com/s?id=1627406244873238742&wfr=spider&for=pc
https://www.jianshu.com/p/94d5edfaddd5
https://blog.csdn.net/gravitylink/article/details/82739690
https://github.com/OlafenwaMoses/ImageAI
http://baijiahao.baidu.com/s?id=1604852765149468838&wfr=spider&for=pc
https://mbd.baidu.com/newspage/data/landingsuper?context=%7B%22nid%22%3A%22news_9611327155578036794%22%7D&n_type=1&p_from=4
http://baijiahao.baidu.com/s?id=1604247631540063337&wfr=spider&for=pc
https://baijiahao.baidu.com/s?id=1637822659435117454&wfr=spider&for=pc
https://blog.csdn.net/tcy23456/article/details/88551116
http://baijiahao.baidu.com/s?id=1639481539248220870&wfr=spider&for=pc
https://blog.csdn.net/devopscsdn/article/details/78889879
https://cloud.tencent.com/info/3928ee0e266bfb42fe779f21dca750d5.html
http://newgame.duowan.com/1811/406132030586.html
https://baijiahao.baidu.com/s?id=1637939971968161368&wfr=spider&for=pc
https://tech.qq.com/a/20181107/012040.htm