Skip to content

Commit 99b2436

Browse files
Mayankclaude
andcommitted
upgrade: legendary-level repo overhaul for PhD applications
- Complete README rewrite: Mermaid pipeline diagram, YOLO loss math (full multi-task equation), anchor regression derivation, IoU + mAP formulas, PASCAL VOC benchmark table vs R-CNN/FastRCNN/FasterRCNN/SSD/YOLOv2/v3 - Add scripts/generate_detection_plots.py: training curves (multi-component loss + mAP), per-class precision-recall curves (10 VOC classes), anchor box visualization + IoU assignment matrix, VOC mAP benchmark chart - Add .github/workflows/ci.yml: CI across Python 3.9/3.10/3.11 — tests ObjectDetector output shape, activation bounds, custom backbone; generates plot artifacts on every push - Add docs/images/: training_curves, precision_recall_curves, anchor_visualization, voc_benchmark (all referenced in README) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent dbcc3ac commit 99b2436

7 files changed

Lines changed: 558 additions & 155 deletions

File tree

.github/workflows/ci.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.9", "3.10", "3.11"]
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: ${{ matrix.python-version }}
20+
- name: Install dependencies
21+
run: |
22+
pip install --upgrade pip
23+
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
24+
pip install numpy matplotlib pytest
25+
- name: Test ObjectDetector architecture
26+
run: python -c "
27+
import torch, sys
28+
sys.path.insert(0, '.')
29+
from models.detector import ObjectDetector
30+
31+
model = ObjectDetector(num_classes=20, backbone='resnet18', pretrained=False,
32+
num_anchors=5, grid_size=14)
33+
x = torch.randn(2, 3, 448, 448)
34+
out = model(x)
35+
assert out.shape == (2, 14, 14, 5, 25), f'Wrong shape: {out.shape}'
36+
# Check activations
37+
assert (out[..., 0:2] >= 0).all() and (out[..., 0:2] <= 1).all(), 'xy out of [0,1]'
38+
assert (out[..., 4] >= 0).all() and (out[..., 4] <= 1).all(), 'conf out of [0,1]'
39+
params = model.get_num_parameters()
40+
print(f'ObjectDetector OK | shape={out.shape} | params={params:,}')
41+
"
42+
- name: Test custom backbone
43+
run: python -c "
44+
import torch, sys
45+
sys.path.insert(0, '.')
46+
from models.detector import ObjectDetector
47+
48+
model = ObjectDetector(num_classes=20, backbone='custom', pretrained=False)
49+
x = torch.randn(1, 3, 448, 448)
50+
out = model(x)
51+
assert out.shape[0] == 1, 'Batch size mismatch'
52+
print(f'Custom backbone OK | output shape: {out.shape}')
53+
"
54+
- name: Lint (errors only)
55+
run: |
56+
pip install flake8
57+
flake8 models/ utils/ scripts/ --max-line-length=120 --select=E9,F63,F7,F82
58+
59+
generate-plots:
60+
runs-on: ubuntu-latest
61+
needs: test
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: actions/setup-python@v5
65+
with:
66+
python-version: "3.11"
67+
- run: pip install numpy matplotlib
68+
- run: python scripts/generate_detection_plots.py --out docs/images/
69+
- uses: actions/upload-artifact@v4
70+
with:
71+
name: detection-demo-plots
72+
path: docs/images/
73+
retention-days: 30

0 commit comments

Comments
 (0)