yolov5
c++ tensorrt 有模型:
https://github.com/RichardoMrMu/yolov5-head-detect
python版:人体检测,不是人头检测。
https://github.com/RichardoMrMu/yolov5-head-detector
brainwash数据集
网盘链接:https://pan.baidu.com/s/1Vgr6jZByU41TPd2tkiPMwA 提取码:rnk3
有数据集,不能访问了
https://drive.google.com/open?id=1zn-AGmsBqVheFPnDTXWBpeo3XRH1Ho15
https://drive.google.com/open?id=1LiTDMWk0KglGueJCaxgneEA_ltvEbUDV
后来发现就是这个数据集:
YOLOv4人头检测器训练数据集_人头检测数据集,yolov5人头检测-Linux文档类资源-CSDN下载
https://github.com/kly1997/head_shoulder-detection-by-yolov3
YOLOv4人头检测器训练数据集_人头检测数据集,yolov5人头检测-Linux文档类资源-CSDN下载
人头检测:
gpu下90ms左右,在家测试有误检,自己的电脑上。
sfd_head_30000.pth
自己整理的摄像头测试代码:
# -*- coding:utf-8 -*-
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import os
import torch
import argparse
import torch.nn as nn
import torch.utils.data as data
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
import cv2
import time
import numpy as np
from PIL import Image
from datasets.config import cfg
from s3fd import build_s3fd
from torch.autograd import Variable
from utils.augmentations import to_chw_bgr
from alfred.dl.torch.common import device
parser = argparse.ArgumentParser(description='s3df demo')
parser.add_argument('--save_dir', type=str, default='tmp/', help='Directory for detect result')
parser.add_argument('--model', type=str, default='./sfd_head_30000.pth', help='trained model')
parser.add_argument('--thresh', default=0.4, type=float, help='Final confidence threshold')
args = parser.parse_args()
use_cuda = torch.cuda.is_available()
torch.set_default_tensor_type('torch.FloatTensor')
if use_cuda:
torch.set_default_tensor_type('torch.cuda.FloatTensor')
def detect(net, thresh):
cap=cv2.VideoCapture(0)
while True:
ret,img=cap.read()
if img is not None:
img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
height, width, _ = img.shape
# image = cv2.resize(img, (960, 680))
x = to_chw_bgr(img)
x = x.astype('float32')
x -= cfg.img_mean
x = x[[2, 1, 0], :, :]
with torch.no_grad():
x = torch.from_numpy(x).unsqueeze(0).to(device)
t1 = time.time()
y = net(x)
detections = y.data
scale = torch.Tensor([img.shape[1], img.shape[0], img.shape[1], img.shape[0]])
for i in range(detections.size(1)):
j = 0
while detections[0, i, j, 0] >= thresh:
score = detections[0, i, j, 0]
pt = (detections[0, i, j, 1:] * scale).cpu().numpy()
left_up, right_bottom = (int(pt[0]), int(pt[1])), (int(pt[2]), int(pt[3]))
j += 1
cv2.rectangle(img, left_up, right_bottom, (0, 0, 255), 2)
conf = "{:.3f}".format(score)
point = (int(left_up[0]), int(left_up[1] - 5))
cv2.putText(img, conf, point, cv2.FONT_HERSHEY_COMPLEX, 0.6, (0, 255, 0), 1)
t2 = time.time()
print(' timer:{}',t2 - t1)
cv2.imshow('rr', img)
cv2.waitKey(1)
if __name__ == '__main__':
net = build_s3fd('test', cfg.NUM_CLASSES)
net.load_state_dict(torch.load(args.model))
net.eval()
if use_cuda:
net.cuda()
cudnn.benckmark = True
detect(net, args.thresh)
数据集:
SCUT-HEAD
下载地址:
An implimentation of yoloV3 in head detection ,keras and tensorflow backend used
This repository is based on qqwweee/keras-yolo3.We train the keras yolov3 model in brainwash dataset,and make detection on human heads by this model.
人头数据集2:
人头检测训练数据集(带标签)_人头检测数据集,人头数据集-互联网文档类资源-CSDN下载
快速精准的人头检测,有数据,有代码
https://github.com/aditya-vora/FCHD-Fully-Convolutional-Head-Detector
修改的代码:加载预训练改了
head_detector = Head_Detector_VGG16(ratios=[1], anchor_scales=[2,4]) dict = torch.load(opt.caffe_pretrain_path) head_detector.load_state_dict(dict['model'])
权重66m,有漏检,值得看看
mtcnn: 人脸检测,不是人头检测
https://github.com/Seanlinx/mtcnn
无源码:
https://github.com/samylee/HeadDetect_MTCNN
有人头数据集
https://github.com/zuoqing1988/train-mtcnn-head
有漏捡:
https://github.com/wnov/Keras_Head_Detection_YoloV3
人头和眼睛:
这个效果还行 keras,能检测安全帽,有误检
https://github.com/jacke121/head-detection-using-yolo
读取时加一行代码:
weights=np.insert(weights, 0, values=weights[0], axis=0)
人体检测,不是人头检测
GitHub - xinsuinizhuan/yolov5-head-detector: A python implementation of yolov5 and deepsort
B超图: