yolo_1_pytorch
simplest implementation of yolo v1 via pytorch √
中文
Language:You Only Look Once: Unified, Real-Time Object Detection
paper:博客解析
CSDN blog:This repo is a brief implementation of yolo v1. You can easily train the model and visualize the result.
output tensor: | S×S×(B∗5+C) | S: | num of grids | B: | num of boxes | C: | num of classes | |||
---|---|---|---|---|---|---|---|---|---|---|
7x7x(2*5+20) | 7 | 2 | 20 |
git clone https://github.com/leviome/yolo_1_pytorch.git
cd yolo_1_pytorch
Environment:
- Python3
- Pytorch>=1.3
- cv2
- matplotlib
Dataset preparation
- Download voc2007 dataset:
wget -c http://pjreddie.com/media/files/VOCtrainval_06-Nov-2007.tar
wget -c http://pjreddie.com/media/files/VOCtest_06-Nov-2007.tar
wget -c http://pjreddie.com/media/files/VOCdevkit_08-Jun-2007.tar
- Extract all tars:
tar xvf VOCtrainval_06-Nov-2007.tar
tar xvf VOCtest_06-Nov-2007.tar
tar xvf VOCdevkit_08-Jun-2007.tar
- put the data into dataset/voc2007 and make the folder structure look like:
dataset
├── voc2007
│ ├── Annotations
│ ├── ImageSets
│ ├── JPEGImages
│ ├── Label
│ ├── SegmentationClass
│ └── SegmentationObject
└── voc2012
- fit voc dataset to yolo model as pytorch dataset format:
python fit_voc_to_yolo.py
Train
python train.py
Detect single image
python detect.py