YOLOv7姿态估计pose estimation(姿态估计-目标检测-跟踪)_yolov7 pose(1)

算法

YOLOv7姿态估计模型是YOLOv7目标检测模型的扩展,使用单个神经网络同时预测图像中多个物体的边界框和类别概率。在YOLOv7姿态估计模型中,网络预测每个人的关键点位置,从而可以用于估计人的姿态

网络

YOLOv7姿态估计模型基于深度卷积神经网络架构,由多个卷积层、最大池化和全连接层组成。网络接受输入图像并产生特征图,然后用于预测每个人的关键点位置。

数据集

YOLOv7姿态估计模型使用大型数据集进行训练,例如COCO(通用对象上下文)和MPII(马克斯·普朗克计算机科学研究所),这些数据集包含成千上万的人在各种姿势和环境中的注释图像。该模型使用监督学习和数据增强技术进行训练,例如随机缩放、旋转和平移输入图像。

优势

YOLOv7姿态估计模型的一个关键优势是其速度和准确性。该模型能够实时估计多个人的姿态,使其适用于人机交互和监控等应用。此外,该模型在COCO和MPII等基准数据集上实现了最先进的性能,展示了其准确性和鲁棒性。

结论

总之,YOLOv7姿态估计模型是一种快速准确的基于深度学习的人体姿态估计模型。其能够实时估计多个人的姿态,使其适用于各种应用,而其在基准数据集上的最先进性能证明了其有效性。随着深度学习的不断发展,我们可以预期在人体姿态估计方面会有进一步的改进,而YOLOv7姿态估计模型很可能在这些发展中发挥重要作用。

代码

#全部代码可私信或者qq1309399183
def run(poseweights=“yolov7-w6-pose.pt”,source=“football1.mp4”,device=‘cpu’,view_img=False,
save_conf=False,line_thickness = 3,hide_labels=False, hide_conf=True):

frame_count = 0 #count no of frames
total_fps = 0 #count total fps
time_list = [] #list to store time
fps_list = [] #list to store fps

device = select_device(opt.device) #select device
half = device.type != ‘cpu’

model = attempt_load(poseweights, map_location=device) #Load model
_ = model.eval()
names = model.module.names if hasattr(model, ‘module’) else model.names # get class names

if source.isnumeric() :
cap = cv2.VideoCapture(int(source)) #pass video to videocapture object
else :
cap = cv2.VideoCapture(source) #pass video to videocapture object

if (cap.isOpened() == False): #check if videocapture not opened
print(‘Error while trying to read video. Please check path again’)
raise SystemExit()

else:
frame_width = int(cap.get(3)) #get video frame width
frame_height = int(cap.get(4)) #get video frame height

vid_write_image = letterbox(cap.read()[1], (frame_width), stride=64, auto=True)[0] #init videowriter
resize_height, resize_width = vid_write_image.shape[:2]
out_video_name = f"{source.split(‘/’)[-1].split(‘.’)[0]}"
out = cv2.VideoWriter(f"{source}_keypoint.mp4",
cv2.VideoWriter_fourcc(*‘mp4v’), 30,
(resize_width, resize_height))

while(cap.isOpened): #loop until cap opened or video not complete

print(“Frame {} Processing”.format(frame_count+1))

ret, frame = cap.read() #get frame and success from video capture

if ret: #if success is true, means frame exist
orig_image = frame #store frame
image = cv2.cvtColor(orig_image, cv2.COLOR_BGR2RGB) #convert frame to RGB
image = letterbox(image, (frame_width), stride=64, auto=True)[0]
image_ = image.copy()
image = transforms.ToTensor()(image)
image = torch.tensor(np.array([image.numpy()]))

image = image.to(device) #convert image data to device
image = image.float() #convert image to float precision (cpu)
start_time = time.time() #start time for fps calculation

with torch.no_grad(): #get predictions
output_data, _ = model(image)

output_data = non_max_suppression_kpt(output_data, #Apply non max suppression
0.25, # Conf. Threshold.
0.65, # IoU Threshold.
nc=model.yaml[‘nc’], # Number of classes.
nkpt=model.yaml[‘nkpt’], # Number of keypoints.
kpt_label=True)

output = output_to_keypoint(output_data)

im0 = image[0].permute(1, 2, 0) * 255 # Change format [b, c, h, w] to [h, w, c] for displaying the image.
im0 = im0.cpu().numpy().astype(np.uint8)

im0 = cv2.cvtColor(im0, cv2.COLOR_RGB2BGR) #reshape image format to (BGR)
gn = torch.tensor(im0.shape)[[1, 0, 1, 0]] # normalization gain whwh

for i, pose in enumerate(output_data): # detections per image

if len(output_data): #check if no pose
for c in pose[:, 5].unique(): # Print results
n = (pose[:, 5] == c).sum() # detections per class
print(“No of Objects in Current Frame : {}”.format(n))

for det_index, (*xyxy, conf, cls) in enumerate(reversed(pose[:,:6])): #loop over poses for drawing on frame
c = int(cls) # integer class
kpts = pose[det_index, 6:]
label = None if opt.hide_labels else (names[c] if opt.hide_conf else f’{names[c]} {conf:.2f}')
plot_one_box_kpt(xyxy, im0, label=label, color=colors(c, True),
line_thickness=opt.line_thickness,kpt_label=True, kpts=kpts, steps=3,
orig_shape=im0.shape[:2])

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数同学面临毕业设计项目选题时,很多人都会感到无从下手,尤其是对于计算机专业的学生来说,选择一个合适的题目尤为重要。因为毕业设计不仅是我们在大学四年学习的一个总结,更是展示自己能力的重要机会。

因此收集整理了一份《2024年计算机毕业设计项目大全》,初衷也很简单,就是希望能够帮助提高效率,同时减轻大家的负担。
img
img
img

既有Java、Web、PHP、也有C、小程序、Python等项目供你选择,真正体系化!

由于项目比较多,这里只是将部分目录截图出来,每个节点里面都包含素材文档、项目源码、讲解视频

如果你觉得这些内容对你有帮助,可以添加VX:vip1024c (备注项目大全获取)
img

ython等项目供你选择,真正体系化!**

由于项目比较多,这里只是将部分目录截图出来,每个节点里面都包含素材文档、项目源码、讲解视频

如果你觉得这些内容对你有帮助,可以添加VX:vip1024c (备注项目大全获取)
[外链图片转存中…(img-ng6b0g9F-1712539970264)]

  • 24
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值