Guns object detection API
Detects guns in images with a fine-tuned Faster R-CNN served through a FastAPI endpoint.
What it does
A Kaggle guns object-detection dataset is downloaded with kagglehub and organised into images and labels. A torchvision Faster R-CNN ResNet-50 FPN model is fine-tuned with Adam, losses are logged to TensorBoard, and a two-stage DVC pipeline reproduces ingestion and training. A FastAPI /predict endpoint returns the uploaded image with boxes drawn for detections scoring above 0.7, tested through Swagger UI and Postman.
What was built
- 01
Ingestion pulls issaisasank/guns-object-detection via kagglehub and copies images and labels into artifacts/raw.
- 02
Pre-trained fasterrcnn_resnet50_fpn gets a new box predictor head and trains with Adam at a 1e-4 learning rate.
- 03
Training losses are written to timestamped TensorBoard log directories.
- 04
dvc.yaml defines data_ingestion and model_training stages with tracked outputs, including fasterrcnn.pth.
- 05
FastAPI /predict draws red boxes for scores above 0.7 and streams the annotated image back.
The pipeline, layer by layer
Four layers, one pipeline.
L1Data
- Kaggle dataset
- kagglehub ingestion
L2Training
- Faster R-CNN fine-tuning
- TensorBoard logs
L3Pipeline
- DVC stages
L4Serving
- FastAPI /predict
- Swagger UI and Postman