注:1.imageai目前(2020年03月23日)不支持tensorflow2.0,官方帮助文档:https://imageai.readthedocs.io/en/latest/detection/index.html

2.网卡必须为Navidia,并且计算能力为3.0以上才行。计算能力查询:https://developer.nvidia.com/cuda-gpus#collapseOne

3.tensorflow-gpu版本与python版本、CUDA版本、cuDNN版本必须一一对应,否则无法调用。查询地址:https://www.tensorflow.org/install/source_windows。(tensorflow-gpu与CUDA、cuDNN的对应关系可以自动处理,见下文环境配置章节第4步【安装tensorflow-gpu=1.10.0】)

4.必须安装驱动,驱动下载地址:https://www.nvidia.cn/Download/index.aspx?lang=cn

一、环境配置

下载并安装驱动(略)
1.下载Anaconda3,我下载的是Anaconda3-2020.02-Windows-x86_64.exe版本,默认Python3.7.6。
2.点击【开始】【Anaconda Prompt】。


3.创建及激活虚拟环境

添加国内镜像源,下载包的速度更快

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

创建虚拟环境

conda create -n env2 python=3.6.1

激活虚拟环境

activate env2

后续的所有安装都在env2环境下
4.安装tensorflow-gpu=1.10.0

conda install tensorflow-gpu=1.10.0

此命令可自动完成cuda和cudnn的安装。

5.安装Keras==2.1.6

pip install Keras==2.1.6  -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com


6.安装opencv-python

pip install opencv-python -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

7.安装imageai

pip install imageai  -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

8.打开Spyter,点击菜单【Tools】【Preferences】,选择左边的【Python interpreter】,选择新创建环境下的python.exe,点击【OK】


这时大概率会出现Your Python environment or installation doesn’t have the spyder-kernels module


解决方法:

pip install spyder-kernels -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com

至此,库及开发环境就配置好了,可以编写代码了。

二、代码编写与调试
1.在Spyter的temp.py中输入如下代码

import os
from imageai.Detection import ObjectDetection
import cv2execution_path = os.getcwd()detector = ObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath( os.path.join(execution_path , "yolo.h5"))
detector.loadModel()cap = cv2.VideoCapture(0)
while True:ret, frame = cap.read()   x, y = frame.shape[0:2]   returned_image, detections = detector.detectObjectsFromImage(input_image=frame,input_type='array', output_type='array', minimum_percentage_probability=30)cv2.imshow("video", returned_image) if cv2.waitKey(1) & 0xFF == ord('q'):breakcap.release()
cv2.destroyAllWindows()  


2.下载yolo.h5(下载地址:https://imageai.readthedocs.io/en/latest/detection/index.html)


3.在temp.py上点击右键,选中【Show in external file explorer】,打开temp.py所在文件夹,将下载的yolo.h5放入到文件夹。


4.运行程序,按q键可以退出。


附:
虚拟环境中库及版本

Name

Version

Build

Channel

_tflow_select

2.1.0

gpu

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

absl-py

0.9.0

py36_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

astor

0.8.0

py36_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

backcall

0.1.0

pypi_0

pypi

blas

1

mkl

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

certifi

2019.11.28

py36_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

cloudpickle

1.3.0

pypi_0

pypi

colorama

0.4.3

pypi_0

pypi

cudatoolkit

9

1

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

cudnn

7.6.5

cuda9.0_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

cycler

0.10.0

pypi_0

pypi

decorator

4.4.2

pypi_0

pypi

gast

0.3.3

py_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

grpcio

1.12.1

py36h1a1b453_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

h5py

2.10.0

pypi_0

pypi

icc_rt

2019.0.0

h0cc432a_1

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

imageai

2.1.5

pypi_0

pypi

intel-openmp

2020

166

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

ipykernel

5.2.0

pypi_0

pypi

ipython

7.13.0

pypi_0

pypi

ipython-genutils

0.2.0

pypi_0

pypi

jedi

0.16.0

pypi_0

pypi

jupyter-client

6.1.0

pypi_0

pypi

jupyter-core

4.6.3

pypi_0

pypi

keras

2.1.6

pypi_0

pypi

kiwisolver

1.1.0

pypi_0

pypi

libprotobuf

3.6.0

h1a1b453_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

markdown

3.1.1

py36_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

matplotlib

3.2.1

pypi_0

pypi

mkl

2020

166

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

numpy

1.14.2

py36h5c71026_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

opencv-python

4.2.0.32

pypi_0

pypi

parso

0.6.2

pypi_0

pypi

pickleshare

0.7.5

pypi_0

pypi

pillow

7.0.0

pypi_0

pypi

pip

20.0.2

py36_1

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

prompt-toolkit

3.0.4

pypi_0

pypi

protobuf

3.6.0

py36he025d50_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

pygments

2.6.1

pypi_0

pypi

pyparsing

2.4.6

pypi_0

pypi

python

3.6.1

2

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

python-dateutil

2.8.1

pypi_0

pypi

pywin32

227

pypi_0

pypi

pyyaml

5.3.1

pypi_0

pypi

pyzmq

19.0.0

pypi_0

pypi

scipy

1.4.1

pypi_0

pypi

setuptools

46.0.0

py36_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

six

1.14.0

py36_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

spyder-kernels

1.9.0

pypi_0

pypi

tensorboard

1.10.0

py36he025d50_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

tensorflow

1.10.0

gpu_py36h3514669_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

tensorflow-base

1.10.0

gpu_py36h6e53903_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

tensorflow-gpu

1.10.0

hf154084_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

termcolor

1.1.0

py36_1

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

tornado

6.0.4

pypi_0

pypi

traitlets

4.3.3

pypi_0

pypi

vc

14

0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

vs2015_runtime

14.16.27012

hf0eaf9b_1

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

wcwidth

0.1.8

pypi_0

pypi

werkzeug

1.0.0

py_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

wheel

0.34.2

py36_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

wincertstore

0.2

py36h7fe50ca_0

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

zlib

1.2.11

h8395fce_2

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

Win10下ImageAI-gpu(tensorflow-gpu)环境安装(cuda及cuDNN自动安装)及实时对象检测相关推荐

  1. win10/11 paddlepaddle2.3/2.2 之 匹配CUDA和Cudnn版本安装

    完整的安装方法参考我的博客如下:包括显卡驱动检测 选择安装,VS2015/17/19安装,CUDA11.2安装和配置,cudnn安装.还包括CUDA卸载方法 (27条消息) 2022最详细,最新的 W ...

  2. WIN10下配置Yolov3(VS2019,GPU)+opencv训练自己的数据集(绝对详细,小白型记录)

    大二菜鸡,因为要准备一个水下识别的比赛,想到了用yolov3这个强大的框架,参考了许多大佬的博客,在这里记录一下自己的配置过程. ** 一. CUDA和CUDNN配置 ** 我的显卡的GTX1060, ...

  3. Mint系统使用介绍,Mint系统安装,在Mint系统上搭建GPU环境,在Mint系统上安装Pycharm、Anaconda等软件,在Mint系统上安装cuda和cudnn

    欢迎大家关注笔者,你的关注是我持续更博的最大动力 原创文章,转载告知,盗版必究 Mint系统使用介绍,Mint系统安装,在Mint系统上搭建GPU环境,在Mint系统上安装Pycharm.Anacon ...

  4. Ubuntu搭建GPU环境(CUDA、cuDNN)

    前言 曾在Win10上搭建GPU环境,并使用Tensoflow-gpu训练卷积神经网络.现在使用Ubuntu运行项目,所以重新搭建一下GPU环境,下面记录一下过程. [TensorFlow]Windo ...

  5. 在keras中使用gpu加速训练模型;安装cuda;cudnn;cudnn_cnn_infer64_8.dll 不在path中;device_lib.list_local_devices无gpu;挂掉

    在keras中使用gpu加速训练模型,如何安装cuda,cudnn,解决cudnn_cnn_infer64_8.dll 不在path中,解决device_lib.list_local_devices( ...

  6. win10下CUDA和cuDNN的安装(超详细)

    文章目录 1. CPU和GPU 2. 什么是CUDA 3.什么是cuDNN 4.CUDA与cuDNN的关系 5.安装 5.1 CUDA的安装 5.2 cuDNN的安装 6.参考 7.注意: 1. CP ...

  7. Windows10下CUDA与cuDNN的安装

    安装CUDA 了解自己电脑的CUDA版本,右击-NVIDIA控制面板-系统信息-组件.支持的CUDA版本与显卡驱动有关. 通过下面网址进行下载对应CUDA版本,也不一定非要装最高版本. CUDA To ...

  8. 我的AI之路(5)--如何选择和正确安装跟Tensorflow版本对应的CUDA和cuDNN版本

    最新的Tensorflow和CUDA cuDNN的对应关系可以从这里找到: https://tensorflow.google.cn/install/source https://tensorflow ...

  9. Win10+GTX1050Ti安装CUDA和cuDNN的记录

    最近机器学习的课设需要用到Tensorflow来跑代码. 有CPU和GPU两个版本的Tensorflow(Google怎么这么优秀,气哭.jpg) 电脑是GTX1050Ti的显卡,4G.系统是Win1 ...

  10. Tensorflow-gpu安装+Keras安装+Pytorch-gpu安装 经验分享/Win10 (conda安装Cuda和Cudnn) 含测试代码

    Tensorflow-gpu安装+Keras安装+Pytorch-gpu安装 经验分享/Win10 (conda安装Cuda和Cudnn) 含测试代码 注意: 本文中的Cuda和Cudnn安装均采用c ...

最新文章

  1. mysql中比较函数_MySQL:MySQL层比较函数调用
  2. 【转】NSDictionary以及NSMutableDictionary的用法
  3. golang平滑重启
  4. 自考护理学计算机考试时间,护理学专业2019年10月江苏自考科目及考试时间安排...
  5. Windows删除指定时间之前指定后缀名的文件
  6. YOLO学习-2:win10(64位)+ python3.6 + TensorFlow-GPU + keras + yolov3测试实践(增加笔记本显卡GPU加速)
  7. delphi使用 第三方控件
  8. GET_ROLE_BASED_PAGE_USAGES
  9. 嵌入式C语言编程课件,嵌入式系统C语言编程基础PPT课件
  10. linux qt创建静态库,QT创建与QT无关的纯C++程序和动态/静态库
  11. 2011总结与2012展望
  12. webstorm 配置webserver选项,让其他ip设备可访问(如手机等测试效果) ...
  13. Ruby程序语言入门
  14. 新闻文本分类学习笔记
  15. 如何才能高效学习,99%的人不知道的高效学习法(非常棒棒文章)
  16. 停车、投票、领证,区块链如何在「智慧城市」建设中大显身手?
  17. 互联网医疗十大公司排名
  18. 电脑解锁后黑屏有鼠标_电脑开机后黑屏只有鼠标怎么办
  19. NFS服务器配置与管理笔记
  20. 解决安卓手机USB接口被外设占用导致无法调试的问题

热门文章

  1. 基于STM32的PWM电机驱动TB6612、A4950
  2. 传感器学习——TB6612
  3. 什么是静态分析?代码分析工具
  4. Kali Linux 无法定位软件包
  5. 中科院分区基础版和升级版究竟有何区别?
  6. 凯恩帝k1000ti参数设置_凯恩帝KND数控K1000TI系统维修
  7. windows系统安装wget指令
  8. 怎样利用通达信软件调出半年线和年线?
  9. 解决notepad++ php代码美化
  10. 20170330今日头条笔试题