AIBrain is a comprehensive Python framework designed for computer vision and machine learning applications. It provides a modular, extensible architecture that streamlines AI development with reusable components, pre-built models, and utilities for various computer vision tasks including object detection, pose estimation, tracking, and re-identification.
- π§ Modular Architecture: Clean, extensible design with well-defined interfaces
- ποΈ Computer Vision: Comprehensive geometry utilities, image/video processing, and visualization tools
- π€ Machine Learning: Pre-built models for detection, pose estimation, and tracking
- π High Performance: Optimized for OpenVINO Runtime with async inference support
- π Dataset Management: Tools for loading, recording, and managing computer vision datasets
- βοΈ Configuration System: Flexible configuration management with type parsing
- π Performance Monitoring: Built-in profiling and logging capabilities
- π Pipeline Support: Base classes for building complex ML pipelines
install from source:
git clone https://github.com/salimnamvar/AIBrain.git
cd AIBrain# Object Detection with YOLO
from aib.ml.det import YOLO
from aib.cv.img import Image2D
# Initialize YOLO detector
detector = YOLO(
model_uri="path/to/yolo/model.xml",
backend="openvino",
conf_thre=0.5,
nms_thre=0.4
)
# Load and process image
image = Image2D.from_file("image.jpg")
detections = detector.infer(image)
# Visualize results
from aib.cv.plot import plot_geoms
result_image = plot_geoms(image, detections)aib/
βββ cfg/ # Configuration management
βββ cnt/ # Data containers and I/O utilities
βββ cv/ # Computer vision utilities
β βββ geom/ # Geometry (boxes, points, poses, etc.)
β βββ img/ # Image processing
β βββ plot/ # Visualization tools
β βββ vid/ # Video processing
βββ ds/ # Dataset loading and recording
βββ ml/ # Machine learning models
β βββ det/ # Object detection
β βββ trk/ # Object tracking
βββ misc/ # Miscellaneous utilities
βββ perf/ # Performance profiling
βββ sys/ # System core (base classes)
Comprehensive computer vision utilities for real-world applications:
- Geometry: 2D/3D points, bounding boxes, poses, lines, and contours
- Image Processing: Frame handling, image utilities with timestamp support
- Video Processing: Camera capture, video I/O with OpenCV and Decord backends
- Visualization: Plotting utilities for annotations and results visualization
Production-ready ML models with standardized interfaces:
- Object Detection: YOLO and RT-DETR implementations with OpenVINO optimization
- Object Tracking: OCSORT-based tracking with re-identification support
- Base Models: Abstract classes for building custom ML pipelines
Foundation classes for building robust applications:
- BaseObject: Common functionality (logging, configuration, profiling)
- BaseModel: ML model interface with lifecycle management
- BasePipe: Pipeline components for data processing
- BaseJob: Asynchronous job execution framework
Tools for handling computer vision datasets:
- Detection Datasets: Loading and managing object detection annotations
- Video Datasets: Video sequence processing and management
- Recording: Utilities for capturing and storing inference results
import asyncio
from aib.ml.det import YOLO
from aib.cnt.io import QueueIO
from aib.cv.vid import VideoCapture
async def detection_pipeline():
# Setup async YOLO detector
detector = YOLO(
model_uri="model.xml",
call_mode="async",
io_mode="queue"
)
# Create I/O queues
input_queue = QueueIO()
output_queue = QueueIO()
# Setup video capture
cap = VideoCapture("video.mp4")
# Process frames asynchronously
detector.io = QueueIO(input_queue, output_queue)
await detector.run_async()
asyncio.run(detection_pipeline())from aib.sys import BaseModel
from aib.cv.img import Image2D
class CustomDetector(BaseModel):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def _preproc(self, image: Image2D):
# Custom preprocessing
return processed_data
def _postproc(self, predictions):
# Custom postprocessing
return results
def infer(self, image: Image2D):
input_data = self._preproc(image)
predictions = self.model(input_data)
return self._postproc(predictions)AIBrain supports flexible configuration management:
from aib.cfg import Configuration
# Load configuration
config = Configuration("config.properties")
# Access nested configurations
detection_config = config.models.detection- YOLO (v8, v11): OpenVINO optimized implementation
- RT-DETR: Real-time detection transformer
- RTMPose: High-performance pose estimation
- MoveNet: Single person pose detection
- OCSORT: Observation-centric sort tracking
- Re-identification: Feature extraction and matching
Backward compatibility support for various model architectures in the legacy/ module.
git clone https://github.com/salimnamvar/AIBrain.git
cd AIBrain# Pose denoising example
cd sln/pose_denoising/
python main.pyAIBrain is optimized for performance:
- OpenVINO Integration: Hardware-accelerated inference
- Async Processing: Non-blocking pipeline execution
- Memory Efficient: Optimized data structures and processing
- Profiling Tools: Built-in performance monitoring
We welcome contributions!
- 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
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
This project uses several third-party libraries. The licenses for these dependencies can be found in the licenses/ directory. The license information is provided for transparency and to comply with open-source licensing requirements.
- Issues: GitHub Issues
- Documentation: [Coming Soon]
- Email: salim.namvar@gmail.com
- OpenVINO team for the excellent inference runtime
- Ultralytics for YOLO implementations
- All contributors and the open-source community
Made with β€οΈ by Salim Namvar