World-Class Multi-Modal AI Agent Framework with Revolutionary Performance Features
Project description
VisionAgent - Professional Multi-Modal AI Agent Framework
A cutting-edge, production-ready AI agent platform for image, video, and face analytics built with modern Python and state-of-the-art AI models.
๐ Features
Core Capabilities
- Face Detection & Recognition - Advanced face detection, encoding, and recognition with facial landmarks
- Object Detection - YOLOv8-powered object detection with real-time inference
- Video Analysis - Frame-by-frame video processing with object/face tracking
- Image Classification - HuggingFace Transformers integration for image classification
- Real-time Processing - WebSocket streaming for live video analytics
Technical Excellence
- Modular Architecture - Easily extendable agent framework
- GPU Acceleration - Automatic CUDA detection with CPU fallback
- Async Processing - FastAPI with async endpoints for high performance
- Production Ready - Docker support, logging, metrics, and error handling
- Type Safety - Full type hints and Pydantic models
- Scalable - Batch processing and concurrent request handling
๐๏ธ Architecture
vision-sphere/
โโโ agents/ # AI Agent implementations
โ โโโ base_agent.py # Abstract base class
โ โโโ face_agent.py # Face detection & recognition
โ โโโ object_agent.py # Object detection (YOLOv8)
โ โโโ video_agent.py # Video analysis & tracking
โ โโโ classification_agent.py # Image classification
โโโ models/ # Downloaded/trained models
โโโ utils/ # Common utilities
โ โโโ helpers.py # Helper functions
โโโ server.py # FastAPI application
โโโ config.py # Configuration management
โโโ cli.py # Command-line interface
โโโ requirements.txt # Python dependencies
โโโ Dockerfile # Container deployment
๐ ๏ธ Installation
Prerequisites
- Python 3.11+
- CUDA 11.8+ (optional, for GPU acceleration)
- 8GB+ RAM (16GB+ recommended for video processing)
Quick Start
-
Clone and Setup
git clone <repository-url> cd vision-sphere python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt
-
Run API Server
python server.py -
Access API Documentation
- Open http://localhost:8000/docs for interactive API docs
- Or http://localhost:8000/redoc for alternative documentation
Docker Deployment
# Build image
docker build -t visionagent .
# Run with GPU support
docker run --gpus all -p 8000:8000 visionagent
# Run CPU-only
docker run -p 8000:8000 visionagent
๐ Usage
Command Line Interface
# Face detection
python cli.py face image.jpg --output results.json
# Object detection
python cli.py object image.jpg --confidence 0.7 --verbose
# Video analysis
python cli.py video video.mp4 --max-frames 500 --format detailed
# Image classification
python cli.py classify image.jpg --top-k 10 --confidence 0.1
# System information
python cli.py info
# Start server
python cli.py server --host 0.0.0.0 --port 8000
API Endpoints
Face Detection
# Upload file
curl -X POST "http://localhost:8000/face" \
-F "file=@image.jpg"
# Or use image URL
curl -X POST "http://localhost:8000/face" \
-H "Content-Type: application/json" \
-d '{"image_url": "https://example.com/image.jpg"}'
Object Detection
curl -X POST "http://localhost:8000/object" \
-F "file=@image.jpg"
Video Analysis
curl -X POST "http://localhost:8000/video" \
-F "file=@video.mp4"
Image Classification
curl -X POST "http://localhost:8000/classify" \
-F "file=@image.jpg"
Batch Processing
curl -X POST "http://localhost:8000/batch/classify" \
-F "files=@image1.jpg" \
-F "files=@image2.jpg" \
-F "files=@image3.jpg"
WebSocket Streaming
// Real-time video processing
const ws = new WebSocket('ws://localhost:8000/ws/video');
ws.onopen = function() {
// Send video frames as binary data
ws.send(frameData);
};
ws.onmessage = function(event) {
const result = JSON.parse(event.data);
console.log('Analysis result:', result);
};
โ๏ธ Configuration
Create a config.yaml file to customize the framework:
# Global settings
default_device: "auto" # auto, cpu, cuda
model_cache_dir: "./models"
temp_dir: "./temp"
# Face Agent
face_agent:
enabled: true
model:
name: "face_recognition"
confidence_threshold: 0.6
custom_params:
face_detection_model: "hog" # hog, cnn
num_jitters: 1
tolerance: 0.6
# Object Agent
object_agent:
enabled: true
model:
name: "yolov8s.pt"
confidence_threshold: 0.5
custom_params:
iou_threshold: 0.45
max_detections: 100
# Video Agent
video_agent:
enabled: true
processing_params:
frame_skip: 1
max_frames: 1000
track_objects: true
track_faces: true
# Classification Agent
classification_agent:
enabled: true
model:
name: "microsoft/resnet-50"
custom_params:
top_k: 5
threshold: 0.1
return_features: false
# Server Configuration
server:
host: "0.0.0.0"
port: 8000
workers: 1
max_file_size_mb: 100
enable_websocket: true
rate_limit_per_minute: 60
# Logging
logging:
level: "INFO"
file_path: "./logs/visionagent.log"
max_file_size_mb: 10
backup_count: 5
Environment Variables
# Override configuration with environment variables
export VISIONAGENT_CONFIG=/path/to/config.yaml
export VISIONAGENT_DEVICE=cuda
export VISIONAGENT_HOST=0.0.0.0
export VISIONAGENT_PORT=8000
export VISIONAGENT_LOG_LEVEL=DEBUG
export VISIONAGENT_MODEL_CACHE_DIR=/app/models
๐งฉ Extending the Framework
Creating Custom Agents
from agents.base_agent import BaseAgent, ProcessingResult
class CustomAgent(BaseAgent):
def initialize(self) -> bool:
# Initialize your model here
self._is_initialized = True
return True
def process(self, input_data: Any) -> ProcessingResult:
# Implement your processing logic
try:
# Your processing code here
result_data = {"custom_analysis": "results"}
return ProcessingResult(
success=True,
data=result_data,
confidence=0.95,
inference_time=50.0
)
except Exception as e:
return ProcessingResult(
success=False,
data={},
error=str(e)
)
๐ API Response Format
All endpoints return standardized responses:
{
"success": true,
"data": {
"detections": [...],
"detection_count": 5,
"class_summary": {...}
},
"inference_time_ms": 45.2,
"agent_info": {
"agent_type": "ObjectAgent",
"device": "cuda",
"initialized": true
},
"timestamp": "2025-08-31T12:00:00.000Z",
"request_id": "uuid-string"
}
๐ง Development
Setup Development Environment
# Install development dependencies
pip install -r requirements.txt
pip install pytest pytest-asyncio black flake8 mypy
# Run tests
pytest
# Format code
black .
# Lint code
flake8 .
mypy .
Project Structure Guidelines
- agents/ - All AI agent implementations inherit from
BaseAgent - models/ - Downloaded model files and weights
- utils/ - Shared utilities and helper functions
- server.py - FastAPI application with all endpoints
- config.py - Centralized configuration management
- cli.py - Command-line interface for all agents
๐ Production Deployment
sDocker Deployment
# Build production image
docker build -t visionagent:latest .
# Run with GPU support
docker run --gpus all \
-p 8000:8000 \
-v $(pwd)/models:/app/models \
-v $(pwd)/logs:/app/logs \
-e VISIONAGENT_LOG_LEVEL=INFO \
visionagent:latest
# Docker Compose (recommended)
docker-compose up -d
Kubernetes Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: visionagent
spec:
replicas: 3
selector:
matchLabels:
app: visionagent
template:
metadata:
labels:
app: visionagent
spec:
containers:
- name: visionagent
image: visionagent:latest
ports:
- containerPort: 8000
env:
- name: VISIONAGENT_DEVICE
value: "cuda"
resources:
requests:
nvidia.com/gpu: 1
limits:
nvidia.com/gpu: 1
๐ Performance Optimization
GPU Acceleration
- Automatic CUDA detection and device selection
- Batch processing for multiple images
- Memory-efficient model loading
Scalability Features
- Async FastAPI endpoints
- WebSocket streaming for real-time processing
- Configurable worker processes
- Model caching and lazy loading
๐ Security Considerations
- File size limits for uploads
- Input validation and sanitization
- Non-root container execution
- Rate limiting support
- CORS configuration
๐งช Testing
# Run all tests
pytest
# Run specific test categories
pytest tests/test_agents.py
pytest tests/test_api.py
pytest tests/test_utils.py
# Run with coverage
pytest --cov=agents --cov=utils --cov-report=html
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ค Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ Support
For issues and questions:
- Check the API documentation
- Review the [configuration guide]([def]: #configuration)
- Check system requirements and GPU setup
- Enable debug logging for detailed error information
๐ฏ Roadmap
- ONNX model support for cross-platform deployment
- Advanced video tracking algorithms
- Real-time face recognition optimization
- Model quantization for edge deployment
- Multi-camera support
- Advanced analytics and reporting
- Model fine-tuning utilities
- REST API rate limiting and authentication
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vision_agent_framework-1.0.0.tar.gz.
File metadata
- Download URL: vision_agent_framework-1.0.0.tar.gz
- Upload date:
- Size: 163.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef7ee018eaad14935af109f6eb01d6bf4faad65e069cf4875a6f8205c87f093a
|
|
| MD5 |
e318c23e11913f9746f5f5ac07a92f01
|
|
| BLAKE2b-256 |
206ff116ba4cd2d27699b70a94d7a9aa23c834188dac64751fae0b6cd35f0a16
|
File details
Details for the file vision_agent_framework-1.0.0-py3-none-any.whl.
File metadata
- Download URL: vision_agent_framework-1.0.0-py3-none-any.whl
- Upload date:
- Size: 187.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69cb070fd5fb4f936a8517966cdfe8380f1958681b65f695060bcfcf8ce50c0c
|
|
| MD5 |
2fa2c915d046b82ce497fcb217301384
|
|
| BLAKE2b-256 |
007cb6ff772ac0e2db3803d3cec26b2e0c3dea1cb58fdb0c0b16bbd9b4d7f8db
|