A zero-shot vision pipeline and Windows desktop app that finds waste in video and sorts each item into one of the four bins required by the Philippine Ecological Solid Waste Management Act (RA 9003, Sec. 22(b)):
| Bin | What goes in it |
|---|---|
compostable |
Food, kitchen and garden waste |
recyclable |
Clean paper, rigid plastic, glass and metal |
non_recyclable |
Residual waste such as sachets, wrappers and foam |
special |
Batteries, electronics, bulbs, diapers, masks, syringes and other hazardous waste |
Classification runs on TypeSafe's Jev, with
vLLM Semantic Router's d3 (27B) as a benchmarked alternative. No training
data is needed to run it: the bins and materials are defined as questions in
src/questions.js. Items are identified by what they
are, never by bin color, because Philippine bin colors vary by LGU.
The desktop app draws boxes over the video from a batch run or live on the frame on screen, collects hand labels for the eval set, and shows the score.
flowchart LR
V[Video] -->|ffmpeg| F[Frames]
F --> P[Propose boxes with OWLv2 or Jev search]
P --> M[Merge duplicates]
M --> C[Jev or d3 verifies and classifies each crop]
F -->|trained mode| Y[YOLO11s finds boxes and materials]
C --> T[Track items across frames]
Y --> T
There are four ways to run it:
| Mode | Boxes | Classifier | Needs |
|---|---|---|---|
owlv2 (default) |
Local OWLv2 detector | Jev | TYPESAFE_API_KEY |
jev |
Jev region search (fallback) | Jev | TYPESAFE_API_KEY |
d3 |
Local OWLv2 detector | d3 | VLLM_SR_API_KEY |
trained |
YOLO11s distilled from Jev | The same model | No key, but see Not in this repo |
OWLv2 runs on the GPU through DirectML on Windows, and on the CPU elsewhere. Each result is one JSON line per frame.
Jev, d3 and the trained model on the same video. The previews show the first 5 seconds. Click one to download the full video, which ends with its benchmark table. Gray dashed boxes are under 50% sure.
Street garbage pile (the trained model never saw this video):
Bottles floating in a harbour:
Footage belongs to its original owners and appears here only to show the model's output.
These scores measure agreement with Jev, not accuracy. Jev is the teacher here, so a score says how closely a model copies the teacher, not whether the teacher is right. Jev's own row is a second Jev run scored against the first, which shows it is stable, not that it is correct.
- [email protected]: how well a model's boxes and materials line up with Jev's. 1.0 is a perfect copy.
- Recyclable and residual F1: how often a model and Jev agree that the bin appears in a frame. 100% is a perfect copy.
Street garbage pile, 70 frames at 5 fps:
| Model | Time per frame | Cost per minute | Items per frame | [email protected] vs Jev | Recyclable F1 | Residual F1 |
|---|---|---|---|---|---|---|
| Jev 1.14.0 by TypeSafe, OWLv2 boxes | 2,130 ms | $0.71 | 29.0 | 0.95 | 92% | 100% |
| d3 by vLLM-SR, OWLv2 boxes | 4,492 ms | Free | 28.9 | 0.69 | 91% | 100% |
Trained basura-yolo11s-1 |
40 ms | Free | 1.7 | 0.02 | 54% | 81% |
Bottles in a harbour, 75 frames at 5 fps:
| Model | Time per frame | Cost per minute | Items per frame | [email protected] vs Jev | Recyclable F1 | Residual F1 |
|---|---|---|---|---|---|---|
| Jev 1.14.0 by TypeSafe, OWLv2 boxes | 2,160 ms | $0.40 | 13.7 | 0.97 | 100% | – |
| d3 by vLLM-SR, OWLv2 boxes | 2,917 ms | Free | 14.0 | 0.53 | 100% | – |
Trained basura-yolo11s-1 |
33 ms | Free | 5.4 | 0.10 | 100% | – |
- Time is the median per frame on a GTX 1660 Ti in the installed app. Cost is per minute of video at 5 fps. d3's hosted API is free but rate-limited.
–means Jev's labels have that bin in fewer than 10 frames.- mAP weighs each material equally. In the harbour video glass has 1 label and soft plastic 3, against 434 hard plastic, so d3's 0.53 hides 0.95 on hard plastic and 0.94 on metal.
- The trained model never trained on either video, but its best epoch was picked on the harbour video.
- The trained model is fast but weak: it finds items lying apart and almost nothing inside dense piles.
True accuracy is not measured yet, because that needs hand labels on video no
model has trained on. docs/training.md has the full
results and what hand labels would add.
Needs Node 22.15 or newer. ffmpeg comes with the ffmpeg-static package.
npm install
npm test # geometry and scoring self-checks
export TYPESAFE_API_KEY=... # or save it in the app with the API key button
npm run app -- path/to/video.mp4 # replay, run Jev or go Live, label frames, scoreFrom the command line:
npm start -- video.mp4 5 # 5 fps, writes results/<video>.jsonl
npm start -- video.mp4 5 trained # the trained model, writes results/trained/<video>.jsonl
VLLM_SR_API_KEY=... npm start -- video.mp4 5 d3 # writes results/d3/<video>.jsonl
npm run score # score results/ against eval/labels.jsonl
npm run demo -- video.mp4 # render a demo video of the results
npm run compare -- video.mp4 out.mp4 a.jsonl b.jsonl c.jsonl # side-by-side of up to three runsnpm run dist:win builds the Windows installer from WSL and installs it on
that machine. It needs Node on Windows; see
scripts/dist-win.sh.
- Videos, results and training data are out of version control.
- The trained model (
models/basura-yolo11s-1.onnx) is not included, sotrainedmode needs it built first.scripts/train.pyneeds your own videos and Jev result files as well as the public datasets. Seedocs/training.md. - The OWLv2 model (about 300 MB) downloads on first use.
- Camera position is undecided. The pipeline was designed for trash-can close-ups, but it has only been tried on landfill, beach, harbour and street footage.
- d3 privacy. d3's hosted API may log requests to train its models. Never send it frames with people, faces or private places.
- OWLv2 cannot run inside Electron on Linux (electron#46323). The Linux dev app offers Jev search and the trained model; use the CLI for OWLv2.
- The Windows installer is unsigned, so SmartScreen warns on first run.
- The trained model is fine-tuned from Ultralytics YOLO11s (AGPL-3.0).
- It also learned from TACO (Proença & Simões, 2020, CC BY 4.0) and ZeroWaste-f (Bashkirova et al., CVPR 2022, CC BY 4.0).
| Doc | Covers |
|---|---|
docs/architecture.md |
Pipeline, live mode, formats, scoring, the app, packaging, cost |
docs/taxonomy.md |
The four bins, eight materials and edge cases |
docs/jev.md |
The Jev API facts this project relies on |
docs/training.md |
The trained model: data, licences, settings, results |
docs/research.md |
Philippine waste data and law, with sources |
docs/sources/ra9003.txt |
Full text of RA 9003 |
AGENTS.md |
Code map and hard rules for working in this repo |

