Trash Detection API is an open-source project leveraging YOLO (You Only Look Once) for detecting trash in images. This project uses FastAPI for the backend server and serves a simple web interface for uploading images and viewing detection results.
This API uses a model that has been directly trained for multi-object waste classification. If you need the original model, please contact us here with the purpose of use.
- Real-time Object Detection: Detects trash in images using a custom-trained YOLO model optimized for trash detection.
- Fast and Efficient: Uses FastAPI for handling requests at lightning speed.
- User-Friendly Interface: Simple web interface for uploading images and viewing detection results.
- Base64 Image Encoding: Returns images with detected trash in Base64 format for easy integration.
To get started with Trash Detection, follow these steps:
-
Clone the Repository
git clone https://github.com/Antraxmin/Trash-Detection-API.git cd trash-detection-api
-
Create a Virtual Environment and Install Dependencies
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
-
Download the YOLO Model
Place your YOLO model (
best.pt
) in themodels
directory. -
Run the Server
uvicorn main:app --reload
-
Access the Web Interface
Open your browser and go to
http://127.0.0.1:8000
.
curl -X POST "http://localhost:8000/predict/" -F "file=@image.jpg"
- Upload Image: Use the web interface to upload an image.
- View Results: The server will return the image with detected trash highlighted in bounding boxes, along with the count of detected objects.
For any inquiries or questions, please contact antraxmin@gmail.com.