Exemplo n.º 1
0
 def __init__(self, parent=None):
     super().__init__(parent)  #父类的构造函数
     self.model, flag = net.load_model(use_gpu=False)  #加载模型
     self.timer_camera = QtCore.QTimer()  #定义定时器,用于控制显示视频的帧率
     self.cap = cv2.VideoCapture()  #视频流
     self.CAM_NUM = 0  #为0时表示视频流来自笔记本内置摄像头
     self.danceMatching = DanceMatching()  #实例化一个姿态检测类,也是线程类
     self.setupUi()
     self.slot_init()
Exemplo n.º 2
0
 def startGame(self):
     use_gpu = False#设置是否使用GPU
     model , flag = net.load_model(use_gpu = use_gpu)#加载模型
     gl.GL_Model = model#将模型放在全局变量中
Exemplo n.º 3
0
 def load_model(self):
     '''
     加载模型 并弹出提示 
     '''
     QMessageBox.information(self, "提示", "模型即将加载,请等待...初次使用软件会自动后台下载模型...")
     self.model, flag = net.load_model(use_gpu=False)
Exemplo n.º 4
0
涉及到的文件有的地方写的还不够完善
后期需要改进
'''

import os
import cv2 as cv
from score import tools
from model import net

os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = str(0)

#展示图片和玩家图片地址
showerUrl = "./image/test.jpeg"
playerUrl = "./image/test3.jpeg"
showerImage = cv.imread(showerUrl)
playerImage = cv.imread(playerUrl)

#加载模型并获得预测结果
use_gpu = False
model = net.load_model(use_gpu=use_gpu)
showerPre, showerImage = net.detection(model, showerImage, use_gpu)
playerPre, playerImage = net.detection(model, playerImage, use_gpu)

#归一化
showerDis, showerSkeleton = tools.normalization(showerPre['pred_coords'][0])
playerDis, playerSkeleton = tools.normalization(playerPre['pred_coords'][0])

#匹配计算分数并输出结果
score = tools.matching(playerSkeleton, showerSkeleton, use_gpu=use_gpu)
print("匹配得分{}".format(score))