您当前的位置: 首页 > 

程序员正茂

暂无认证

  • 2浏览

    0关注

    283博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

在Google Colaboratory测试imageAI

程序员正茂 发布时间:2020-03-15 23:11:33 ,浏览量:2

1. 打开Colaboratory

2. 点击左上角的【文件】【新建笔记本】

3. 点击菜单【代码执行程序】【更改运行时类型】,修改为为GPU 4. !wget https://github.com/OlafenwaMoses/ImageAI/releases/download/1.0/yolo.h5 5. !wget https://github.com/OlafenwaMoses/ImageAI/raw/master/data-images/image2.jpg 6. !pip install imageai 7. 进行代码测试,将生成Image2new.jpg

from imageai.Detection import ObjectDetection
import os

execution_path = os.getcwd()

detector = ObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath( os.path.join(execution_path , "yolo.h5"))
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image2.jpg"), output_image_path=os.path.join(execution_path , "image2new.jpg"), minimum_percentage_probability=30)

for eachObject in detections:
    print(eachObject["name"] , " : ", eachObject["percentage_probability"], " : ", eachObject["box_points"] )
    print("--------------------------------")

关注
打赏
1660743125
查看更多评论
立即登录/注册

微信扫码登录

0.0359s