SafeVision
SafeVision is a professional Python script designed to detect and blur nudity in both videos and images.
Install / Use
/learn @im-syn/SafeVisionREADME
Overview
SafeVision is a comprehensive, multi-modal content safety suite powered by advanced ONNX deep learning models. This sophisticated system provides real-time nudity detection, content filtering, and automated censoring across images, videos, live streams, and camera feeds. With multiple interfaces including CLI tools, modern GUI applications, live monitoring, streaming integration, and RESTful API endpoints, SafeVision offers enterprise-grade content moderation capabilities for various use cases.
🎯 Key Capabilities
- Multi-Format Support: Images, videos, live camera feeds, screen capture
- Real-time Processing: Live detection with sub-second response times
- Multiple Interfaces: CLI, GUI, API server, screen overlay, streaming integration
- Advanced AI Models: ONNX-optimized deep learning models with 18+ detection categories
- Professional Features: Batch processing, custom rules, alert systems, logging
- Cross-Platform: Windows, Linux, macOS support with optimized performance
📑 Table of Contents
🚀 Getting Started
🛠️ Core Applications
- 🖼️ Image Processing (main.py)
- 🎥 Video Processing (video.py)
- 📺 Live Camera Detection (live.py)
- 🎮 Live Streaming (live_streamer.py)
🎨 User Interfaces
⚙️ Advanced Features
📖 Documentation
⭐ Features
🤖 AI-Powered Detection
- Advanced ONNX Models: Optimized deep learning models for accurate content detection
- 18+ Detection Categories: Comprehensive labeling system for different content types
- Risk Assessment: Automatic severity classification (Safe, Low, Moderate, High, Critical)
- Real-time Processing: Sub-second analysis with GPU acceleration support
- Confidence Scoring: Adjustable detection thresholds for different use cases
🎯 Content Processing
- Multi-Format Support: Images (JPG, PNG, BMP, TIFF), Videos (MP4, AVI, MOV, MKV)
- Live Camera Feeds: Real-time webcam and USB camera processing
- Screen Capture: Monitor desktop activity with overlay detection
- Batch Processing: Process multiple files simultaneously
- Audio Preservation: Maintain original audio in processed videos
🛡️ Censoring & Safety
- Intelligent Blurring: Selective or full-frame blur with adjustable strength
- Color Masking: Solid color overlay as alternative to blur
- Custom Exception Rules: Define what content to blur or ignore
- Protection Modes: Kids Safety, Streamer, Nudity Fighter, and custom modes
- Alert Systems: Real-time notifications and emergency actions
🖥️ User Interfaces
- Modern PyQt5 GUI: Professional interface with drag-drop, themes, and live preview
- Command Line Tools: Full CLI support for automation and scripting
- Screen Overlay: Transparent overlay for monitoring any application
- REST API Server: HTTP endpoints for integration with other applications
- Streaming Integration: OBS and live streaming platform support
📊 Professional Features
- Detailed Logging: Comprehensive detection logs with timestamps and metadata
- Performance Monitoring: FPS tracking, memory usage, and system optimization
- Configuration Management: Persistent settings and customizable parameters
- Report Generation: Export detection reports in multiple formats
- Multi-threading: Optimized performance with parallel processing
🔧 Development & Integration
- RESTful API: Complete API server with JSON responses and file upload support
- SDK Components: Reusable classes for custom integration
- Event Hooks: Callback system for custom actions on detection
- Plugin Architecture: Extensible design for custom detection rules
- Cross-platform: Windows, Linux, macOS support with native installers
🔧 Installation & Setup
📋 System Requirements
Minimum Requirements:
- Python 3.8+ (3.9+ recommended)
- 4GB RAM (8GB+ recommended)
- 2GB free disk space
- CPU with AVX2 support (Intel 2013+, AMD 2017+)
Recommended for Optimal Performance:
- Python 3.10+
- 16GB+ RAM
- NVIDIA GPU with CUDA support
- SSD storage for faster model loading
🚀 Quick Installation
# Clone the repository
git clone https://github.com/im-syn/safevision.git
cd safevision
# Install core dependencies
pip install -r requirements.txt
# For GUI applications (PyQt5 interface)
pip install -r requirements_gui.txt
# For API server functionality
pip install -r requirements_api.txt
# For live streaming features
pip install -r requirements_streaming.txt
📦 Required Models
SafeVision requires ONNX model files in the Models/ directory:
# Create Models directory
mkdir Models
# Place your models (obtain from official source):
# Models/best.onnx - Main nudity detection model
# Models/best_gender.onnx - Gender/age detection model (optional)
📥 Model Download: Contact the maintainer or check releases for official model files.
🔧 Advanced Installation Options
GPU Acceleration (Recommended)
# For NVIDIA GPU support
pip install onnxruntime-gpu
# For Intel GPU support
pip install onnxruntime-openvino
# For AMD GPU support
pip install onnxruntime-directml
FFmpeg Installation (Required for Video Processing)
# Windows (using chocolatey)
choco install ffmpeg
# macOS (using homebrew)
brew install ffmpeg
# Ubuntu/Debian
sudo apt update && sudo apt install ffmpeg
# Manual installation
python download_ffmpeg.py
Virtual Environment (Recommended)
# Create virtual environment
python -m venv safevision_env
# Activate (Windows)
safevision_env\Scripts\activate
# Activate (Linux/macOS)
source safevision_env/bin/activate
# Install dependencies
pip install -r requirements.txt
✅ Installation Verification
# Test core functionality
python main.py --help
# Test GUI interface
python safevision_gui.py
# Test API server
python safevision_api.py
# Test live detection
python live.py --help
# Test video processing
python video.py --help
# Test live streaming
python live_streamer.py --help
🚨 Common Installation Issues
ONNX Runtime Issues
# If you get ONNX import errors:
pip uninstall onnxruntime onnxruntime-gpu
pip install onnxruntime==1.15.1
# For GPU support:
pip install onnxruntime-gpu==1.15.1
OpenCV Issues
# If OpenCV fails to import:
pip uninstall opencv-python opencv-python-headless
pip install opencv-python==4.8.1.78
PyQt5 Issues
# If GUI fails to start:
pip uninstall PyQt5
pip install PyQt5==5.15.9
📁 Project Structure
SafeVision/
├── 🎯 Core Applications
│ ├── main.py # Image processing CLI
│ ├── video.py # Video processing CLI
│ ├── live.py # Live camera detection
│ └── live_streamer.py # Live streaming integration
│
├── 🎨 User Interfaces
│ ├── safevision_gui.py # Modern PyQt5 GUI
│ └── safevision_api.py # REST API server
│
├── 📁 Models & Configuration
│ ├── Models/
│ │ ├── best.onnx # Main detection model
│ │ └── best_gender.onnx # Gender/age model (optional)
│ ├── BlurException.rule # Default blur rules
│ └── custom_rules.rule # Custom rule examples
│
├── 📁 Output Directories (Auto-created)
│ ├── output/ # Final processed content
│ ├── Blur/ # Blurred versions
│ ├── Prosses/ # Detection visualizations
│ ├── video_output/ # Processed videos
│ ├── Logs/ # Application logs
│ └── detection_screenshots/ # Detection captures
│
└── 📁 Configuration Files (Auto-generated)
├── safevision_settings.json # GUI settings
├── detection_log.json # Detection history
└── violation_log.json # Violation tracking
📄 Key Files Explained
🎯 Core Processing Files
main.py: Single image processing with CLI interfacevideo.py: Batch video processing with advanced optionslive.py: Real-time camera feed analysislive_streamer.py: Live streaming integration with OBS support
🎨 User Interface Files
safevision_gui.py: Modern PyQt5 interface with advanced featuressafevision_api.py: RESTful API server for integration
⚙️ Configuration Files
BlurException.rule: Rules defining what content to blur*.json: Runtime settings and detection logssafevision_gui.py: Modern PyQt5 interface with advanced featuressafevision_api_server.py: RESTful API server

