• 大小: 9KB
    文件类型: .gz
    金币: 1
    下载: 0 次
    发布日期: 2021-05-23
  • 语言: 其他
  • 标签: 人脸识别  

资源简介

这个压缩包里包含了一个人脸识别软件系统,可以批量处理拍摄照片,训练模型,并更改参数,可以识别人脸,并包含一个GUI界面

资源截图

代码片段和文件信息

# -*- coding: utf-8 -*-
from PyQt4 import QtCore QtGui
from window1 import Ui_Form
import sys
import cv2
import dlib
import random
import numpy as np
import os
import tensorflow as tf
from my_def import relightgetPaddingSizereadDataweightVariablebiasVariableconv2dmaxPooldropoutcnnlayeris_my_face
from PIL import Image
class MainWindow(QtGui.QMainWindow Ui_Form):
    def __init__(self parent=None):
        super(MainWindow self).__init__(parent)
        self.setupUi(self)
        #获取人脸区域
        self.pushButton_getface.clicked.connect(self.getface)
        self.pushButton_dir.clicked.connect(self.set_outputdir)
        self.pushButton_gfrunpause.clicked.connect(self.gf_runpause)
        self.pushButton_gfstop.clicked.connect(self.getface_stop)
        #训练模型区域
        self.pushButtontrain.clicked.connect(self.tftrain)
        self.pushButtonplot.clicked.connect(self.plot)
        self.connect(self.comboBox QtCore.SIGNAL(‘activated(QString)‘)self.onactivated) 
        #识别人脸区域
        self.pushButtonrecog.clicked.connect(self.facerecognition)
        self.pushButton_recogrunpause.clicked.connect(self.facerecognition_runpause)
        self.pushButton_recogstop.clicked.connect(self.facerecognition_stop)
#获取人脸区域
    def getface(self):
        face_number = self.lineEdit_imgnum.text()
        output_dir = self.lineEdit_dir.text()
        from tread import getface_tread
        self.gfThread = getface_tread(face_numberoutput_dir)
        self.gfThread.getface_tread_signal.connect(self.lineEdit_beprocessed_set)
        self.gfThread.getface_tread_signal1.connect(self.label_show_set)
        self.gfThread.start()
    #暂停与恢复
    def gf_runpause(self):
        if (self.pushButton_gfrunpause.isChecked()):
            self.gfThread.pause()
        else:
            self.gfThread.resume()
    #停止
    def getface_stop(self):
        self.gfThread.stop()  

    def lineEdit_beprocessed_set(selfnum):
        self.lineEdit_beprocessed.setText(str(num))

    def set_outputdir(self):
        output_dir = QtGui.QFileDialog.getExistingDirectory()
        self.lineEdit_dir.setText(output_dir)
    
    def label_show_set(selfimg_name):
        self.label_show.setPixmap(QtGui.QPixmap(img_name))

#训练模型区域
    def tftrain(self):
        batch_size = int(self.lineEdit_batch.text())
        learn_rate = float(self.lineEdit_learnrate.text())
        from tread import timerun_treadtftrain_tread
        #创建定时器线程对象
        self.timerunThread = timerun_tread()
        self.timerunThread.timerun_tread_signal.connect(self.lineEdit_time_set)
        self.timerunThread.start()
        #训练模型线程
        self.tftrainThread = tftrain_tread(batch_sizenlearn_rate)
        self.tftrainThread.tftrain_tread_signal.connect(self.lineEdit_loss_set)
        self.tftrainThread.tftrain_tread_signal1.connect(self.lineEdit_accu_set)
        self.tftrainThread.tftrain_tread_signal2.connect(self.timeend)
        self.tftrainThread.start()
    
    def tftrain_pause(self):
        self.t

评论

共有 条评论