Linux、Windows下试用DarkNet之YoLo CPU物体识别
关于YOLO:
YOLO——You Only Look Once
Faster RCNN需要对20k个anchor box进行判断是否是物体,然后再进行物体识别,分成了两步。
YOLO(You Only Look Once)则把物体框的选择与识别进行了结合,一步输出,即变成”You Only Look Once”。
所以识别速度非常快,达到每秒45帧,而在快速版YOLO(Fast YOLO,卷积层更少)中,可以达到每秒155帧。
关于DarkNet:
#Darknet#
Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation.
For more information see the [Darknet project website](http://pjreddie.com/darknet or https://github.com/pjreddie/darknet).
安装指南:http://pjreddie.com/darknet/install/
这个是我见过安装最简单的开源库了!!!
linux下,解压后直接make就可以了,如果你想实时可视化,开启OPENCV=1,关于这里配置OPENCV时需要注意下:
ifeq ($(OPENCV), 1)
COMMON+= -DOPENCV -I/usr/local/include
CFLAGS+= -DOPENCV
LDFLAGS+= -L/usr/local/lib -lopencv_core -lopencv_highgui -lopencv_imgproc
endif
编译好后,下载训练好的权值数据yolo.weights(我下的是700M左右的),同时使用了相应的yolo.cfg,从官网下的没运行成功!!!
贴一下yolo.cfg
[net]
batch=1
subdivisions=1
height=448
width=448
channels=3
momentum=0.9
decay=0.0005
saturation=1.5
exposure=1.5
hue=.1
learning_rate=0.0005
policy=steps
steps=200,400,600,20000,30000
scales=2.5,2,2,.1,.1
max_batches = 40000
[convolutional]
batch_normalize=1
filters=64
size=7
stride=2
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=192
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=128
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=512
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=512
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=512
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky
#######
[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=1024
activation=leaky
[convolutional]
batch_normalize=1
size=3
stride=2
pad=1
filters=1024
activation=leaky
[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=1024
activation=leaky
[convolutional]
batch_normalize=1
size=3
stride=1
pad=1
filters=1024
activation=leaky
[local]
size=3
stride=1
pad=1
filters=256
activation=leaky
[dropout]
probability=.5
[connected]
output= 1715
activation=linear
[detection]
classes=20
coords=4
rescore=1
side=7
num=3
softmax=0
sqrt=1
jitter=.2
object_scale=1
noobject_scale=.5
class_scale=1
coord_scale=5
键入命令:
$>./darknet yolo test cfg/yolo.cfg yolo.weights data/dog.jpg
Windows下更简单了,直接使用https://github.com/AlexeyAB/yolo-windows
可见CPU下Debug耗时太长啊!
更多推荐
所有评论(0)