Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.dataset.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# e_commerce_gun_detection > weapons_version
https://universe.roboflow.com/melody-nyea3/e_commerce_gun_detection

Provided by a Roboflow user
License: CC BY 4.0

29 changes: 29 additions & 0 deletions README.roboflow.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

e_commerce_gun_detection - v5 weapons_version
==============================

This dataset was exported via roboflow.com on February 21, 2025 at 7:33 AM GMT

Roboflow is an end-to-end computer vision platform that helps you
* collaborate with your team on computer vision projects
* collect & organize images
* understand and search unstructured image data
* annotate, and create datasets
* export, train, and deploy computer vision models
* use active learning to improve your dataset over time

For state of the art Computer Vision training notebooks you can use with this dataset,
visit https://github.com/roboflow/notebooks

To find over 100k other datasets and pre-trained models, visit https://universe.roboflow.com

The dataset includes 9646 images.
Gun are annotated in YOLOv8 format.

The following pre-processing was applied to each image:
* Auto-orientation of pixel data (with EXIF-orientation stripping)
* Resize to 640x640 (Stretch)

No image augmentation techniques were applied.


13 changes: 13 additions & 0 deletions data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
train: ../train/images
val: ../valid/images
test: ../test/images

nc: 1
names: ['weapon']

roboflow:
workspace: melody-nyea3
project: e_commerce_gun_detection
version: 5
license: CC BY 4.0
url: https://universe.roboflow.com/melody-nyea3/e_commerce_gun_detection/dataset/5
29 changes: 29 additions & 0 deletions live_detection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import torch
import sys
import cv2

try:
from ultralytics import YOLO
print("loading yolOv8")

model = YOLO('runs/detect/train/weights/best.pt')
print("conf. threshold=50%")
model.predict(source=0, show=True, conf=0.55)
except Exception as e:
print(f"YOLOv8 failed=error: {e}")
print("Attempting to load YOLOv5 instead")

try:
import os
if not os.path.exists("yolov5"):
print("Cloning yolov5 repo")
os.system("git clone https://github.com/ultralytics/yolov5.git")

os.system("pip install -r yolov5/requirements.txt")

print("Running yoloV5 live with conf. threshold = 50%")
os.system("python yolov5/detect.py --weights runs/detect/train/weights/best.pt --source 0 --conf 0.5 --save")

except Exception as e2:
print(f"yoloV5 failed {e2}")
sys.exit("ErRor")
30 changes: 30 additions & 0 deletions tempCodeRunnerFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import torch
import sys
import cv2

try:
from ultralytics import YOLO
print("loadimg YOLOv8")
model = YOLO('runs/detect/train/weights/best.pt')

print("Running YOLOV8 live detection")
model.predict(source=0, show=True)

except Exception as e:
print(f"YOLOv8 failed with error: {e}")
print("Attempting to load YOLOv5 instead")

try:
import os
if not os.path.exists("yolov5"):
print("Cloning YOLOv5 repository")
os.system("git clone https://github.com/ultralytics/yolov5.git")

os.system("pip install -r yolov5/requirements.txt")

print("Running YOLOv5 live detection...")
os.system("python yolov5/detect.py --weights runs/detect/train/weights/best.pt --source 0 --save")

except Exception as e2:
print(f"YOLOv5 also failed with error: {e2}")
sys.exit("Error: Both YOLOv8 and YOLOv5 failed. check setup.")
Binary file added yolo11n.pt
Binary file not shown.
Binary file added yolov8s.pt
Binary file not shown.