Aleris X3D Violence Detector
Aleris X3D Violence Detector is a deep learning model for video violence detection developed as part of the Aleris Graduation Project.
The model uses a hybrid architecture that combines:
- X3D-M for spatio-temporal video feature extraction.
- ResNet18 for complementary visual feature extraction.
- Feature fusion and a custom classification head for binary violence classification.
The model classifies videos into:
- Non-Violent
- Violent
Model Architecture
Input Video
│
▼
┌─────────────┐
│ X3D-M │
└─────────────┘
│
├──────────────┐
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Features │ │ ResNet18 │
└─────────────┘ └─────────────┘
│ │
└──────┬───────┘
▼
Feature Fusion
▼
Fully Connected Layers
▼
Violence / Non-Violence
Classes
| Label | Class |
|---|---|
| 0 | Non-Violent |
| 1 | Violent |
Input Specifications
- Video Frames: 16
- Frame Resolution: 224 × 224
- Channels: 3 (RGB)
- Input Format: B, T, C, H, W
Where:
- B = Batch Size
- T = Number of Frames
- C = Channels
- H = Height
- W = Width
Repository Files
| File | Description |
|---|---|
| aleris-violence-detector-x3d-resnet18.pth | PyTorch model checkpoint |
| aleris-violence-detector-x3d-resnet18.onnx | ONNX exported model |
| config.json | General model configuration |
| model_config.json | Architecture configuration |
| labels.json | Class labels |
| preprocessing_config.json | Input preprocessing configuration |
| requirements.txt | Required Python packages |
Installation
pip install -r requirements.txt
Loading the PyTorch Model
import torch
checkpoint = torch.load(
"aleris-violence-detector-x3d-resnet18.pth",
map_location="cpu"
)
model.load_state_dict(checkpoint["model_state_dict"])
model.eval()
Running the ONNX Model
import onnxruntime as ort
session = ort.InferenceSession(
"aleris-violence-detector-x3d-resnet18.onnx"
)
Applications
- Smart Surveillance Systems
- Violence Detection in Public Areas
- Security Monitoring
- Real-time Video Analysis
- Automated Incident Detection
Dataset
The model was trained on a custom violence detection dataset containing:
- Violent videos
- Non-Violent videos
with manually curated annotations and train/validation/test splits.
Frameworks and Libraries
- PyTorch
- TorchVision
- PyTorchVideo
- ONNX Runtime
- OpenCV
- NumPy
Authors
Developed as part of the Aleris Graduation Project by:
Mostafa Alazzaly
Citation
@misc{alazzaly2026alerisx3d,
title={Aleris X3D Violence Detector},
author={Mostafa Alazzaly},
year={2026},
publisher={Hugging Face}
}