Spaces:
Running

get / README.md
Sean Hayes
Deploy Dogg Index app
a8dfb66
|
Raw History Blame Contribute Delete
2.7 kB
---
title: Dogg Index
emoji: 🐶
colorFrom: indigo
colorTo: pink
sdk: docker
pinned: false
short_description: Do you have that dogg in you?
---
# Do you have that dogg in you?
A small webapp for uploading a photo and returning a 1-100 dogg score.
The app starts with a demo scorer. Once you train `models/dogg_scorer.joblib`,
the backend switches to a MobileCLIP-style frozen image encoder plus a small
regression model trained on your own scored photos.
## Run
```bash
python3 server.py
```
Then open `http://localhost:7860`.
## Multi-person photos
After an upload, the app calls `POST /api/detect-people`.
If more than one person is detected, the uploaded photo stays visible and the UI
asks the user to pick which person they are before scoring. When the detector
returns bounding boxes, the backend crops to the selected person before running
the trained dogg scorer.
The person detector is optional during development. Without `ultralytics`
installed, it falls back to demo behavior: filenames containing words like
`group`, `team`, `party`, `friends`, or `multi` return three fake people so you
can test the UI.
For real detection, install requirements and allow the YOLO model weights to
download on first use:
```bash
pip install -r requirements.txt
```
The default person detector is:
```bash
export DOGG_PERSON_DETECTOR_MODEL="yolo11n.pt"
```
The app filters detections to avoid low-confidence false people. You can tune
those filters:
```bash
export DOGG_PERSON_CONF="0.55"
export DOGG_PERSON_MIN_AREA="0.025"
export DOGG_PERSON_MIN_HEIGHT="0.16"
```
Raise `DOGG_PERSON_CONF` if random background regions are detected. Lower
`DOGG_PERSON_MIN_AREA` or `DOGG_PERSON_MIN_HEIGHT` if real people in group
photos are being missed.
You can swap that to a different Ultralytics-compatible detector later.
## Train your dogg scorer
Install dependencies:
```bash
pip install -r requirements.txt
```
Add photos here:
```text
data/dogg/photos/
```
Score them in `data/dogg/labels.csv`:
```csv
file,score
friend_01.jpg,83
celebrity_01.jpg,96
low_dogg_example.jpg,22
```
Train:
```bash
python3 train_scorer.py
```
This writes:
```text
models/dogg_scorer.joblib
```
Restart the server after training:
```bash
python3 server.py
```
By default the training script asks `open_clip_torch` for `MobileCLIP2-S0` with
`dfndr2b` weights. If your installed MobileCLIP/OpenCLIP package exposes a
different checkpoint name, set:
```bash
export DOGG_CLIP_MODEL="MobileCLIP2-S0"
export DOGG_CLIP_PRETRAINED="dfndr2b"
```
For a first pass, use at least 30-50 labeled photos with a real spread from
low to high scores. With 100-300 photos, the score will be noticeably less
fragile.