YOLO配置运行
来源:互联网 发布:新菜鸟网络俱乐部 编辑:程序博客网 时间:2024/06/06 03:37
一.YOLO安装
1.clone Darknet命令:git clone https://github.com/pjreddie/darknet.git
2.编译:
cd darknet
make
3.使用
usage: ./darknet <function>
4.为了更快可以编译CUDA,方法:在Makefile文件中设置GPU=1,然后重新make
nvidia-smi命令查看显卡信息。
-i <index>标志可以选卡显卡
例如下面命令选择序号为1的显卡运行程序
./darknet -i 1 imagenet test cfg/alexnet.cfg alexnet.weights
也可以不适用gpu,例如如下设置
./darknet -nogpu 参数。。。
5.编译Opencv.
By default, Darknet uses stb_image.h for image loading. If you want more support for weird formats (like CMYK jpegs, thanks Obama) you can use OpenCV instead! OpenCV also allows you to view images and detections without having to save them to disk.
在Makefile里设置OPENCV=1,重新编译。下面命令可显示检测结果
./darknet imtest data/eagle.jpg
二.命令:
1.测试图片命令
./darknet yolo test cfg/yolo.cfg <path>/yolo.weights <image>
例如:./darknet yolo test cfg/yolo.cfg <path>/yolo.weights data/dog.jpg
2.改变阈值
YOLO默认只显示置信度(得分)>0.2的detections,可以改变通过命令改变阈值
./darknet yolo test cfg/yolo.cfg yolo.weights data/dog.jpg -thresh 0(阈值为0)
3.实时检测
编译CUDA和OpenCV,为了更快
选择三个模型中合适的模型
运行命令: ./darknet yolo demo cfg/yolo.cfg yolo.weights
命令行选择网络相机命令:-c <num> (OpenCV uses webcam 0 by default)
4.训练 YOLO(在Pascal VOC上训练为例)
生成标签:
下载2007-2012所有数据,利用voc_label.py(scripts目录下)生成数据标签文件(txt格式,每行格式<object-class> <x> <y> <width> <height>
生成的标签存储在VOCdevkit/VOC2007/labels/,在darknet目录下你会看到2007_test.txt 2007_train.txt 2007_val.txt 2012_train.tx 2012_val.txt
训练集合并:
用07所有图片和12train做训练样本 cat 2007_* 2012_train.txt > train.txt #多个txt文档内容合并
使darknet指向Pascal数据集:
修改src/yolo.c文件,令train_images指向你的train.txt文件位置,改后要重新在命令行重新make下。
char *train_images = "/home/pjreddie/data/voc/test/train.txt";
下载ImageNet上与训练的模型 网址:pjreddie.com/media/files/extraction.conv.weights
开始训练:命令 ./darknet yolo train cfg/yolo.cfg extraction.conv.weights
5.测试数据集中所有图片(例子VOC2012的test)
生成测试数据列表:
tar xf 2012test.tar
cp VOCdevkit/VOC2012/ImageSets/Main/test.txt .
sed 's?^?'`pwd`'/VOCdevkit/VOC2012/JPEGImages/?; s?$?.jpg?' test.txt > voc.2012.test
mv voc.2012.test <path-to>/darknet/data
修改列表路径:
修改yolo.c中的路径为voc.2012.test的路径,为了复现论文里的mAP精度,需要下载参数模型yolo.rescore.weights,2007trainval+2012 trainval
测试命令:
./darknet yolo valid cfg/yolo.cfg yolo.rescore.weights
模型的snapshot:
128000张图片都训练一遍后,会产生模型参数的snapshot(快照,可以用这个模型初始化网络继续训练),名称yolo_12000.weights,存储位置在src/yolo.c指定。程序设置一共跑40000次迭代,最终模型存储为yolo_final.weights
三.三个不同大小的模型版本(YOLO Model Comparison)
1.yolo.cfg is based on the extraction network. It processes images at 45 fps, here are weight files for yolo.cfg trained on 2007 train/val+ 2012 train/val, and trained on all 2007 and 2012 data.
2.yolo-small.cfg has smaller fully connected layers so it uses far less memory. It processes images at 50 fps, here are weight files for yolo-small.cfg trained on 2007 train/val+ 2012 train/val.
3.yolo-tiny.cfg is much smaller and based on the Darknet reference network. It processes images at 155 fps, here are weight files for yolo-tiny.cfg trained on 2007 train/val+ 2012 train/val.
错误:
1.check_error: Assertion `0' failed. GPU架构的问题把Makefile中的下面语句中的52换成30 ARCH= --gpu-architecture=compute_30 --gpu-code=compute_30
http://stackoverflow.com/questions/37851098/darknet-framework-fails-to-start-with-gpu-acceleration-using-cuda
1.clone Darknet命令:git clone https://github.com/pjreddie/darknet.git
2.编译:
cd darknet
make
3.使用
usage: ./darknet <function>
4.为了更快可以编译CUDA,方法:在Makefile文件中设置GPU=1,然后重新make
nvidia-smi命令查看显卡信息。
-i <index>标志可以选卡显卡
例如下面命令选择序号为1的显卡运行程序
./darknet -i 1 imagenet test cfg/alexnet.cfg alexnet.weights
也可以不适用gpu,例如如下设置
./darknet -nogpu 参数。。。
5.编译Opencv.
By default, Darknet uses stb_image.h for image loading. If you want more support for weird formats (like CMYK jpegs, thanks Obama) you can use OpenCV instead! OpenCV also allows you to view images and detections without having to save them to disk.
在Makefile里设置OPENCV=1,重新编译。下面命令可显示检测结果
./darknet imtest data/eagle.jpg
二.命令:
1.测试图片命令
./darknet yolo test cfg/yolo.cfg <path>/yolo.weights <image>
例如:./darknet yolo test cfg/yolo.cfg <path>/yolo.weights data/dog.jpg
2.改变阈值
YOLO默认只显示置信度(得分)>0.2的detections,可以改变通过命令改变阈值
./darknet yolo test cfg/yolo.cfg yolo.weights data/dog.jpg -thresh 0(阈值为0)
3.实时检测
编译CUDA和OpenCV,为了更快
选择三个模型中合适的模型
运行命令: ./darknet yolo demo cfg/yolo.cfg yolo.weights
命令行选择网络相机命令:-c <num> (OpenCV uses webcam 0 by default)
4.训练 YOLO(在Pascal VOC上训练为例)
生成标签:
下载2007-2012所有数据,利用voc_label.py(scripts目录下)生成数据标签文件(txt格式,每行格式<object-class> <x> <y> <width> <height>
生成的标签存储在VOCdevkit/VOC2007/labels/,在darknet目录下你会看到2007_test.txt 2007_train.txt 2007_val.txt 2012_train.tx 2012_val.txt
训练集合并:
用07所有图片和12train做训练样本 cat 2007_* 2012_train.txt > train.txt #多个txt文档内容合并
使darknet指向Pascal数据集:
修改src/yolo.c文件,令train_images指向你的train.txt文件位置,改后要重新在命令行重新make下。
char *train_images = "/home/pjreddie/data/voc/test/train.txt";
下载ImageNet上与训练的模型 网址:pjreddie.com/media/files/extraction.conv.weights
开始训练:命令 ./darknet yolo train cfg/yolo.cfg extraction.conv.weights
5.测试数据集中所有图片(例子VOC2012的test)
生成测试数据列表:
tar xf 2012test.tar
cp VOCdevkit/VOC2012/ImageSets/Main/test.txt .
sed 's?^?'`pwd`'/VOCdevkit/VOC2012/JPEGImages/?; s?$?.jpg?' test.txt > voc.2012.test
mv voc.2012.test <path-to>/darknet/data
修改列表路径:
修改yolo.c中的路径为voc.2012.test的路径,为了复现论文里的mAP精度,需要下载参数模型yolo.rescore.weights,2007trainval+2012 trainval
测试命令:
./darknet yolo valid cfg/yolo.cfg yolo.rescore.weights
模型的snapshot:
128000张图片都训练一遍后,会产生模型参数的snapshot(快照,可以用这个模型初始化网络继续训练),名称yolo_12000.weights,存储位置在src/yolo.c指定。程序设置一共跑40000次迭代,最终模型存储为yolo_final.weights
三.三个不同大小的模型版本(YOLO Model Comparison)
1.yolo.cfg is based on the extraction network. It processes images at 45 fps, here are weight files for yolo.cfg trained on 2007 train/val+ 2012 train/val, and trained on all 2007 and 2012 data.
2.yolo-small.cfg has smaller fully connected layers so it uses far less memory. It processes images at 50 fps, here are weight files for yolo-small.cfg trained on 2007 train/val+ 2012 train/val.
3.yolo-tiny.cfg is much smaller and based on the Darknet reference network. It processes images at 155 fps, here are weight files for yolo-tiny.cfg trained on 2007 train/val+ 2012 train/val.
错误:
1.check_error: Assertion `0' failed. GPU架构的问题把Makefile中的下面语句中的52换成30 ARCH= --gpu-architecture=compute_30 --gpu-code=compute_30
http://stackoverflow.com/questions/37851098/darknet-framework-fails-to-start-with-gpu-acceleration-using-cuda
0 5
- YOLO配置运行
- YOLO工程代码如何在windows上配置和运行!window上YOLO训练样本的制作
- YOLO windows 配置
- YOLO windows 配置
- Darknet YOLO 安装配置
- Yolo,darknet配置
- YOLO安装与配置
- YOLO安装与配置
- caffe运行yolo-tiny记录
- YOLO
- YOLO
- YOLO
- yolo
- YOLO
- yolo
- Yolo
- YOLO
- YOLO
- LA 5135 Mining Your Own Business(点双连通分量+贪心)
- 代码审计的艺术系列—第九篇
- 死锁的产生和解决
- 用万网云虚拟主机搭建一个自有域名的WordPress博客
- UVA 10820 Send a Table [欧拉函数] [线性筛法]
- YOLO配置运行
- 机房建设效果图制作|机房鸟瞰图设计|教程文章
- Android中数据存储
- 使用数组存储邻接表
- WEB重点总结
- tesseract-ocr在mac下的使用汇总
- linux中的函数手册
- 重学 Statistics, Cha11 Inferences About Population Variances
- 【机房收费】实时错误2147217873 不能将值Null插入列