CoolFace
Apppublic

oladokedamilola/image-processing-api

sourceHugging Facemitupdated 7mo agoView on Hugging Face
0likes
App README

๐ŸŽฏ Image Processing Server

A high-performance computer vision server built with FastAPI and OpenCV, specializing in real-time image and video analysis. This production-ready solution provides advanced image processing capabilities for surveillance, monitoring, and multimedia analysis applications.

![Hugging Face Space](https://huggingface.co/spaces/oladokedamilola/image-processing-api) ![FastAPI](https://fastapi.tiangolo.com) ![OpenCV](https://opencv.org) ![YOLOv8](https://github.com/ultralytics/ultralytics)


๐Ÿš€ Live Demo & API Endpoint

ResourceURL
API Base URLhttps://oladokedamilola-image-processing-api.hf.space
Swagger UI`/docs`
ReDoc`/redoc`
Health Check`/health`

๐ŸŽฏ Core Image Processing Capabilities

Detection & Recognition

  • โ€”Multi-class Object Detection: Identify 80+ object categories using YOLOv8 Nano
  • โ€”Human Detection: Specialized people detection using HOG descriptors and Haar Cascades
  • โ€”Vehicle Recognition: Car, truck, motorcycle, and bus detection
  • โ€”Motion Analysis: Frame differencing for movement detection and activity monitoring
  • โ€”Bounding Box Intelligence: Precise object localization with confidence scoring

Image Analysis Features

  • โ€”Real-time Processing: Sub-3-second response times for image analysis
  • โ€”Confidence Thresholding: Adjustable sensitivity (0.1-0.9) for detection accuracy
  • โ€”Size-based Filtering: Configurable minimum object dimensions for filtering
  • โ€”Multi-model Processing: Ensemble approach combining YOLOv8 with traditional CV algorithms

๐Ÿ”ง Processing Functionality

Image Processing Pipeline

Input โ†’ Validation โ†’ Decoding โ†’ Preprocessing โ†’ Detection โ†’ Analysis โ†’ Response
    โ†“           โ†“           โ†“           โ†“           โ†“           โ†“           โ†“
File Check โ†’ Format Verify โ†’ OpenCV Load โ†’ Optimization โ†’ Model Inference โ†’ JSON Format โ†’ API Return

Supported Operations

  • โ€”Single Image Analysis: Immediate processing with detailed detection results
  • โ€”Batch Image Processing: Multiple image analysis in optimized sequences
  • โ€”Video Frame Extraction: Intelligent frame sampling for video analysis
  • โ€”Format Conversion: Automatic normalization across different image formats
  • โ€”Metadata Extraction: Image dimensions, properties, and quality assessment

๐Ÿ“Š Detection & Output

Detection Results Structure

json
{
  "detections": [
    {
      "label": "person",
      "confidence": 0.92,
      "bbox": [120, 85, 310, 480],
      "dimensions": {"width": 190, "height": 395},
      "position": {"center_x": 215, "center_y": 282.5}
    },
    {
      "label": "car",
      "confidence": 0.87,
      "bbox": [450, 200, 620, 320],
      "dimensions": {"width": 170, "height": 120},
      "position": {"center_x": 535, "center_y": 260}
    }
  ],
  "image_analysis": {
    "resolution": "1920x1080",
    "color_profile": "RGB",
    "detection_summary": {
      "total_objects": 7,
      "people_count": 3,
      "vehicles_count": 2,
      "other_objects": 2
    },
    "processing_metrics": {
      "inference_time": 1.23,
      "total_processing_time": 2.45,
      "frames_per_second": 40.8
    }
  }
}

Advanced Analysis Features

  • โ€”Density Estimation: Object count per region/quadrant
  • โ€”Activity Heatmaps: Movement concentration visualization
  • โ€”Object Tracking: Basic trajectory analysis across video frames
  • โ€”Scene Understanding: Dominant object and activity classification

๐Ÿ–ผ๏ธ Supported Image Formats & Specifications

Input Formats

TypeFormatsMax Size
ImagesJPEG, PNG, BMP, TIFF, WebP10MB
VideosMP4, AVI, MOV, MKV50MB

Processing Specifications

  • โ€”Resolution Handling: Automatic scaling for optimal processing
  • โ€”Aspect Ratio Preservation: Maintains original image proportions
  • โ€”Color Normalization: Standardized color processing pipeline
  • โ€”Noise Reduction: Pre-processing filters for improved detection

โšก Performance & Optimization

Speed & Efficiency

MetricValue
Image Processing< 3 seconds (1080p)
Model Footprint6.2 MB (YOLOv8 Nano)
Memory Usage< 400 MB
Concurrent RequestsUp to 10

Quality & Accuracy

  • โ€”Detection Rate: >85% accuracy for person detection
  • โ€”Precision Control: Adjustable confidence thresholds (0.1-0.9)
  • โ€”False Positive Reduction: Size-based filtering and multi-model validation
  • โ€”Lighting Adaptation: Robust performance across varied lighting conditions

๐Ÿ”Œ API Endpoints

Primary Processing Endpoints

MethodEndpointDescription
POST/api/v1/process/imageSingle image analysis
POST/api/v1/process/videoVideo frame analysis
GET/api/v1/process/modelsList available models

Job Management

MethodEndpointDescription
POST/api/v1/jobs/process/videoSubmit video for background processing
GET/api/v1/jobs/{job_id}/statusCheck job status
GET/api/v1/jobs/statsProcessing statistics

Advanced Features

MethodEndpointDescription
POST/api/v1/advanced/crowd-detectionDetect crowds in images/videos
POST/api/v1/advanced/vehicle-countingCount vehicles in videos
GET/api/v1/advanced/processing-statisticsOverall processing stats

System Endpoints

MethodEndpointDescription
GET/Server information
GET/healthHealth check
GET/docsSwagger UI documentation
GET/redocReDoc documentation

๐Ÿ”‘ Authentication

All processing endpoints require an API key in the header:

bash
curl -X POST "https://oladokedamilola-image-processing-api.hf.space/api/v1/process/image" \
  -H "X-API-Key: your-api-key-here" \
  -F "file=@image.jpg"

๐Ÿ“˜ Quick Start Examples

Python

python
import requests

url = "https://oladokedamilola-image-processing-api.hf.space/api/v1/process/image"
headers = {"X-API-Key": "your-api-key-here"}
files = {"file": open("image.jpg", "rb")}

response = requests.post(url, headers=headers, files=files)
results = response.json()

print(f"Detected {results['detection_count']} objects")
for detection in results['detections']:
    print(f"  {detection['label']}: {detection['confidence']:.2f}")

JavaScript

javascript
const formData = new FormData();
formData.append('file', imageFile);

fetch('https://oladokedamilola-image-processing-api.hf.space/api/v1/process/image', {
  method: 'POST',
  headers: { 'X-API-Key': 'your-api-key-here' },
  body: formData
})
.then(response => response.json())
.then(data => console.log(data));

๐Ÿ› ๏ธ Technical Stack

ComponentTechnologyVersion
Web FrameworkFastAPI0.104.1
ASGI ServerUvicorn0.24.0
Computer VisionOpenCV4.8.1
Deep LearningPyTorch + Ultralytics2.1.0 / 8.0.196
Object DetectionYOLOv8 Nano6.2MB
Traditional CVHOG + Haar Cascade-
ContainerDockerโœ“
DeploymentHugging Face Spacesโœ“

๐Ÿš€ Deployment Status

yaml
status: "Production Ready"
platform: "Hugging Face Spaces"
hardware: "CPU (2 vCPU, 16GB RAM)"
uptime: "24/7 with auto-sleep after 48h idle"
region: "Global CDN"

๐Ÿ“‹ Environment Variables

VariableDescriptionDefault
API_KEYAuthentication keyRequired
ENVIRONMENTproduction or developmentproduction
PORTServer port7860
CONFIDENCE_THRESHOLDDetection sensitivity0.5

๐Ÿ“„ License

MIT License ยฉ 2026 Oladoke Damilola


๐Ÿค Support


Status: Production Ready | Image Processing Focus: Core Functionality Optimized For: Real-time analysis, High-volume processing, Accurate detection Deployed on: Hugging Face Spaces ๐Ÿš€


---