Skip to content

Repository files navigation

Waste Classification

Scan one item. Get the waste class, confidence, and a practical way to dispose of it.

Latest release Flutter Classes License: GPL v3

English · Tiếng Việt

Download the latest APK

Waste Classification is a Flutter Android app built for IT-Challenge II 2026. The important part is not just taking a photo: the image sent to the model must match the frame shown on screen. The app captures that exact region, classifies it through the API, then keeps the result locally for history and statistics.

Demo

waste-classification-demo.mp4

Open the full-resolution demo

Home screen
Start a scan
Camera frame
Keep one item in frame
Classification result
Result and disposal advice
Scan statistics
Daily, weekly and monthly statistics
Saved scan details
Saved scan details
Language settings
Vietnamese and English

What is included

  • Camera capture with an on-screen guide; only the visible scan frame is uploaded.
  • Nine model labels: Cardboard, Food Organics, Glass, Metal, Miscellaneous Trash, Paper, Plastic, Textile Trash, and Vegetation.
  • Confidence score, waste-group explanation, and disposal guidance.
  • Local scan history with image, timestamp, label, and confidence.
  • Waste distribution by day, week, or month.
  • Vietnamese and English interface.

How classification works

Camera preview → exact frame crop → POST /predict → result → local SQLite history

The model is served separately from the APK. The current contract follows the project notebooks:

Item Value
Model EfficientNet-B0, exported to ONNX
Input RGB 224 × 224, ImageNet normalization
Request multipart/form-data, field name file
Response predicted_class, confidence, all_probabilities
Deployment Public Docker Space

The app maps the nine model labels into three practical groups: organic, recyclable, and other waste.

Run locally

Requirements: Flutter SDK, Android SDK, and an Android 7.0+ device or emulator.

flutter pub get
flutter run

Use your own API endpoint when developing:

flutter run \
  --dart-define=WASTE_API_BASE_URL=https://your-api.example.com

For an offline UI demo without inference:

flutter run --dart-define=CLASSIFIER_MODE=mock

Release builds use the project's public Hugging Face Docker Space by default. The API source, Dockerfile, tests, and exact ONNX model are kept in huggingface-space/. Free Spaces can take a short time to wake up after being idle, so the app allows for a cold start before retrying.

Project map

lib/
├── core/       theme, configuration, shared widgets
├── data/       models, SQLite repository, local image storage
├── features/   home, camera scan, result, history, settings
└── services/   API/mock classifiers and camera permission

huggingface-space/  FastAPI, Dockerfile, ONNX model, and backend tests

Flutter Riverpod selects the classifier implementation. SQLite stores scan metadata, while captured images remain in the app's private directory. easy_localization handles the two interface languages, and Be Vietnam Pro is bundled with the app.

Checks

dart format --output=none --set-exit-if-changed lib test
flutter analyze
flutter test
flutter build apk --release

On Windows, use the verified release script to clean stale outputs, run all checks, build the APK, and confirm that translations and bundled fonts are present:

.\tool\build_release.ps1

Data and privacy

Scan history is local to the device. In API mode, one cropped image is sent to the configured /predict endpoint for inference; the app does not use that endpoint as cloud storage. Clearing app data or uninstalling the app may remove local history.

Project references

License

Released under the GNU General Public License v3.0.

Releases

Packages

Contributors

Languages