What it does

GreenRanger is a map of 34 recycling points in Astana, Kazakhstan. Each point has its address, hours, phone and the materials it takes.

For Arbiter Hacks I added "What is this?". You take or choose a photo of one item. A model running in the browser names the material: cardboard, paper, plastic, glass, metal, textile, food, plants or mixed trash. Then the map filters to the points that take it. If you set your location, the list puts open points first and sorts by distance within each group.

The photo stays on the phone. The model runs in the browser, so nothing is uploaded and there is no server cost.

The model does not always decide for you:

  • If the top answer is under 71% confidence, the app shows the top 3 with their percentages and you pick one. It never filters the map on a guess below that line.
  • If none of the 3 fits, you can pick any of the 10 materials by hand. This is how you find points for batteries and electronics, which the model can't recognise.
  • For plastic and metal, it asks "Is it a drink bottle or can?". If yes, it adds the bottle machines (fandomats). A fandomat takes PET bottles and cans, not plastic bags or pans.
  • For food, plants and mixed trash, it says that no point on the map takes them.

It works in English, Russian and Kazakh.

How I built it

Data. I combined two public datasets: RealWaste (4,752 photos, CC BY 4.0) and TrashNet (2,527 photos, MIT). I mapped their classes onto 9 shared classes. I split the 7,279 photos 70/15/15 by class and source with a fixed seed, so the test set is the same every run.

Model. MobileNetV3-Large with ImageNet weights, fine-tuned in PyTorch on my laptop's GPU (Apple M3). The first 3 epochs train only the classifier head, then 15 epochs train the whole network. I kept the checkpoint with the best validation accuracy: 93.6%.

Export. I exported to ONNX with the normalisation and softmax inside the graph, and checked the ONNX output against PyTorch. I tried 3 versions on the validation set:

  • fp32: 16.9 MB, 93.6% validation accuracy
  • fp16 weights: 8.5 MB, 93.5%
  • int8: 4.7 MB, 67.0%

The app ships the fp16-weights version.

Test. I scored the shipped file once on the 1,091 held-out test photos:

  • Accuracy: 94.6% (RealWaste 94.9%, TrashNet 93.9%)
  • Right answer in the top 3: 99.3%
  • The 0.71 threshold was picked on the validation set, as the lowest value where at least 98% of answers were right. On the test set, 85.1% of photos clear it, and 98.3% of those are right.

Confusion matrix on the 1,091 test photos

Browser. onnxruntime-web runs the model with WebAssembly. I resize and crop the photo on a canvas the same way as the Python evaluation. On 54 test photos, the browser and Python gave the same top class for all 54. One photo takes about 20 ms in Chromium on my M3 laptop.

Tests. Vitest checks that:

  • every model class maps to real map materials
  • the class order matches the exported labels file
  • food, plants and trash never filter the map
  • a low-confidence result never picks a single answer
  • open points rank before closed ones
  • all 3 languages have the same keys

pytest checks the dataset class mapping.

Rest of the stack. The site is Next.js and TypeScript, with Google Maps. The API is NestJS and Prisma on Render, the database is Postgres on Neon, and the frontend is on Vercel.

New for Arbiter Hacks

All on 2026-11-19 (KST), from the git log:

  • 11:48 add ml folder: classes, data split, requirements
  • 11:48 add training script for waste classifier
  • 11:51 add vitest
  • 11:51 map classifier classes to map materials
  • 11:51 rank open points before closed ones
  • 11:54 add what-is-this strings in en, ru, kk
  • 11:54 run the waste model in the browser with onnxruntime-web
  • 11:54 add what-is-this photo panel to the map
  • 12:19 export model to onnx, compare int8 and fp16 weights
  • 12:19 evaluate on held-out test set: 94.6% accuracy
  • 12:19 ship waste model (8.5 MB, fp16 weights) and check label order
  • 12:23 say right away when no point takes the item
  • 12:23 add what-is-this button on mobile
  • 12:23 readme: photo classifier, results and dataset credits
  • 16:26 load onnxruntime from cdn and retry failed downloads
  • 16:26 paint a white background so transparent images classify correctly
  • 16:32 show model size while it loads

Built before

GreenRanger took 1st place out of 475 at Hack 4 Humanity 2025. These parts existed before Arbiter Hacks:

  • Map and list of 34 recycling points in Astana, checked by hand against 2GIS and company websites
  • Filters by material and by type of point
  • Nearest points from an address, my location or a tap on the map, with directions
  • Open or closed now, using Astana time
  • Reviews, ratings and accounts
  • A form to suggest a missing point, with admin review
  • English, Russian and Kazakh; light and dark themes
  • A small Streamlit app with the nearest-point search, for my Programming 1 course

The waste problem

Kazakhstan produces 4.2 to 4.8 million tonnes of municipal solid waste a year. About 25.9% was sorted and counted as recycled at the end of 2024, but only 49,200 tonnes were processed into secondary raw materials. That is 1.1% of all municipal waste. In Astana, landfills are 98% full (The Times of Central Asia, 31 Dec 2025).

GreenRanger can't fix processing. It works on one step before that: a person holding an item who doesn't know if anyone takes it, or where.

How I would measure success: the site has no analytics yet. I would count, without storing photos:

  • photos classified
  • the share that end in "Show points"
  • the share where users fix the model's answer from the top 3
  • direction taps after a photo

A fixed answer from the top 3 is a labelled mistake, so it also tells me where the model is weak on real phone photos.

Challenges

  • int8 quantization failed. It cut the file from 16.9 MB to 4.7 MB but dropped validation accuracy from 93.6% to 67.0%. MobileNetV3's activation and squeeze-and-excite layers lose too much in 8 bits. Storing weights as fp16 halved the size and lost 0.1 points.
  • My first threshold rule did nothing. I asked for 90% precision on validation, but the model is already 93.6% accurate, so the rule picked the lowest value I allowed (0.30) and the app would almost never ask. I raised the target to 98% on the validation set, which gave 0.71.
  • One failed download broke the feature. On a slow connection the runtime chunk failed once, and the bundler cached the failure until a page reload. I now load onnxruntime from jsDelivr and retry with a new URL.
  • Transparent images read as black. A PNG with no background turned black on the canvas. I paint the canvas white first.
  • The datasets don't match the map. Neither has batteries or electronics, so those are picked by hand. The model can't tell a PET bottle from a plastic bag, so it asks.
  • Dataset photos are not phone photos. RealWaste was shot at a landfill and TrashNet on white poster board. A clear empty jar from Wikimedia Commons came back "not sure" (metal 38%, glass 22%, plastic 13%). The top-3 step is there for cases like this.

What's next

  • Test on real phone photos from Astana kitchens, labelled by hand, and report that number next to the dataset number
  • Add batteries and electronics, if I find data with a clear license
  • Show download progress for the 8.5 MB model

Built With

Share this project:

Updates

Submission history