Production-grade, real-time computer vision engine with cyberpunk aesthetics
A sentient surveillance system featuring full-body tracking, ultra-precision iris detection, gesture recognition, and object detection. Built for deployment, not demos.
- Full-Body Tracking - 33-point skeleton with pose estimation
- Ultra-Precision Iris Tracking - Sub-pixel iris landmarks, gaze vectors, pupil dilation
- Advanced Gesture Recognition - 9+ gestures with temporal smoothing
- Object Detection (Optional) - YOLOv8-powered real-time detection
- Micro-Movement Detection - Saccades, blinks, micro-gestures
- 60 FPS target with automatic frame skipping
- GPU acceleration with graceful CPU fallback
- Kalman filtering for ultra-smooth tracking
- WebSocket streaming for real-time data
- Low latency (<33ms processing time)
- Cyberpunk overlays - Neon red/cyan aesthetic
- Glow effects - Holographic rendering
- HUD overlays - Dystopian interface
- Scanline effects (optional) - CRT monitor simulation
netrax-vision/
├── main.py # Core FastAPI server
├── config.py # Configuration management
├── requirements.txt # Python dependencies
├── Dockerfile # Container configuration
├── docker-compose.yml # Orchestration
├── .env.example # Configuration template
│
├── vision_engine/
│ ├── __init__.py
│ ├── body_tracker.py # Full-body pose tracking
│ ├── iris_tracker.py # Ultra-precision iris/eye tracking
│ ├── gesture_engine.py # Gesture recognition
│ ├── object_detector.py # YOLO object detection
│ ├── tracking_coordinator.py # Master coordinator
│ ├── visualizer.py # Cyberpunk visual effects
│ └── filters.py # Kalman filters
│
├── models/ # AI models (auto-downloaded)
├── logs/ # Application logs
└── frontend/
└── index.html # Your existing frontend
# Clone and setup
git clone <repository>
cd netrax-vision
# Configure
cp .env.example .env
# Edit .env with your settings
# Build and run
docker-compose up -d
# View logs
docker-compose logs -f
# Access
# Backend: http://localhost:8000
# Frontend: Open index.html in browser# Prerequisites: Python 3.10+, webcam
# Install dependencies
pip install -r requirements.txt
# Configure
cp .env.example .env
# Run server
python main.py
# Or with auto-reload
uvicorn main:app --reload --host 0.0.0.0 --port 8000Linux:
# Check available cameras
ls /dev/video*
# Test camera
ffplay /dev/video0
# Update .env
CAMERA_INDEX=0 # 0 for /dev/video0macOS:
# Update .env
CAMERA_INDEX=0 # 0 for built-in cameraWindows:
# Update .env
CAMERA_INDEX=0 # Usually 0 for built-inNVIDIA GPU:
# Install CUDA toolkit
# https://developer.nvidia.com/cuda-downloads
# Install nvidia-docker
# https://github.com/NVIDIA/nvidia-docker
# Update docker-compose.yml (uncomment GPU section)
# Update .env
USE_GPU=true
YOLO_DEVICE=cudaCPU-only:
USE_GPU=false
YOLO_DEVICE=cpu# Enable/disable vision modules
ENABLE_BODY_TRACKING=true # Full-body pose
ENABLE_IRIS_TRACKING=true # Ultra-precision eye tracking
ENABLE_GESTURE_RECOGNITION=true # Hand gestures
ENABLE_OBJECT_DETECTION=false # YOLOv8 (heavy)Connect: ws://localhost:8000/ws
Receive Messages:
{
"type": "stats",
"stats": {
"fps": 30.5,
"gesture_count": 15,
"confidence": 0.95,
"timestamp": "2025-12-21T..."
}
}{
"type": "gesture_command",
"command": "peace",
"confidence": 0.92,
"timestamp": "2025-12-21T..."
}{
"type": "tracking_detail",
"data": {
"body": {...},
"eyes": {...},
"gaze": {...}
},
"timestamp": "2025-12-21T..."
}Send Commands:
{
"type": "command",
"command": "calibrate"
}Health Check:
GET http://localhost:8000/System Status:
GET http://localhost:8000/statusVideo Feed:
GET http://localhost:8000/video_feed
# Returns: multipart/x-mixed-replace streamAvailable Gestures:
GET http://localhost:8000/api/gesturesCalibrate System:
POST http://localhost:8000/api/calibrateReset Tracking:
POST http://localhost:8000/api/resetThe provided index.html already integrates with the backend:
// WebSocket connection
const ws = new WebSocket('ws://localhost:8000/ws');
ws.onopen = () => {
console.log('Connected to NETRAX');
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'stats') {
// Update FPS, confidence, etc.
}
if (data.type === 'gesture_command') {
// Handle gesture: data.command
}
};
// Video feed
<img src="http://localhost:8000/video_feed">// Connect
const vision = new WebSocket('ws://localhost:8000/ws');
// Handle tracking data
vision.onmessage = (event) => {
const { type, data } = JSON.parse(event.data);
switch(type) {
case 'stats':
updateMetrics(data.stats);
break;
case 'gesture_command':
handleGesture(data.command);
break;
case 'tracking_detail':
// Full tracking data
const { body, eyes, gaze } = data.data;
renderTracking(body, eyes, gaze);
break;
}
};
// Send commands
vision.send(JSON.stringify({
type: 'command',
command: 'calibrate'
}));| Gesture | Emoji | Command | Description |
|---|---|---|---|
| Peace | ✌️ | peace |
Peace sign / Screenshot |
| Stop | ✋ | stop |
Open palm / Pause media |
| Thumbs Up | 👍 | thumbs_up |
Thumbs up / Volume up |
| Thumbs Down | 👎 | thumbs_down |
Thumbs down / Volume down |
| Fist | ✊ | fist |
Closed fist / Mute |
| Point | 👉 | point |
Pointing / Select |
| Swipe | ➡️ | swipe_left/right |
Swipe / Next/Previous |
| Arms Crossed | 🙆 | arms_crossed |
Arms crossed / Pause |
Edit vision_engine/gesture_engine.py:
def _detect_custom_gesture(self, body_data: Dict) -> float:
"""Detect your custom gesture"""
# Add your detection logic
confidence = 0.0
# Return confidence (0.0 to 1.0)
return confidence
# Register in __init__
self.gesture_rules["custom"] = self._detect_custom_gesture{
"left_eye": {
"iris": {
"center": {"x": 320, "y": 240, "z": 0.05},
"radius": 15.2,
"landmarks": [...]
},
"pupil": {
"center": {"x": 320, "y": 240},
"diameter": 5.3,
"dilation_rate": 0.02
},
"openness": 0.85,
"blink": false
},
"gaze": {
"x": 320,
"y": 240,
"z": 0.1,
"magnitude": 1.2
},
"saccade": {
"detected": true,
"velocity": 0.08
},
"blink_rate": 15.3
}High FPS (60+ FPS):
TARGET_FPS=60
FRAME_WIDTH=640
FRAME_HEIGHT=480
BODY_MODEL_COMPLEXITY=0
ENABLE_OBJECT_DETECTION=falseHigh Quality (30 FPS):
TARGET_FPS=30
FRAME_WIDTH=1280
FRAME_HEIGHT=720
BODY_MODEL_COMPLEXITY=2
ENABLE_OBJECT_DETECTION=trueBalanced (default):
TARGET_FPS=30
FRAME_WIDTH=1280
FRAME_HEIGHT=720
BODY_MODEL_COMPLEXITY=1# Check camera permissions
ls -la /dev/video*
# Add user to video group (Linux)
sudo usermod -aG video $USER
# Test camera
python -c "import cv2; print(cv2.VideoCapture(0).isOpened())"# Reduce resolution
FRAME_WIDTH=640
FRAME_HEIGHT=480
# Disable heavy modules
ENABLE_OBJECT_DETECTION=false
# Enable frame skipping
ENABLE_FRAME_SKIP=true# Check if server is running
curl http://localhost:8000/status
# Check firewall
sudo ufw allow 8000
# Check Docker networking
docker-compose ps# Reinstall
pip uninstall mediapipe opencv-python
pip install mediapipe==0.10.8 opencv-python==4.8.1.78
# Check camera access
python -c "import mediapipe as mp; print('OK')"- Camera access: Only expose port 8000 on trusted networks
- WebSocket: No authentication by default - add auth for production
- CORS: Currently allows all origins - restrict in production
- Data privacy: Video is processed locally, not stored
# main.py - Add authentication
from fastapi.security import HTTPBearer
security = HTTPBearer()
@app.websocket("/ws")
async def websocket_endpoint(
websocket: WebSocket,
token: str = Depends(security)
):
# Verify token
...Test System: Intel i7-10700K, NVIDIA RTX 3070, 16GB RAM
| Configuration | FPS | CPU | GPU | Latency |
|---|---|---|---|---|
| Full (All modules) | 28-32 | 45% | 25% | 28ms |
| No Objects | 55-60 | 25% | 15% | 16ms |
| Iris Only | 60+ | 15% | 10% | 12ms |
| CPU-only | 18-22 | 85% | 0% | 45ms |
pytest tests/ -vblack . --line-length 100
flake8 . --max-line-length 100- Create module in
vision_engine/ - Add to
tracking_coordinator.py - Update
config.pywith settings - Register in
main.py
MIT License
Contributions welcome! Please:
- Fork repository
- Create feature branch
- Commit changes
- Push to branch
- Open pull request
- Issues: https://github.com/Sidvortex/NETRAX-AI
- Docs: ---
- Email: [email protected]
- MediaPipe - Google's ML solutions
- Ultralytics - YOLOv8 framework
- FastAPI - Modern Python web framework
- OpenCV - Computer vision library
Built with precision. Designed for surveillance. NETRAX is always watching.
🔴 SYSTEM OPERATIONAL