/Graduation-Design

毕业设计 2021-4

Primary LanguagePython

Graduation-Design

毕业设计 基于ResNet的人体热舒适姿态检测研究

依赖库

  • tensorflow-gpu==1.12.0
  • keras==2.2.4
  • tqdm==4.43.0
  • opencv-python==4.2.0.32

设置config.cfg文件来修改数据集路径

训练单人姿态估计网络

from train import SPENetTrain

spe = SPENetTrain(layers=8, joints=17, lr=1e-4, pretrained_weights=None)
spe.train(batch_size=2)

导入预训练权重进行训练

from train import SPENetTrain

spe = SPENetTrain(layers=8, joints=17, lr=1e-4, pretrained_weights=weights/SPENet-8-17.h5”)
spe.train(batch_size=2)

单人姿态估计网络预测骨架

from predict import SPENetPredict
from model import SPENet

# 导入训练好的权重
model = SPENet(layers=8)
model.load_weights("weights/SPENet-8-17.h5")

p = SPENetPredict(model)
p.predict_skeleton("test.jpg", save_folder="outputs", save_name="test")

从视频帧中提取姿态向量并保存为json文件

from model import SPENet
from utils import TCPDataLoader

# 导入训练好的权重
model = SPENet(layers=8)
model.load_weights("weights/SPENet-8-17.h5")

t = TCPDataLoader()
# 要准备训练集和验证集
t.prepare(model)

可视化json文件的输出结果

from utils import TCPDataLoader

t = TCPDataLoader()
# visualize输入:json路径 对应视频帧文件夹 第几帧
t.visualize()

训练热舒适姿态网络

from train import TCPNetTrain

t = TCPNetTrain(units=256, lr=2e-5, pretrained_weights=None)
t.train(batch_size=64)

摄像头预测

运行camera.py