Team Ai
Apppublic

KRISH09bha/object-detection-kodrish

sourceHugging Facemitupdated 1y agoView on Hugging Face
1likes
App README

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

๐ŸŽฏ Object Detection & Counting using YOLOv11 + FastAPI

An object detection and counting system using YOLOv11 (12x.pt) powered by FastAPI, with a clean frontend built using modern web tools.

๐Ÿ–ผ Upload an image โ†’ โšก Get real-time detections โ†’ ๐Ÿ”ข See object count โ†’ ๐Ÿ“ค Download annotated image.


๐ŸŒ Live Links


๐Ÿ“ Project Structure

.
โ”œโ”€โ”€ .gitattributes           # Git LFS support for model
โ”œโ”€โ”€ 12x.pt                   # YOLOv11 model weights (~119MB)
โ”œโ”€โ”€ app.py                   # FastAPI backend logic
โ”œโ”€โ”€ Dockerfile               # For containerization
โ”œโ”€โ”€ requirements.txt         # Python dependencies
โ””โ”€โ”€ README.md                # Project documentation

๐Ÿง  Model Details

  • โ€”Model: YOLOv11
  • โ€”Trained weights: 12x.pt
  • โ€”Purpose: Object detection and counting
  • โ€”Framework: Ultralytics YOLO

โš™๏ธ FastAPI Endpoints

POST /upload-image/

Upload an image to get predictions and object count.

Request (multipart/form-data):

  • โ€”file: JPEG or PNG image file

Response (JSON):

json
{
  "image": "data:image/jpeg;base64,...",
  "object_count": {
    "person": 2,
    "car": 1
  }
}
  • โ€”image: Annotated image (base64-encoded)
  • โ€”object_count: Class-wise count of detected objects

GET /

Basic root endpoint.

json
{
  "message": "๐ŸŽฏ Object Detection API for Images and Videos using 12x.pt"
}

๐Ÿ’ป Local Setup

Step 1: Clone the Repo

sh
git lfs install
git clone https://huggingface.co/spaces/KRISH09bha/object-detection-kodrish
cd object-detection-kodrish

Step 2: Install Dependencies

sh
pip install -r requirements.txt

Step 3: Start FastAPI App

sh
python app.py

API will be available at: http://localhost:8000


๐Ÿณ Run with Docker

sh
docker build -t yolo-fastapi .
docker run -p 7860:7860 yolo-fastapi

๐Ÿงช Technologies Used

  • โ€”Backend: FastAPI
  • โ€”Model: YOLOv11 (Ultralytics)
  • โ€”Frontend: Hosted at https://object-hy5d.vercel.app/
  • โ€”Deployment: Hugging Face Spaces + Vercel + Git LFS

๐Ÿ›ก Error Handling

  • โ€”Warns if 12x.pt is missing
  • โ€”Returns 500 if image processing fails

๐Ÿ‘จโ€๐Ÿ’ป Developer

Made with โค๏ธ by Krish Bhagat ๐Ÿš€ Founder at KodRish Innovation & Solution LLP

๐Ÿ“ง Email: bhagatkrish65@gmail.com ๐Ÿ”— LinkedIn: Krish Bhagat


๐Ÿ“„ License

This project is licensed under the MIT License.