8

深度学习-卷积神经网络-目标检测之YOLOV3模型-代码运行图片检测实践2

 3 years ago
source link: https://blog.csdn.net/firemonkeycs/article/details/109393144
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
深度学习-卷积神经网络-目标检测之YOLOV3模型-代码运行图片检测实践2_firemonkeycs的专栏-CSDN博客

深度学习-卷积神经网络(目标检测环境搭建)-TensorFlow及Keras环境搭建&详细安装教程

深度学习-卷积神经网络-目标检测之YOLOV3模型-代码运行图片检测实践1

深度学习-卷积神经网络-实例及代码0.8—基于最小均方误差的线性判别函数参数拟合训练

深度学习-卷积神经网络-实例及代码0.9—MNIST数据集介绍、下载及基本操作

深度学习-卷积神经网络-实例及代码1(入门)—利用Tensorflow和mnist数据集训练单层前馈神经网络/感知机实现手写数字识别

深度学习-卷积神经网络-实例及代码2(初级)—利用Tensorflow和mnist数据集训练简单的深度网络模型实现手写数字识别

深度学习-卷积神经网络-实例及代码3(图像分类LeNet5模型)—利用Tensorflow和mnist数据集训练LeNet5-CNN模型实现手写数字识别

前一篇文章主要通过修改yolo_video.py文件实现YOLOV3-Keras版本的执行图片检测

这里介绍另一种执行图片检测的实践途径,实验证明也是可行的;并且为后面使用自己的数据集进行训练做准备

使用的代码版本仍然是github上的qqwweee/keras-yolo3 Keras实现版本

在Windows环境下使用CPU进行检测

(操作系统:Windows 10专业版 64位)

(CPU:Intel(R) Core(TM) i5-4590 [email protected],内存8G)

执行下面YOLOV3的检测程序前,需要完成前序文章中的TensorFlow和Keras环境搭建和安装等内容

(如果要执行视频检测还要安装opencv的python版本等)

1,下载YOLOV3-Keras项目

从这里下载原始项目文件:Github上qqwweee-keras版本的YOLOV3实现

文后附上了该项目的具体说明内容

使用Pycharm软件打开下载解压后的keras-yolov3项目

(我这里换了个项目名字:KerasYolo3Test2)

2,修改代码——yolo_video.py(红色字体表示和前一篇文章处理方式有不同的地方,下同)

注释掉原有代码,修改为以下

3,修改代码——yolo.py

设置-1表明使用CPU训练,否则会报错:finished with exit code -1073740791 (0xC0000409)

4,下载YOLOV3官网上在COCO数据集上训练完成的权重文件yolov3.weights

进入YOLOV3官网链接:https://pjreddie.com/darknet/yolo/

找到 Performance on the COCO Dataset,其中有一行如下:
YOLOv3-416    COCO trainval    test-dev    55.3    65.86 Bn    35    cfg    weights

点击weights链接完成权重文件yolov3.weights的下载

5,执行代码convert.py,根据下载的权重文件生成模型
在pycharm中右键项目或项目文件,选择Open in Terminal
输入python convert.py yolov3.cfg yolov3.weights model_data/yolo.h5

完成模型的生成,在项目的model_data文件夹下可以看到yolo.h5

6,执行图片检测
直接run运行yolo_video.py 文件

检测过程及结果:

WARNING:tensorflow:From C:\Users\USER\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py:1630: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
WARNING:tensorflow:From C:\Users\USER\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_core\python\ops\array_ops.py:1475: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
2020-10-15 20:29:16.030648: E tensorflow/core/grappler/optimizers/meta_optimizer.cc:533] remapper failed: Invalid argument: Subshape must have computed start >= end since stride is negative, but is 0 and 2 (computed from start 0 and end 9223372036854775807 over shape with rank 2 and stride-1)
2020-10-15 20:29:16.613699: E tensorflow/core/grappler/optimizers/meta_optimizer.cc:533] remapper failed: Invalid argument: Subshape must have computed start >= end since stride is negative, but is 0 and 2 (computed from start 0 and end 9223372036854775807 over shape with rank 2 and stride-1)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK