資源簡介
python imageAi 檢測物體坐標獲取

代碼片段和文件信息
#qq:448251593業余pythonc?ucos?Linux?物聯網
#需要安裝pip3?install?https://github.com/OlafenwaMoses/ImageAI/releases/download/2.0.2/imageai-2.0.2-py3-none-any.whl
from?imageai.Detection?import?objectDetection
import?os
pic_name=“b1“
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??pic_name+“.jpg“)?output_image_path=os.path.join(execution_path??pic_name+“new.jpg“))
for?eachobject?in?detections:
????print(eachobject[“name“]?+?“?:?“?+?str(eachobject[“percentage_probability“]))
????print(“x1?=?“?+?str(eachobject[“box_points“][0]))
????print(“y1?=?“?+?str(eachobject[“box_points“][1]))
????print(“x2?=?“?+?str(eachobject[“box_points“][2]))
????print(“y2?=?“?+?str(eachobject[“box_points“][3]))
????print(“--------------------------------“)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????21561??2019-04-19?11:45??b1.jpg
?????文件???????60712??2019-04-20?14:28??b1new.jpg
?????文件????????1016??2019-04-20?14:33??Firstob
- 上一篇:python實現圖片個性化文字編輯
- 下一篇:爬取知網的社科基金項目文章信息
評論
共有 條評論