KRISH09bha/object-detection-kodrish
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
- ๐ Frontend Web App: https://object-hy5d.vercel.app/
- ๐ API on Hugging Face: https://krish09bha-object-detection-kodrish.hf.space
๐ 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):
{
"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.
{
"message": "๐ฏ Object Detection API for Images and Videos using 12x.pt"
}๐ป Local Setup
Step 1: Clone the Repo
git lfs install
git clone https://huggingface.co/spaces/KRISH09bha/object-detection-kodrish
cd object-detection-kodrishStep 2: Install Dependencies
pip install -r requirements.txtStep 3: Start FastAPI App
python app.pyAPI will be available at: http://localhost:8000
๐ณ Run with Docker
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.ptis 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.
