Weapon and Threat Detection Dataset
This dataset is a cleaned, restructured, and ready-to-use version of a comprehensive object detection dataset for identifying weapons, aggressors, and other security-related items. It has been specifically formatted for easy use with the Hugging Face datasets
library and modern training frameworks like ultralytics
for YOLO models.
Original Source
This dataset is a derivative work based on the weapon-detection Object Detection Model dataset, originally created and shared by yolov7test on Roboflow Universe.
All images and original annotations belong to the original author. This version was created to resolve data integrity issues, including inconsistent filenames and directory structures, to prepare it for robust training.
Dataset Details
The dataset is divided into three splits for standard model training and evaluation workflows.
- Train: 5,871 images
- Validation: 1,491 images
- Test: 2,295 images
Classes
The dataset contains 29 distinct classes for object detection:
'weapons'
, 'Aggressor'
, 'Blood'
, 'Guns'
, 'Guns perspective'
, 'Hand'
, 'Heavy Gun'
, 'Knife'
, 'Knife_Deploy'
, 'Knife_Weapon'
, 'Long guns'
, 'Person'
, 'Pistol'
, 'Rifle'
, 'Shotgun'
, 'Stabbing'
, 'Victim'
, 'al'
, 'guns'
, 'handgun'
, 'heavyweapon'
, 'larga'
, 'person'
, 'pistol'
, 'pistols'
, 'rifle'
, 'shotgun'
, 'violence'
, 'weapon'
Dataset Structure
Each item in the dataset is a dictionary with the following structure:
{
'image_id': 5,
'image': <PIL.JpegImagePlugin.JpegImageFile image>,
'width': 640,
'height': 640,
'objects': {
'bbox': [
[250.0, 150.0, 100.5, 200.0],
# ... more boxes
],
'category': [
12, # Corresponds to 'Pistol'
# ... more category IDs
]
}
}
image_id
: A unique integer identifier for the image.image
: The image object itself, in PIL format.width
,height
: The dimensions of the image.objects
: A dictionary containing the bounding box annotations.bbox
: A list of bounding boxes, each in the COCO format [x_min, y_min, width, height].category
: A list of corresponding integer class labels. The mapping from integer to class name can be found in the dataset's features.
How to Use
You can easily load this dataset using the datasets library:
from datasets import load_dataset
# Load the dataset from the Hugging Face Hub
dataset = load_dataset("Subh775/WeaponDetection")
# Access a specific split
train_dataset = dataset["train"]
# Print the first example
print(train_dataset[0])
Citation
If you use this dataset in your work, please cite the original creator and provide a link to the Roboflow Universe page.
Code snippet
@misc{yolov7test_weapon_detection,
title={Weapon Detection Object Detection Model},
author={yolov7test},
howpublished={\url{[https://universe.roboflow.com/yolov7test-pdxwq/weapon-detection-m7tpo](https://universe.roboflow.com/yolov7test-pdxwq/weapon-detection-m7tpo)}},
year={2022}
}
- Downloads last month
- 28