# keras-yolo3
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE)
## Introduction
A Keras implementation of YOLOv3 (Tensorflow backend) inspired by [allanzelener/YAD2K](https://github.com/allanzelener/YAD2K).
---
## Quick Start
1. Download YOLOv3 weights from [YOLO website](http://pjreddie.com/darknet/yolo/).
2. Convert the Darknet YOLO model to a Keras model.
3. Run YOLO detection.
```
wget https://pjreddie.com/media/files/yolov3.weights
python convert.py yolov3.cfg yolov3.weights model_data/yolo.h5
python yolo_video.py [OPTIONS...] --image, for image detection mode, OR
python yolo_video.py [video_path] [output_path (optional)]
```
For Tiny YOLOv3, just do in a similar way, just specify model path and anchor path with `--model model_file` and `--anchors anchor_file`.
### Usage
Use --help to see usage of yolo_video.py:
```
usage: yolo_video.py [-h] [--model MODEL] [--anchors ANCHORS]
[--classes CLASSES] [--gpu_num GPU_NUM] [--image]
[--input] [--output]
positional arguments:
--input Video input path
--output Video output path
optional arguments:
-h, --help show this help message and exit
--model MODEL path to model weight file, default model_data/yolo.h5
--anchors ANCHORS path to anchor definitions, default
model_data/yolo_anchors.txt
--classes CLASSES path to class definitions, default
model_data/coco_classes.txt
--gpu_num GPU_NUM Number of GPU to use, default 1
--image Image detection mode, will ignore all positional arguments
```
---
4. MultiGPU usage: use `--gpu_num N` to use N GPUs. It is passed to the [Keras multi_gpu_model()](https://keras.io/utils/#multi_gpu_model).
## Training
1. Generate your own annotation file and class names file.
One row for one image;
Row format: `image_file_path box1 box2 ... boxN`;
Box format: `x_min,y_min,x_max,y_max,class_id` (no space).
For VOC dataset, try `python voc_annotation.py`
Here is an example:
```
path/to/img1.jpg 50,100,150,200,0 30,50,200,120,3
path/to/img2.jpg 120,300,250,600,2
...
```
2. Make sure you have run `python convert.py -w yolov3.cfg yolov3.weights model_data/yolo_weights.h5`
The file model_data/yolo_weights.h5 is used to load pretrained weights.
3. Modify train.py and start training.
`python train.py`
Use your trained weights or checkpoint weights with command line option `--model model_file` when using yolo_video.py
Remember to modify class path or anchor path, with `--classes class_file` and `--anchors anchor_file`.
If you want to use original pretrained weights for YOLOv3:
1. `wget https://pjreddie.com/media/files/darknet53.conv.74`
2. rename it as darknet53.weights
3. `python convert.py -w darknet53.cfg darknet53.weights model_data/darknet53_weights.h5`
4. use model_data/darknet53_weights.h5 in train.py
---
## Some issues to know
1. The test environment is
- Python 3.5.2
- Keras 2.1.5
- tensorflow 1.6.0
2. Default anchors are used. If you use your own anchors, probably some changes are needed.
3. The inference result is not totally the same as Darknet but the difference is small.
4. The speed is slower than Darknet. Replacing PIL with opencv may help a little.
5. Always load pretrained weights and freeze layers in the first stage of training. Or try Darknet training. It's OK if there is a mismatch warning.
6. The training strategy is for reference only. Adjust it according to your dataset and your goal. And add further strategy if needed.
7. For speeding up the training process with frozen layers train_bottleneck.py can be used. It will compute the bottleneck features of the frozen model first and then only trains the last layers. This makes training on CPU possible in a reasonable time. See [this](https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html) for more information on bottleneck features.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
<项目介绍> 基于YOLOV3的道路负障碍检测python源码+文档说明+数据集 - 不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的毕设,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 --------
资源推荐
资源详情
资源评论
收起资源包目录
基于YOLOV3实现的道路负障碍检测python源码+文档说明+数据集 (576个子文件)
yolov3.cfg 8KB
darknet53.cfg 6KB
yolov3-tiny.cfg 2KB
.gitignore 1KB
.gitignore 176B
.gitignore 176B
keras-yolo3-master.iml 495B
pythonProject7.iml 284B
LICENSE 1KB
README.md 4KB
Readme.md 128B
FiraMono-Medium.otf 124KB
model.py 16KB
train_bottleneck.py 10KB
convert.py 10KB
yolo.py 8KB
train.py 5KB
utils.py 4KB
kmeans.py 3KB
xml_change.py 2KB
yolo_video.py 2KB
voc_annotation.py 1KB
coco_annotation.py 1KB
test.py 914B
__init__.py 0B
train.txt 66KB
test.txt 6KB
SIL Open Font License.txt 4KB
train.txt 2KB
val.txt 993B
trainval.txt 203B
test.txt 180B
yolo_anchors.txt 76B
tiny_yolo_anchors.txt 50B
val.txt 23B
voc_classes.txt 8B
coco_classes.txt 7B
240.xml 5KB
225.xml 4KB
418.xml 4KB
174.xml 3KB
129.xml 3KB
103.xml 3KB
140.xml 3KB
497.xml 3KB
93.xml 3KB
297.xml 3KB
149.xml 3KB
33.xml 3KB
504.xml 3KB
258.xml 3KB
348.xml 2KB
0.xml 2KB
194.xml 2KB
369.xml 2KB
53.xml 2KB
135.xml 2KB
90.xml 2KB
69.xml 2KB
392.xml 2KB
366.xml 2KB
203.xml 2KB
160.xml 2KB
508.xml 2KB
68.xml 2KB
71.xml 2KB
293.xml 2KB
459.xml 1KB
417.xml 1KB
424.xml 1KB
202.xml 1KB
358.xml 1KB
300.xml 1KB
57.xml 1KB
123.xml 1KB
72.xml 1KB
107.xml 1KB
168.xml 1KB
207.xml 1KB
80.xml 1KB
402.xml 1KB
510.xml 1KB
269.xml 1KB
176.xml 1KB
483.xml 1KB
268.xml 1KB
403.xml 1KB
299.xml 1KB
378.xml 1KB
275.xml 1KB
347.xml 1KB
518.xml 1KB
431.xml 1KB
509.xml 1KB
219.xml 1KB
283.xml 1KB
215.xml 1KB
336.xml 1KB
395.xml 1KB
481.xml 1KB
共 576 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
机智的程序员zero
- 粉丝: 2259
- 资源: 4298
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功