Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
KirigiriSuzumiya de33f06cfd | 1 year ago | |
---|---|---|
README.assets | 1 year ago | |
__pycache__ | 1 year ago | |
model | 1 year ago | |
python | 1 year ago | |
ui | 1 year ago | |
video/taiji | 1 year ago | |
LICENSE | 1 year ago | |
README.md | 1 year ago | |
log.txt | 1 year ago | |
main.py | 1 year ago | |
requirements.txt | 1 year ago | |
temp.json | 1 year ago | |
ui_demo.py | 1 year ago | |
video_preprocessing.py | 1 year ago |
作为一名卑微的肥宅(本人)或健身新人,你是否有遇到过:
没关系,我们可以用PP-TinyPose搭一个会“等肥宅”的健身助手(其实就是一个播放器),话不多说,看效果:
以打太极为例,我是一个手脚不协调的运动白痴,他会等我把动作摆对才会继续。
当然不仅仅是太极,你也可以方便的导入自己喜欢的视频,然后让程序监督你成为视频中的猛男
依赖都写在了requirements中,一行命令就能帮你装好。
pip install -r requirements.txt
修改开头的文件地址之后
直接运行video_preprocessing.py
处理好的视频与json文件会统一保存在video
文件夹下,方便之后调用
直接运行main.py
就行。
使用PP-TinyPose完成了骨骼关键点的识别,图片来自PP-TinyPose项目页面
使用了很简单的方法,先过滤眼鼻等与健身关系不大的骨骼点数据,之后根据人的检出框进行归一化,然后用余弦距离计算相似度。
camera_res = None
therhold = 0.97
video_KPT = skel_list[peo_area.index(max(peo_area))]
video_box = peo_boxes[peo_area.index(max(peo_area))]
while camera_res is None:
try:
camera_res = json.load(open("temp.json", "r"))
except:
pass
camera_KPT = camera_res[2][0][0]
camera_box = camera_res[1][0]
# camera_KPT = skel_list[peo_area.index(min(peo_area))]
video_vec = np.array(video_KPT)[5:17, 0:2]
camera_vec = np.array(camera_KPT)[5:17, 0:2]
for i in range(len(video_vec)):
video_vec[i][0] = (video_vec[i][0]-video_box[0])/(video_box[2] - video_box[0])
video_vec[i][1] = (video_vec[i][1] - video_box[1]) / (video_box[3] - video_box[1])
camera_vec[i][0] = (camera_vec[i][0] - camera_box[0]) / (camera_box[2] - camera_box[0])
camera_vec[i][1] = (camera_vec[i][1] - camera_box[1]) / (camera_box[3] - camera_box[1])
video_vec = video_vec.reshape(-1)
camera_vec = camera_vec.reshape(-1)
cos_sim = video_vec.dot(camera_vec) / (np.linalg.norm(video_vec) * np.linalg.norm(camera_vec))
利用PP-TinyPose搭建一个肥宅也能跟上的健身/做操助手,正在开发UI界面与android应用
Python Text
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》