Skip to content

Commit c7f7afa

Browse files
author
Peter Featherstone
committed
init
0 parents  commit c7f7afa

File tree

13 files changed

+1145
-0
lines changed

13 files changed

+1145
-0
lines changed

.vscode/settings.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"launch": {
3+
"version": "0.2.0",
4+
"compounds": [],
5+
"configurations": [
6+
{
7+
"name": "TRAIN",
8+
"type": "python",
9+
"request": "launch",
10+
"cwd": "${workspaceFolder}/src",
11+
"program": "train_coco.py",
12+
"args": ["--batchsize", "16",
13+
"--trainRoot", "/data/coco/images/train2017/",
14+
"--trainAnn", "/data/coco/annotations/instances_train2017.json",
15+
"--valRoot", "/data/coco/images/val2017/",
16+
"--valAnn", "/data/coco/annotations/instances_val2017.json"]
17+
},
18+
{
19+
"name": "THIS",
20+
"type": "python",
21+
"request": "launch",
22+
"cwd": "${workspaceFolder}/src",
23+
"program": "${file}"
24+
}
25+
]
26+
}
27+
}

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# TinyYolo #
2+
3+
If you like tinygrad, Pytorch and Yolo, then you'll like TinyYolo.
4+
5+
## What this is ##
6+
7+
* This repo uses the new "Tiny-Oriented-Programming" paradigm invented by [TinyGrad](https://github.com/tinygrad/tinygrad) to implement a set of popular Yolo models in (almost) pure Pytorch in under 1000 lines of code.
8+
9+
* The goals are:
10+
* Repo must be under 1000 lines of code
11+
* Use pure Torch (with a sprinkle of Torchvision and [Einops](https://github.com/arogozhnikov/einops)) to implement models and loss functions
12+
* Cannot sacrifice readability in favour of lines of code.
13+
* However, reduce lines of code where possible
14+
* Be as concise as possible
15+
* Code must strive to be self-documenting
16+
* No config files like Darknet .cfg or YAML for model configuration. This usually makes code less readable and less hackage.
17+
18+
## What this isn't ##
19+
20+
* This isn't a framework. If you want a fine-tuned framework then use darknet or ultralytics
21+
22+
* A highly optimized library (I haven't implement conv+bn fusion, or anything like that yet)
23+
24+
## What's provided ##
25+
26+
* `models.py`: contains all the Yolo models, which automatically calculate loss when targets are provided in forward function.
27+
* `test.py`: tests the models with pretrained weights from darknet, ultralytics and Yolov7.
28+
* `train_coco.py`: trains on COCO using [lightning](https://lightning.ai/)
29+
30+
## Observations ##
31+
32+
* Yolov7 uses `eps=0.001` and `momentum=0.03` in `nn.Batchnorm2d`. That's unusual. I wonder what effects that has on training.

download_weights.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
wget https://pjreddie.com/media/files/yolov3-tiny.weights
2+
wget https://pjreddie.com/media/files/yolov3.weights
3+
wget https://github.com/ultralytics/yolov3/releases/download/v8/yolov3-spp.weights
4+
wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4.weights
5+
wget https://github.com/AlexeyAB/darknet/releases/download/yolov4/yolov4-tiny.weights

images/dog.jpg

160 KB
Loading

images/eagle.jpg

139 KB
Loading

images/giraffe.jpg

374 KB
Loading

images/horses.jpg

130 KB
Loading

images/person.jpg

111 KB
Loading

images/scream.jpg

170 KB
Loading

requirements.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
numpy
2+
torch
3+
torchvision
4+
einops
5+
onnx
6+
lightning
7+
tensorboard
8+
matplotlib
9+
pycocotools
10+
pyqt5

0 commit comments

Comments
 (0)