imageai官网地址: 传送门

详细版地址:https://blog.csdn.net/Baldprogrammer/article/details/116358180

项目地址:传送门

1、安装环境(最终版)
安装python-3.6.8-amd64 一键安装,勾选添加到path中

安装imageAI --官网地址:https://imageai-cn.readthedocs.io/zh_CN/latest/ImageAI.html
cmd执行安裝相关模块:
pip3 install --index-url https://pypi.douban.com/simple -U tensorflow==1.4.0
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -U numpy==1.16.0
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -U scipy==1.4.1
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -U opencv-python==4.5.1.48
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -U pillow==8.2.0
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -U matplotlib==3.3.4
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -U h5py==2.10.0
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -U keras==2.2.0
pip3 install https://github.com/OlafenwaMoses/ImageAI/releases/download/2.0.1/imageai-2.0.1-py3-none-any.whl

模型文件下载地址:传送门

图像预测:

from imageai.Detection import ObjectDetection
import os# os.environ["TF_CPP_MIN_LOG_LEVEL"]='1' # 这是默认的显示等级,显示所有信息
# os.environ["TF_CPP_MIN_LOG_LEVEL"]='2' # 只显示 warning 和 Error
# os.environ["TF_CPP_MIN_LOG_LEVEL"]='3' # 只显示 Errorexecution_path = os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()detector.setModelPath(os.path.join(execution_path+"\\model\\" , "resnet50_coco_best_v2.0.1.h5"))
# 设置模型的检测速度 detection_speed="fast" “normal”(default), “fast”, “faster” , “fastest” and “flash”
detector.loadModel(detection_speed="normal")# 定义使用的模型
custom_objects = detector.CustomObjects( person=True, bicycle=True, car=True, motorcycle=True, airplane=True,bus=True, train=True, truck=True, boat=True, traffic_light=True, fire_hydrant=True, stop_sign=True,parking_meter=True, bench=True, bird=True, cat=True, dog=True, horse=True, sheep=True, cow=True, elephant=True, bear=True, zebra=True,giraffe=True, backpack=True, umbrella=True, handbag=True, tie=True, suitcase=True, frisbee=True, skis=True, snowboard=True,sports_ball=True, kite=True, baseball_bat=True, baseball_glove=True, skateboard=True, surfboard=True, tennis_racket=True,bottle=True, wine_glass=True, cup=True, fork=True, knife=True, spoon=True, bowl=True, banana=True, apple=True, sandwich=True, orange=True,broccoli=True, carrot=True, hot_dog=True, pizza=True, donot=True, cake=True, chair=True, couch=True, potted_plant=True, bed=True,dining_table=True, toilet=True, tv=True, laptop=True, mouse=True, remote=True, keyboard=True, cell_phone=True, microwave=True,oven=True, toaster=True, sink=True, refrigerator=True, book=True, clock=True, vase=True, scissors=True, teddy_bear=True, hair_dryer=True,toothbrush=True)# 是否把识别对象抠出来放到文件夹里
isSingle=TrueinPath=execution_path+"\\image\\in\\"
outPath=execution_path+"\\image\\out\\"all_images_array = []
all_files = os.listdir(inPath)
for each_file in all_files:if(each_file.endswith(".jpg") or each_file.endswith(".png")):all_images_array.append(each_file)for path in all_images_array:# 进行识别detections, objects_path = detector.detectCustomObjectsFromImage(extract_detected_objects=isSingle,  # 将识别的图片单独保存出来minimum_percentage_probability=50,  # 置信度input_type="file",  # 输入文件格式 file/array/streamoutput_type="file",  # 输出文件格式 file/array/streamcustom_objects=custom_objects,  # 选择可用模型input_image=os.path.join(inPath, path),  # 输入文件output_image_path=os.path.join(outPath, "copy_"+path),  # 输出文件)# 输出识别信息if isSingle:for eachObject, eachObjectPath in zip(detections, objects_path):print(eachObject["name"] + " : " + eachObject["percentage_probability"])print("Object's image saved in " + eachObjectPath)else:for eachObject in detections:print(eachObject["name"] + " : " + eachObject["percentage_probability"])print("--------------------------------")

对象检测

from imageai.Detection import ObjectDetection
import os# os.environ["TF_CPP_MIN_LOG_LEVEL"]='1' # 这是默认的显示等级,显示所有信息
# os.environ["TF_CPP_MIN_LOG_LEVEL"]='2' # 只显示 warning 和 Error
# os.environ["TF_CPP_MIN_LOG_LEVEL"]='3' # 只显示 Errorexecution_path = os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()detector.setModelPath(os.path.join(execution_path+"\\model\\" , "resnet50_coco_best_v2.0.1.h5"))
# 设置模型的检测速度 detection_speed="fast" “normal”(default), “fast”, “faster” , “fastest” and “flash”
detector.loadModel(detection_speed="normal")# 定义使用的模型
custom_objects = detector.CustomObjects( person=True, bicycle=True, car=True, motorcycle=True, airplane=True,bus=True, train=True, truck=True, boat=True, traffic_light=True, fire_hydrant=True, stop_sign=True,parking_meter=True, bench=True, bird=True, cat=True, dog=True, horse=True, sheep=True, cow=True, elephant=True, bear=True, zebra=True,giraffe=True, backpack=True, umbrella=True, handbag=True, tie=True, suitcase=True, frisbee=True, skis=True, snowboard=True,sports_ball=True, kite=True, baseball_bat=True, baseball_glove=True, skateboard=True, surfboard=True, tennis_racket=True,bottle=True, wine_glass=True, cup=True, fork=True, knife=True, spoon=True, bowl=True, banana=True, apple=True, sandwich=True, orange=True,broccoli=True, carrot=True, hot_dog=True, pizza=True, donot=True, cake=True, chair=True, couch=True, potted_plant=True, bed=True,dining_table=True, toilet=True, tv=True, laptop=True, mouse=True, remote=True, keyboard=True, cell_phone=True, microwave=True,oven=True, toaster=True, sink=True, refrigerator=True, book=True, clock=True, vase=True, scissors=True, teddy_bear=True, hair_dryer=True,toothbrush=True)# 是否把识别对象抠出来放到文件夹里
isSingle=True# 进行识别
detections, objects_path  = detector.detectCustomObjectsFromImage(extract_detected_objects=isSingle, #将识别的图片单独保存出来minimum_percentage_probability=50, #置信度input_type="file", #输入文件格式 file/array/streamoutput_type="file", #输出文件格式 file/array/streamcustom_objects=custom_objects,  #选择可用模型input_image=os.path.join(execution_path+"\\image\\in\\", "13.jpg"), # 输入文件output_image_path=os.path.join(execution_path+"\\image\\out\\", "13(2).jpg"), # 输出文件)#输出识别信息
if isSingle:for eachObject, eachObjectPath in zip(detections, objects_path):print(eachObject["name"] + " : " + eachObject["percentage_probability"])print("Object's image saved in " + eachObjectPath)
else:for eachObject in detections:print(eachObject["name"] + " : " + eachObject["percentage_probability"])print("--------------------------------")

视频检测

from imageai.Detection import VideoObjectDetection
import os# os.environ["TF_CPP_MIN_LOG_LEVEL"]='1' # 这是默认的显示等级,显示所有信息
# os.environ["TF_CPP_MIN_LOG_LEVEL"]='2' # 只显示 warning 和 Error
# os.environ["TF_CPP_MIN_LOG_LEVEL"]='3' # 只显示 Errorexecution_path = os.getcwd()detector = VideoObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath(os.path.join(execution_path+"\\model\\", "resnet50_coco_best_v2.0.1.h5"))
# 模型等级 “normal”(default), “fast”, “faster” , “fastest” and “flash”
detector.loadModel(detection_speed="fastest")# 定义使用的模型
custom_objects = detector.CustomObjects( person=True, bicycle=True, car=True, motorcycle=True, airplane=True,bus=True, train=True, truck=True, boat=True, traffic_light=True, fire_hydrant=True, stop_sign=True,parking_meter=True, bench=True, bird=True, cat=True, dog=True, horse=True, sheep=True, cow=True, elephant=True, bear=True, zebra=True,giraffe=True, backpack=True, umbrella=True, handbag=True, tie=True, suitcase=True, frisbee=True, skis=True, snowboard=True,sports_ball=True, kite=True, baseball_bat=True, baseball_glove=True, skateboard=True, surfboard=True, tennis_racket=True,bottle=True, wine_glass=True, cup=True, fork=True, knife=True, spoon=True, bowl=True, banana=True, apple=True, sandwich=True, orange=True,broccoli=True, carrot=True, hot_dog=True, pizza=True, donot=True, cake=True, chair=True, couch=True, potted_plant=True, bed=True,dining_table=True, toilet=True, tv=True, laptop=True, mouse=True, remote=True, keyboard=True, cell_phone=True, microwave=True,oven=True, toaster=True, sink=True, refrigerator=True, book=True, clock=True, vase=True, scissors=True, teddy_bear=True, hair_dryer=True,toothbrush=True)video_path = detector.detectCustomObjectsFromVideo(custom_objects=custom_objects, #指定模型input_file_path=os.path.join(execution_path+"\\video\\in\\", "holo1.mp4"),  #输入输入视频路径output_file_path=os.path.join(execution_path+"\\video\\out\\", "holo1_1"),  #不指定默认为avi格式frames_per_second=20, #输出视频的帧数frame_detection_interval=5,#帧间隔 每隔几帧检测一回log_progress=True) #输出日志print(video_path)

效果图:




开源图像识别、imageai图像识别、对象识别、识别人、车、猫、狗等80种 简易版相关推荐

  1. lenet5卷积神经网络_tensorflow图像识别入门实战:使用LeNet5模型实现猫狗分类

    LeNet5介绍 LeNet-5是一种高效的卷积神经网络,在论文<Gradient-Based Learning Applied to Document Recognition>中 有详细 ...

  2. 基于Python的卷积神经网络的猫狗图像识别系统

    目录 基与卷积神经网络模型的猫狗图像识别 1 一. 摘要 2 二. 动机 2 三. 理论和算法理解 2 I.卷积神经网络 2 定义 3 结构 3 应用 5 II.算法实现 5 Part 1 - Dat ...

  3. 华为云深度学习kaggle猫狗识别

    使用华为云深度学习服务完成kaggle猫狗识别竞赛 参考: kaggle猫狗竞赛kernel第一名的代码 Tensorflow官网代码 华为云DLS服务github代码 1. 环境配置与数据集处理 首 ...

  4. 使用卷积神经网络处理猫狗识别数据集_v1

    说明 采用pytorch框架实现猫狗识别. 数据集下载 猫狗识别数据集下载: 链接:https://pan.baidu.com/s/1hfzSacJbNBUhcDDtPnzlsg  提取码:fu74 ...

  5. GitHub开源的ImageAI 库:几行代码可实现目标对象识别

    目录​​​​​​​ 1.图像预测 2.物体检测 3.视频对象检测和跟踪 ImageAI是一个Python库,旨在使开发人员能够使用简单的几行代码构建具有自包含深度学习和计算机视觉功能的应用程序和系统. ...

  6. python 验证码识别 阿里云_python3调用阿里云图像识别OCR-实现验证码识别

    python3 调用阿里云图像识别OCR-验证码识别 前言 使用别人的接口,是需要在别人的平台上创建应用的. 所以,我们要先去 购买地址:(放心,免费的.) https://market.aliyun ...

  7. 神经网络的图像识别技术,神经网络如何识别图像

    图像识别系统有几种方式?具体是什么? 图片识别的实现基础是由图像处理.计算机视觉和模糊识别等多学科实现的,现阶段市面上已经有很多像图普科技成熟大厂可以提供智能审核的软件. 在人工智能中,实现图像识别有 ...

  8. 计算机识别检测,从猫狗不分到实时识别准确率超过99%,计算机图像识别是如何做到的?...

    原标题:从猫狗不分到实时识别准确率超过99%,计算机图像识别是如何做到的? [导读] 十年前,研究人员认为让计算机来区分猫和狗几乎是不可能的.如今,计算机视觉识别的准确率已超过99%.Joseph R ...

  9. 超级实时图形计算机,从猫狗不分到实时识别准确率超过99%,计算机图像识别是如何做到的?...

    十年前,研究人员认为让计算机来区分猫和狗几乎是不可能的.如今,计算机视觉识别的准确率已超过99%.Joseph Redmon通过一个叫YOLO的开源目标检测方法,可以迅速识别图像和视频中的目标. 来源 ...

  10. Tensorflow 学习入门(二) 初级图像识别——手写数字识别

    初级图像识别--手写数字识别 背景知识储备 Softmax Regression MNIST 矩阵相乘 One Hot 编码 Cross Entropy(交叉熵) 代码实现 引入数据 设计数据结构 完 ...

最新文章

  1. Gitlab代码管理仓库安装部署
  2. 设置stm32系统各部分时钟
  3. 模块计算机类型x64与目标计算机类型X86冲突
  4. IDEA中启动SpringBoot项目时提示:“Error java:程序包xxx不存在”,但实际上是存在的
  5. Android Studio 构建
  6. ubuntu+touch+android,移动操作系统Ubuntu Touch支持安卓应用
  7. php 任意字符串_php 生成任意长度字符串的类(只含有数字 只含有字母 混合数字和字母)...
  8. 标准模板库STL学习总结
  9. Java多线程系列(四):4种常用Java线程锁的特点,性能比较、使用场景
  10. UP-DETR:收敛更快!精度更高!华南理工微信开源无监督预训练目标检测模型...
  11. android tsclib.so,续 某哩某哩APP之m3u8解密分析之跳过so文件 从APP日志入手(AES/CBC模式)...
  12. C语言随笔小算法:取出一个任意整数的每一位数值
  13. 【老孙随笔】 神秘的茶馆
  14. web安全day35:Linux防火墙进阶
  15. The NVIDIA driver on your system is too old (found version 9000).
  16. html按钮按下效果_按下微信这个按钮,手机秒变翻译神器!各国语言随便译,真好...
  17. 【Unity游戏开发】不接SDK也能在游戏内拉起加QQ群操作?
  18. 柔性上肢康复机器人研究中的VR技术
  19. linux和windows下分别如何查看电脑是32位的还是64位?
  20. 专为工程模型而生,全新PolyJet J850 Pro 3D打印机现已上市

热门文章

  1. 10款网站后台管理系统模板_bootstrap网站后台模板_html后台模板下载(五)
  2. Python和R之间转换的基本指南:使用Python或R知识来有效学习另一种语言的简单方法。
  3. 关于urule决策引擎客户端服务器配置的一些细节
  4. 北京冬奥会交通临时管理措施发布:春节前调休工作日限行
  5. android微信朋友圈相册背景,微信朋友圈相册背景多大尺寸合适
  6. 黑马java基础学习笔记第一天
  7. tpadmin合成推广二维码
  8. php格式化 货币,php – 使用numberFormatter格式化货币
  9. Hexo Next 主题字体相关配置
  10. 使用MoveIt!+Arbotix控制六自由度机械臂