Skip to content

Ax199/Violence_Yolo_Model_Compare

Repository files navigation

暴力检测模型比较框架

这个项目用于测试和比较不同的基于YOLOv8的暴力检测模型。目前集成了两个模型:

  1. V01 (Yasser) - 来自 Violence_detection_YOLOv8
  2. V02 (Musa) - 来自 Fight-Violence-detection-yolov8

比较结果

模型性能比较表格:

模型类型 加载时间(秒) 检测时间(秒) 总时间(秒)
V01 0.07 1.07 1.13
V02-SMALL 0.06 0.28 0.34
V02-NANO 0.04 0.13 0.17

===== 检测结果 =====
Violence (置信度: 0.82), 位置: [203, 16, 767, 651]
violence (置信度: 0.66), 位置: [231, 7, 763, 649]
violence (置信度: 0.66), 位置: [235, 28, 763, 645]

项目结构

项目使用Git子模块来管理依赖的模型:

Violence_Yolo/
├── V01_Yasser_Violence/    # Yasser的暴力检测模型(子模块)
├── V02_Musa_Violence/      # Musa的暴力检测模型(子模块)
├── test_violence.py        # 模型测试和比较脚本
└── test_image/             # 测试图像目录

安装与设置

克隆项目及其子模块

# 克隆主项目和所有子模块
git clone --recurse-submodules https://your-repo-url.git
cd Violence_Yolo

# 或者,如果你已经克隆了项目但没有子模块
git submodule update --init --recursive

安装依赖

# 创建虚拟环境
python -m venv .venv
source .venv/bin/activate  # Linux/Mac
# 或 .venv\Scripts\activate  # Windows

# 安装依赖
pip install -r requirements.txt

使用方法

测试单个模型

# 测试V01模型
python test_violence.py --v01 [图像路径]

# 测试V02 Small模型
python test_violence.py --v02-small [图像路径]

# 测试V02 Nano模型
python test_violence.py --v02-nano [图像路径]

比较所有模型

# 比较所有模型
python test_violence.py --compare [图像路径]

# 比较所有模型但不包括V01
python test_violence.py --compare [图像路径] --no-v01

默认模式

直接运行脚本将默认执行所有模型的比较:

python test_violence.py

子模块管理

更新子模块

# 更新所有子模块到最新的远程提交
git submodule update --remote

# 更新特定子模块
git submodule update --remote V01_Yasser_Violence

添加新的子模块

git submodule add [仓库URL] [本地路径]

注意事项

  1. 模型文件较大,首次克隆可能需要较长时间。
  2. V01 模型预期的权重文件位于 V01_Yasser_Violence/weight/best.pt
  3. V02 模型预期的权重文件位于 V02_Musa_Violence/yolo_small_weights.ptV02_Musa_Violence/Yolo_nano_weights.pt

About

Yolo 暴力图片检测模型对比

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages