Skip to content

Trash Object Detection & classification API based on YOLOv8

Notifications You must be signed in to change notification settings

Antraxmin/Trash-Detection-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trash-Detection-API

Python FastAPI YOLOv8

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.

Demo

스크린샷 2024-06-26 오후 1 15 56

Features

  • 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.

Installation

To get started with Trash Detection, follow these steps:

  1. Clone the Repository

    git clone https://github.com/Antraxmin/Trash-Detection-API.git
    cd trash-detection-api
  2. Create a Virtual Environment and Install Dependencies

    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
  3. Download the YOLO Model

    Place your YOLO model (best.pt) in the models directory.

  4. Run the Server

    uvicorn main:app --reload
  5. Access the Web Interface

    Open your browser and go to http://127.0.0.1:8000.

Example Request

curl -X POST "http://localhost:8000/predict/" -F "file=@image.jpg"

Usage

  • 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.

Contact

For any inquiries or questions, please contact antraxmin@gmail.com.