# yolov3.pytorch
This repository is used for object detection. The algorithm is based on [YOLOv3: An Incremental Improvement](https://pjreddie.com/media/files/papers/YOLOv3.pdf), implemented in PyTorch v0.4. **Thanks to [ayooshkathuria/pytorch-yolo-v3](https://github.com/ayooshkathuria/pytorch-yolo-v3) and [ultralytics/yolov3](https://github.com/ultralytics/yolov3)**, based on their work, I re-implemented YOLO v3 in PyTorch for better readability and re-useablity.
## News
Full version of update logs could be seen in issue [#2](https://github.com/ECer23/yolov3.pytorch/issues/2)
* (2018/10/10) Support training on VOC dataset.
## Environments
* Python 3.6
* PyTorch 0.4.1
* CUDA (CPU is not supported)
* pycocoapi
## Train
### How to train on COCO
1. Download [COCO detection](http://cocodataset.org/#download) dataset and annotions and provide full path to your downloaded dataset in `config.py` like below
```python
'coco': {
'train_imgs': '/home/data/coco/2017/train2017',
'train_anno': '/home/data/coco/2017/annotations/instances_train2017.json'
}
````
2. Download official pre-trained Darknet53 weights on ImageNet [here](https://pjreddie.com/media/files/darknet53.conv.74), and move it to `checkpoint/darknet/darknet53.conv.74.weights`
3. Transform the weights to PyTorch readable file `0.ckpt` by running
```bash
$ python transfer.py --dataset=coco --weights=darknet53.conv.74.weights
```
4. Run
```bash
$ python train.py
```
### How to train on custom dataset
1. Implement your own dataset loading function in `dataset.py`. You should keep the interfaces similar to that in `dataset.py`.
2. Add your dataset in `prepare_dataset` function in `dataset.py`
3. Details can be viewed in `dataset.py`. This part requires some coding, and need to be imporved later.
### Training visualization
Logging directory will be displayed when you run training scripts. You can visualize the training process by running
```shell
$ tensorboard --logdir path-to-your-logs
```
![tensorboard](https://camo.githubusercontent.com/f477420c421d99d26812bdedc45a58623e8fc09f/687474703a2f2f7778312e73696e61696d672e636e2f6c617267652f303036306c6d37546c79316677687a7038646b706e6a333168633075306a77792e6a7067)
## Evaluation
### How to evaluate on COCO
1. Download [COCO detection](http://cocodataset.org/#download) dataset and annotions and provide full path to your downloaded dataset in `config.py` like below
```python
'coco': {
'val_imgs': '/home/data/coco/2017/val2017',
'val_anno': '/home/data/coco/2017/annotations/instances_val2017.json',
}
````
2. Download official pretrained YOLO v3 weights [here](https://pjreddie.com/media/files/yolov3.weights) and move it to `checkpoint/darknet/yolov3-coco.weights`
3. Transform the weights to PyTorch readable file `checkpoint/coco/-1.-1.ckpt` by running
```bash
$ python transfer.py --dataset=coco --weights=yolov3-coco.weights
```
4. Evaluate on validation sets you specify in `config.py` and compute the mAP by running. Some validation detection examples will be save to `assets/results`
```bash
$ python evaluate.py
```
### How to detect COCO objects
1. Download official pretrained YOLO v3 weights [here](https://pjreddie.com/media/files/yolov3.weights) and move it to `checkpoint/darknet/yolov3-coco.weights`
2. Transform the weights to PyTorch readable file `checkpoint/coco/-1.-1.ckpt` by running
```bash
$ python transfer.py --dataset=coco --weights=yolov3-coco.weights
```
3. Specify the images folder in `config.py`
```python
demo = {
'images_dir': opj(ROOT, 'assets/imgs'),
'result_dir': opj(ROOT, 'assets/dets')
}
```
4. Detect your own images by running
```bash
$ python demo.py
```
### Evaluation results
mAP computation seems not very accruate
| Test datasets | Training datasets | Resolution | Notes | mAP | FPS |
|---|---|---|---|---|---|
| COCO 2017 | | 416 | official pretrained YOLO v3 weights | 63.4 | |
| COCO 2017 | | 608 | paper results | 57.9 | |
### Evaluation demo
![](https://github.com/ECer23/yolov3.pytorch/raw/master/assets/dets/person.jpg)
## TODO
- [ ] Evaluation
- [x] ~~Draw right bounding box~~
- [ ] mAP re-implementated
- [x] ~~VOC mAP implemented~~
- [ ] COCO mAP implemented
- [ ] Training
- [x] ~~Loss function implementation~~
- [x] ~~Visualize training process~~
- [x] ~~Use pre trained Darknet model to train on custom datasets~~
- [x] ~~Validation~~
- [ ] Train COCO from scratch
- [ ] Train custom datasets from scratch
- [x] ~~Learning rate scheduler~~
- [x] ~~Data augumentation~~
- [ ] General
- [ ] Generalize annotation format to VOC for every dataset
- [x] ~~Multi-GPU support~~
- [x] ~~Memory use imporvements~~
## Reference
* [Series: YOLO object detector in PyTorch](https://blog.paperspace.com/tag/series-yolo/) A very nice tutorial of YOLO v3
* [ayooshkathuria/pytorch-yolo-v3](https://github.com/ayooshkathuria/pytorch-yolo-v3) PyTorch implmentation of YOLO v3, with only evaluation part
* [ultralytics/yolov3](https://github.com/ultralytics/yolov3) PyTorch implmentation of YOLO v3, with both training and evaluation parts
* [utkuozbulak/pytorch-custom-dataset-examples](https://github.com/utkuozbulak/pytorch-custom-dataset-examples) Example of PyTorch custom dataset
没有合适的资源?快使用搜索试试~ 我知道了~
YOLO v3 的 PyTorch 实现,包括训练和测试,并可适用于用户定义的数据集.zip
共42个文件
jpg:22个
py:8个
cfg:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 121 浏览量
2024-11-26
18:57:03
上传
评论
收藏 2.46MB ZIP 举报
温馨提示
yolov3.pytorch此存储库用于对象检测。该算法基于YOLOv3增量改进,在 PyTorch v0.4 中实现。感谢 ayooshkathuria/pytorch-yolo-v3和ultralytics/yolov3,基于他们的工作,我在 PyTorch 中重新实现了 YOLO v3,以提高可读性和可重用性。消息完整版更新日志可见问题#2(2018/10/10) 支持在VOC数据集上进行训练。环境Python 3.6PyTorch 0.4.1CUDA(不支持 CPU)焦枯草火车如何在 COCO 上进行训练下载COCO 检测数据集和注释,并提供下载数据集的完整路径,config.py如下所示'coco': { 'train_imgs': '/home/data/coco/2017/train2017', 'train_anno': '/home/data/coco/2017/annotations/instances_train2017.json'}在此处下载 ImageNet 上官方预训练的 Darknet53 权重,并将其
资源推荐
资源详情
资源评论
收起资源包目录
YOLO v3 的 PyTorch 实现,包括训练和测试,并可适用于用户定义的数据集.zip (42个子文件)
lib
yolov3-linemod.cfg 8KB
yolov3-tejani.cfg 8KB
yolov3-coco.cfg 9KB
yolov3-voc.cfg 8KB
coco-names.json 2KB
标签.txt 29B
assets
tensorboard.png 240KB
Roboto-Bold.ttf 160KB
imgs
herd_of_horses.jpg 130KB
person.jpg 111KB
giraffe.jpg 374KB
dog.jpg 160KB
img2.jpg 64KB
scream.jpg 170KB
eagle.jpg 139KB
img4.jpg 83KB
img1.jpg 77KB
messi.jpg 124KB
img3.jpg 100KB
dets
herd_of_horses.jpg 63KB
person.jpg 51KB
giraffe.jpg 105KB
dog.jpg 74KB
img2.jpg 48KB
scream.jpg 31KB
eagle.jpg 68KB
img4.jpg 36KB
img1.jpg 31KB
messi.jpg 129KB
img3.jpg 44KB
src
utils.py 9KB
evaluate.py 3KB
layers.py 9KB
dataset.py 9KB
model.py 10KB
transfer.py 1KB
train.py 4KB
config.py 3KB
资源内容.txt 823B
checkpoints
README.md 641B
.gitignore 16B
README.md 5KB
共 42 条
- 1
资源评论
赵闪闪168
- 粉丝: 1604
- 资源: 4236
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功