🚀 热成像相机人体检测
本项目提供了一个基于热成像图像的人体检测模型,可用于伪彩色和灰度热成像图像。模型最初针对人体检测进行了微调,也可进一步微调以检测其他物体。
🚀 快速开始
部署模型
要部署此模型,请使用以下代码:
安装依赖
$ python -m pip install ultralytics supervision huggingface_hub
Python代码
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
from supervision import Detections
import cv
model_path = hf_hub_download(
repo_id = "pitangent-ds/YOLOv8-human-detection-thermal",
filename = "model.pt"
)
model = YOLO(model_path)
def inference(image_path):
cv_image = cv.imread(image_path, cv2.IMREAD_ANYCOLOR)
model_output = model(cv_image, conf=0.6, verbose=False)
detections = Detections.from_ultralytics(model_output[0])
return detections
✨ 主要特性
- 多图像类型支持:支持伪彩色和灰度热成像图像。
- 可扩展性:模型最初针对人体检测进行微调,也可进一步微调以检测其他物体。
📦 安装指南
安装所需的依赖库:
$ python -m pip install ultralytics supervision huggingface_hub
💻 使用示例
基础用法
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
from supervision import Detections
import cv
model_path = hf_hub_download(
repo_id = "pitangent-ds/YOLOv8-human-detection-thermal",
filename = "model.pt"
)
model = YOLO(model_path)
def inference(image_path):
cv_image = cv.imread(image_path, cv2.IMREAD_ANYCOLOR)
model_output = model(cv_image, conf=0.6, verbose=False)
detections = Detections.from_ultralytics(model_output[0])
return detections
📚 详细文档
训练代码
from ultralytics import YOLO
import torch
model = YOLO("yolov8n.pt")
hyperparams = {
"batch": 32,
"epochs": 30,
"imgsz": [640, 480],
"optimizer": "AdamW",
"cos_lr": True,
"lr0": 3e-5,
"warmup_epochs": 10
}
model.train(
device = 'cuda' if torch.cuda.is_available() else 'cpu',
data = "data.yaml",
**hyperparams
)
依赖库
python: 3.10.13
ultralytics: 8.0.206
torch: "2.1.0+cu118"
roboflow: 1.1.9
📄 许可证
本项目采用AGPL-3.0许可证。