Project for the AMD AI track at HackCU11
EcoVision is an intelligent recycling assistant that uses computer vision and AI to help users identify recyclable items, learn proper disposal methods, and track their environmental impact.
Much of the code is based on AMD AI Software for NPU utilization.
EcoVision leverages AMD Ryzenβ’ AI PC technology to optimize our object detection pipeline. We've specifically engineered our YOLOv8 model to utilize the Neural Processing Unit (NPU) on AMD hardware, providing significant performance improvements while reducing power consumption.
To enhance real-time object detection efficiency, we retrained a pre-trained AMD/YOLOv8m COCO model from Hugging Face, utilizing cloud resources to fine-tune the model on custom datasets sourced from Roboflow. By leveraging NPU technology, we achieved superior efficiency and performance, enabling real-time recyclable item detection directly on-device with minimal latency. This implementation ensures a more responsive and energy-efficient experience for everyday use.
Improper waste disposal and low recycling rates remain significant environmental challenges:
- Many people are unsure about which items can be recycled
- Recycling rules vary by location and can be confusing
- Lack of immediate feedback makes it difficult to build good recycling habits
- Limited knowledge about the environmental impact of individual actions
EcoVision addresses these challenges by providing real-time identification, personalized guidance, and gamification elements to make recycling more accessible and engaging.
We leveraged Xilinx's MLIR-AIE framework for model optimization and NPU acceleration:
-
MLIR-AIE Compilation Pipeline:
- Used Xilinx MLIR-AIE compiler infrastructure
- Implemented MLIR (Multi-Level Intermediate Representation) to target AMD's AI Engine architecture
- Applied specialized graph optimizations for AMD NPU execution
-
Quantization Process:
- Performed post-training quantization to reduce model precision from FP32 to INT8
- Applied per-channel quantization to minimize accuracy loss
- Calibrated quantization parameters using representative dataset samples
- Generated quantized model variants optimized specifically for AMD NPU execution
- Real-time object detection: Identify recyclable items using your device's camera
- AI-enhanced information: Get detailed, contextual information about each item powered by the ChatGPT API
- Environmental impact tracking: Earn points for proper recycling and see your cumulative positive impact
- User history: Review past scans and track your recycling progress over time
- Leaderboard: Compete with others in your community to promote sustainable behaviors
- Educational content: Learn facts and proper disposal methods for various materials
- Framework: FastAPI (Python)
- Authentication: Firebase Authentication
- Database: Firebase Firestore
- Storage: Firebase Storage
- Object Detection: YOLOv8 model with ChatGPT classification
- AI Text Generation: ChatGPT custom text generation
- Framework: Next.js with TypeScript
- Styling: Tailwind CSS
- State Management: React Hooks
- Authentication: Firebase SDK
By using EcoVision, users can:
- Reduce contamination in recycling streams
- Increase recycling rates
- Learn sustainable practices through engaging feedback
- Track their personal environmental impact over time
The application itself is designed to be environmentally friendly:
- Optimized for low power consumption with edge ML
- Efficient API design to minimize data transfer
Directory structure:
βββ connergroth-ecovision/
βββ README.md
βββ yolov8m.pt
βββ backend/
β βββ Dockerfile
β βββ docker-compose.yml
β βββ requirements.txt
β βββ app/
β βββ requirements.txt
β βββ .gitignore
β βββ endpoints/
β β βββ __init__.py
β β βββ detection.py
β β βββ leaderboard.py
β β βββ scans.py
β β βββ websocket.py
β βββ models/
β β βββ yolov8.ipynb
β βββ services/
β β βββ __init__.py
β β βββ detection_service.py
β β βββ firebase_service.py
β β βββ npu_service.py
β βββ training/
β β βββ annotation_setup.py
β β βββ data_augmentation.py
β β βββ hyperparameter_tuning.py
β β βββ prepare_trashnet.py
β β βββ test_model.py
β β βββ train_yolov8.py
β β βββ training_pipeline.py
β βββ utils/
β βββ __init__.py
β βββ enviroment.py
β βββ firebase_check.py
β βββ logger.py
βββ frontend/
β βββ README.md
β βββ Dockerfile
β βββ eslint.config.mjs
β βββ next.config.ts
β βββ package-lock.json
β βββ package.json
β βββ postcss.config.mjs
β βββ tsconfig.json
β βββ .dockerignore
β βββ .gitignore
β βββ public/
β βββ src/
β βββ app/
β β βββ globals.css
β β βββ layout.tsx
β β βββ (protected)/
β β β βββ layout.tsx
β β β βββ page.tsx
β β β βββ history/
β β β β βββ page.tsx
β β β βββ image/
β β β β βββ page.tsx
β β β βββ leaderboard/
β β β βββ page.tsx
β β βββ api/
β β β βββ apiClient.ts
β β β βββ chat/
β β β β βββ route.ts
β β β βββ classify/
β β β β βββ route.ts
β β β βββ image/
β β β β βββ route.ts
β β β βββ leaderboard/
β β β β βββ route.ts
β β β βββ user-trash/
β β β βββ route.ts
β β βββ auth/
β β β βββ page.tsx
β β βββ components/
β β β βββ LoadingPage.tsx
β β β βββ NavBar.tsx
β β β βββ SignIn.tsx
β β β βββ WebSocketDetector.tsx
β β β βββ WebcamDetection.tsx
β β βββ hooks/
β β βββ AuthHook.jsx
β βββ firebase/
β β βββ firebaseAdminConfig.ts
β β βββ firebaseConfig.ts
β βββ utils/
β βββ gpt-image-analysis.ts
β βββ gpt-image-classifier.ts
The application follows a microservices architecture:
-
Frontend Service: Next.js application serving the UI and handling all routes. Also performs image processing and ML inference directly in the browser.
-
Detection Service: FastAPI backend providing additional ML capabilities for more complex image analysis tasks. Optimized for AMD GPU/NPU acceleration when deployed on compatible hardware.
-
User Service: Manages user data, history, and statistics.
-
OpenAI Integration Service: Communicates with ChatGPT APIs for enhanced content generation and advanced image analysis.




