Instructions to use shirish9354/Criminal_Activity_Detector_DaudshahVideoDataset with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use shirish9354/Criminal_Activity_Detector_DaudshahVideoDataset with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://shirish9354/Criminal_Activity_Detector_DaudshahVideoDataset") - Notebooks
- Google Colab
- Kaggle
π₯ Criminal Activity Detection Model Card
Overview
This project presents a deep learningβbased video classification system that categorizes short clips as Normal or Suspicious. The model is trained on the Daudshah Video Dataset and is designed for surveillance analysis, supporting both offline video processing and real-time streams.
The pipeline combines spatial feature extraction (CNN) with temporal modeling (RNN + attention) to capture motion patterns indicative of anomalous behavior.
Intended Use
β Primary Use Cases
- Surveillance monitoring (CCTV analysis)
- Smart city safety systems
- Automated alerting for abnormal activities
- Pre-screening large volumes of video footage
β οΈ Limitations / Out-of-Scope
- Not suitable for legal or forensic decision-making without human review
- Not intended for identifying individuals or facial recognition
- Performance may degrade under:
- Low-light conditions
- Unusual camera angles
- Domains outside the training distribution
Model Architecture
Input Video (2-second clip, 16 frames)
β
ResNet50 (ImageNet pretrained, frozen)
β
Frame Embeddings (16 Γ 2048)
β
LayerNorm β Dense(256) β Dropout(0.4)
β
Bidirectional GRU (64 units)
β
Temporal Attention Layer
β
Dense(64) β Dropout(0.6)
β
Sigmoid Output β P(Suspicious / Normal)
Key Design Choices
- Frozen CNN backbone β reduces overfitting on limited data
- Bidirectional GRU β captures forward and backward temporal dependencies
- Attention mechanism β emphasizes important frames within each clip
Training Details
| Parameter | Value |
|---|---|
| Framework | TensorFlow / Keras |
| Backbone | ResNet50 (frozen) |
| Sequence length | 16 frames |
| Clip duration | ~2 seconds |
| Batch size | 32 |
| Epochs | ~19 (early stopping applied) |
| Optimizer | Adam (clipnorm = 1.0) |
| Loss | Focal Loss (Ξ± = 0.60, Ξ³ = 2.0) |
| LR Schedule | ReduceLROnPlateau |
| Early Stopping | Based on validation AUC |
Training Strategy
- Precomputed CNN features cached for efficiency
- Stratified video-level splits to prevent data leakage
- Decision threshold tuned using macro-F1 score
Dataset
Source
- Daudshah/Video-dataset
- ~7 GB worth of 20-30 seconds of surveillance video clips
Classes
- Suspicious (13 categories): Abuse, Arrest, Arson, Assault, Burglary, Explosion, Fighting, Road Accident, Robbery, Shooting, Shoplifting, Stealing, Vandalism
- Normal: Non-criminal surveillance footage
Data Splits
| Split | Clips | Normal | Suspicious |
|---|---|---|---|
| Train | 1,328 | 51.2% | 48.8% |
| Validation | 332 | 51.2% | 48.8% |
| Test | 290 | 51.7% | 48.3% |
Performance
| Metric | Score |
|---|---|
| Accuracy | 95.24% |
| AUC-ROC | 0.9895 |
| Macro F1 | 0.903 |
Class-wise Performance
| Class | Precision | Recall |
|---|---|---|
| Normal | 89.6% | 92.0% |
| Suspicious | 91.2% | 88.6% |
Error Analysis
- False Positives: 12 / 150
- False Negatives: 16 / 140
Inference
Supported Inputs
- Video files (MP4, AVI, etc.)
- Live streams (Webcam, RTSP, RTMP)
Inference Method
- Sliding window approach over video streams
- Default 50% overlap to reduce missed detections
Performance
- ~135 ms per 2-second clip (NVIDIA T4 GPU)
- Real-time capable with batching and warm-up
Known Issues & Mitigations
| Issue | Mitigation |
|---|---|
| Class imbalance bias | Focal Loss tuning |
| Overfitting | Frozen backbone |
| Slow preprocessing | Batched GPU feature extraction |
| Threshold bias | Macro-F1 optimization |
| Serialization issues | Keras serializable registration |
| Training interruptions | Checkpointing with resume support |
| Feature extraction crashes | Incremental checkpointing |
| Dataset path issues | Auto-discovery logic |
| Data leakage risk | Video-level splitting |
Ethical Considerations
- False positives may trigger unnecessary alerts
- False negatives may miss critical incidents
- Should always be used with human oversight
- Avoid deployment in sensitive or high-risk scenarios without proper bias evaluation
Future Work
- Fine-tune CNN backbone with regularization
- Extend to multi-class classification (crime type detection)
- Explore transformer-based temporal models
- Optimize for edge deployment (TensorRT / ONNX)
- Improve domain adaptation for real-world CCTV environments
- Downloads last month
- 1
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support