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])

环境安装教程

#1.克隆项目并进入

#联系我:然后git clone my_projcet

2.linux创建虚拟环境

python3 -m venv psestenv
source psestenv/bin/activate

3.如果windows用户请用这个:

python3 -m venv psestenv cd psestenv
cd Scripts activate
cd …
cd …
pip install --upgrade pip

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

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

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

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

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

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

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

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

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

GitHub 加速计划 / yo / yolov7
13.12 K
4.14 K
下载
YOLOv7 - 实现了一种新的实时目标检测算法,用于图像识别和处理。
最近提交(Master分支:1 个月前 )
a207844b - 10 个月前
2c612d33 - 10 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐