# 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 --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.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【资源说明】 人工智能大作业基于python实现五子棋游戏源码(含棋子识别+搜索算法+ANN棋局评估+DQN的棋力提升).zip 1、该资源内项目代码都是经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载使用,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能。
资源推荐
资源详情
资源评论
收起资源包目录
人工智能大作业基于python实现五子棋游戏源码(含棋子识别+搜索算法+ANN棋局评估+DQN的棋力提升).zip (236个子文件)
yolov3.cfg 8KB
darknet53.cfg 6KB
yolov3-tiny.cfg 2KB
.gitignore 1KB
model_200_10.h5 406KB
2021.1.10_200_10.h5 406KB
model_200_12.h5 406KB
model_200_3.h5 406KB
model_500_2_new.h5 406KB
high.jpg 65KB
mid.jpg 56KB
low.jpg 50KB
LICENSE 1KB
项目详细说明.md 5KB
README.md 4KB
README.md 178B
README.md 94B
FiraMono-Medium.otf 124KB
3_net.png 128KB
question.png 108KB
2_result.png 86KB
3_reslut1.png 79KB
4_result1.png 63KB
4_result2.png 61KB
loss_200_12.png 36KB
loss_200_10.png 35KB
3_result2.png 31KB
3_result3.png 30KB
3_net2.png 30KB
rule.png 26KB
dataset.png 15KB
4_reslut3.png 15KB
2_result2.png 14KB
tinymodel.py 18KB
model.py 16KB
AI_alpha_beta.py 15KB
AI_alpha_beta.py 15KB
AI_eval.py 13KB
game_thread.py 12KB
train_bottleneck.py 11KB
convert.py 10KB
yolo.py 8KB
AI.py 7KB
tiny_yolo.py 7KB
AI_alpha_beta.py 6KB
tiny-train.py 5KB
mygame.py 5KB
two_AI_chess.py 5KB
DrawUI.py 5KB
DrawUI.py 5KB
DrawUI.py 5KB
train.py 5KB
mygame.py 4KB
mygame.py 4KB
ANN_GoBang.py 4KB
utils.py 4KB
kmeans.py 3KB
yolo_video.py 2KB
Checkboard.py 2KB
Checkboard.py 2KB
Checkboard.py 2KB
net.py 2KB
coco_annotation.py 1KB
voc_annotation.py 1KB
ANN_Eval.py 973B
make_main_txt.py 964B
reinforce_learning.py 814B
read_dataset.py 813B
MyModel.py 722B
VOCpro.py 648B
test.py 353B
test.py 109B
main.py 106B
__init__.py 0B
__init__.py 0B
AI_alpha_beta.cpython-35.pyc 11KB
AI_alpha_beta.cpython-36.pyc 10KB
game_thread.cpython-36.pyc 9KB
AI_alpha_beta.cpython-36.pyc 6KB
DrawUI.cpython-36.pyc 3KB
DrawUI.cpython-36.pyc 3KB
Checkboard.cpython-36.pyc 2KB
Checkboard.cpython-36.pyc 2KB
net.cpython-36.pyc 2KB
reinforce_learning.cpython-36.pyc 1KB
MyModel.cpython-36.pyc 962B
x_train.txt 5.76MB
x_train.txt 5.2MB
x_train.txt 1.51MB
y_train.txt 49KB
y_train.txt 44KB
train.txt 33KB
y_train.txt 13KB
test.txt 5KB
SIL Open Font License.txt 4KB
train.txt 2KB
val.txt 909B
coco_classes.txt 625B
trainval.txt 375B
test.txt 300B
共 236 条
- 1
- 2
- 3
资源评论
- 2201_760976242023-12-16资源很实用,对我启发很大,有很好的参考价值,内容详细。
Make程序设计
- 粉丝: 5722
- 资源: 3570
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功