Skip to content

Commit 3663058

Browse files
author
mzy
committed
正式开源明文代码,修复bug,性能好、效果好、体验好!菜鸟也能快速搭建运行哦~
1 parent dacfdb6 commit 3663058

12 files changed

+534
-174
lines changed

Camera_Thread_class.py

+210-141
Large diffs are not rendered by default.

README.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@
66
- [前言](#前言)
77
- [安装与启动](#安装与启动)
88
- [使用许可](#使用许可)
9-
# 2021年秋中国科大计算机视觉课程大设计,同班同学别下载这个哈~
9+
## 毕设和课设的任务已经完成!
10+
## 作者保证这玩意能运行、步骤简单、见效出活快!在此基础上魔改也很简单!
11+
## 2021-01-15更新!已经开源明文代码、欢迎大家学习交流!
1012
## 前言
11-
1213
本项目是基于深度学习的人脸实时表情识别项目,方便部署运行,后续将继续更新。
1314
表情识别部分采用TensorFlow+OpenCV实现,GUI使用pyqt5构建。
1415
目前可针对5种表情(Angry,Happy,Neutral,Sad,Surprise)进行识别。
1516
本项目已在Python3.7下测试通过。
1617
### 如果本项目对您有所帮助,欢迎(请)关注我的知乎账户zhihu:[风和人海](https://www.zhihu.com/people/hotpotpot)
18+
### 如果这个项目在研究生学习、工作和生活中帮到您了,不妨请我喝一杯咖啡或者吃一碗面条~作者在这里谢谢啦!!!
19+
![image](https://github.com/zhiyongm/DeepLearning-Emotion-Classifier-withGUI/blob/master/imgs/coffee.jpg)
20+
1721
### 并为本项目点亮小星星😁⭐️
1822
> 注意:由于开源时这个项目的改版也是我的课程设计,因此代码部分做了混淆处理,预计将在2022年1月后开源明文代码
1923
#### 项目演示:

emoji_pics/raw/angry.png

19.6 KB
Loading

emoji_pics/raw/happy.png

25.4 KB
Loading

emoji_pics/raw/neutral.png

22.2 KB
Loading

emoji_pics/raw/sad.png

23.8 KB
Loading

emoji_pics/raw/surprise.png

23 KB
Loading

imgs/coffee.jpg

110 KB
Loading

mainfile.py

+40-27
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,40 @@
1-
import sys #line:1
2-
import matplotlib #line:3
3-
from PyQt5 import QtWidgets #line:4
4-
from Camera_Thread_class import Camera_Thread_class #line:7
5-
matplotlib.use ("Qt5Agg")#line:10
6-
import mainwindow2 as uiWindow #line:12
7-
ui =0 #line:13
8-
class FaceMain :#line:15
9-
def __init__ (O00O0O00O00OO0OOO ):#line:17
10-
OOO0O0O0O000O00OO =QtWidgets .QApplication (sys .argv )#line:18
11-
O00O0O00O00OO0OOO .MainWindow =QtWidgets .QMainWindow ()#line:19
12-
O00O0O00O00OO0OOO.MainWindow.setStyleSheet("#MainWindow{border-image:url(./ktj_background.png);}")
13-
O0OO00OOOOO00O00O =uiWindow .Ui_MainWindow ()#line:20
14-
O0OO00OOOOO00O00O .setupUi (O00O0O00O00OO0OOO .MainWindow )#line:21
15-
O00O0O00O00OO0OOO .ui =O0OO00OOOOO00O00O #line:22
16-
O00O0O00O00OO0OOO .initfunc ()#line:23
17-
O00O0O00O00OO0OOO .MainWindow .show ()#line:24
18-
sys .exit (OOO0O0O0O000O00OO .exec_ ())#line:25
19-
def initfunc (OO00OO000OO000OOO ):#line:26
20-
OO00OO000OO000OOO .camera_thread =Camera_Thread_class (OO00OO000OO000OOO .ui )#line:27
21-
OO00OO000OO000OOO .camera_thread .start ()#line:28
22-
OO00OO000OO000OOO .initsignal ()#line:32
23-
def initsignal (O00O0OO0OOOO0OO0O ):#line:35
24-
O00O0OO0OOOO0OO0O .ui .DetectOnBtn .clicked .connect (O00O0OO0OOOO0OO0O .camera_thread .startRunning )#line:37
25-
O00O0OO0OOOO0OO0O .ui .DetectOffBtn .clicked .connect (O00O0OO0OOOO0OO0O .camera_thread .stopRunning )#line:38
26-
if __name__ =='__main__':#line:42
27-
FaceMain ()
1+
import sys
2+
3+
import matplotlib
4+
from PyQt5 import QtWidgets
5+
6+
7+
from Camera_Thread_class import Camera_Thread_class
8+
9+
matplotlib.use("Qt5Agg") # 声明使用QT5
10+
11+
import mainwindow2 as uiWindow
12+
ui=0
13+
14+
class FaceMain:
15+
16+
def __init__(self):
17+
app = QtWidgets.QApplication(sys.argv)
18+
self.MainWindow = QtWidgets.QMainWindow()
19+
ui = uiWindow.Ui_MainWindow()
20+
ui.setupUi(self.MainWindow)
21+
self.ui=ui
22+
self.initfunc()
23+
self.MainWindow.show()
24+
sys.exit(app.exec_())
25+
def initfunc(self):
26+
self.camera_thread=Camera_Thread_class(self.ui)
27+
self.camera_thread.start()
28+
# 初始化按键信号
29+
self.initsignal()
30+
31+
32+
def initsignal(self):
33+
# 信号绑定的是控制子线程的启动和停止
34+
self.ui.DetectOnBtn.clicked.connect(self.camera_thread.startRunning)
35+
self.ui.DetectOffBtn.clicked.connect(self.camera_thread.stopRunning)
36+
37+
38+
39+
if __name__ == '__main__':
40+
FaceMain()

mainwindow2.py

+30-4
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,27 @@
1414
class Ui_MainWindow(object):
1515
def setupUi(self, MainWindow):
1616
MainWindow.setObjectName("MainWindow")
17-
MainWindow.resize(936, 446)
17+
MainWindow.resize(936, 518)
18+
MainWindow.setStyleSheet("#MainWindow{border-image:url(./ktj_background.png);}")
1819
self.centralwidget = QtWidgets.QWidget(MainWindow)
1920
self.centralwidget.setObjectName("centralwidget")
2021
self.DetectOnBtn = QtWidgets.QPushButton(self.centralwidget)
21-
self.DetectOnBtn.setGeometry(QtCore.QRect(20, 320, 161, 91))
22+
self.DetectOnBtn.setGeometry(QtCore.QRect(20, 380, 161, 91))
2223
font = QtGui.QFont()
2324
font.setPointSize(28)
2425
self.DetectOnBtn.setFont(font)
2526
self.DetectOnBtn.setObjectName("DetectOnBtn")
2627
self.Cameralabel = QtWidgets.QLabel(self.centralwidget)
2728
self.Cameralabel.setGeometry(QtCore.QRect(30, 10, 161, 151))
29+
self.Cameralabel.setAutoFillBackground(False)
30+
self.Cameralabel.setStyleSheet("border-style: solid;\n"
31+
"border-width: 1px;")
2832
self.Cameralabel.setText("")
2933
self.Cameralabel.setObjectName("Cameralabel")
3034
self.Detectlabel = QtWidgets.QLabel(self.centralwidget)
3135
self.Detectlabel.setGeometry(QtCore.QRect(210, 10, 161, 151))
36+
self.Detectlabel.setStyleSheet("border-style: solid;\n"
37+
"border-width: 1px;")
3238
self.Detectlabel.setText("")
3339
self.Detectlabel.setObjectName("Detectlabel")
3440
self.shibiejieguo = QtWidgets.QLabel(self.centralwidget)
@@ -47,27 +53,45 @@ def setupUi(self, MainWindow):
4753
self.emtiontextlabel.setObjectName("emtiontextlabel")
4854
self.Face_Label = QtWidgets.QLabel(self.centralwidget)
4955
self.Face_Label.setGeometry(QtCore.QRect(390, 10, 161, 151))
56+
self.Face_Label.setStyleSheet("border-style: solid;\n"
57+
"border-width: 1px;")
5058
self.Face_Label.setText("")
5159
self.Face_Label.setObjectName("Face_Label")
5260
self.EmojiLabel = QtWidgets.QLabel(self.centralwidget)
5361
self.EmojiLabel.setGeometry(QtCore.QRect(390, 170, 161, 151))
62+
self.EmojiLabel.setStyleSheet("border-style: solid;\n"
63+
"border-width: 1px;")
5464
self.EmojiLabel.setText("")
5565
self.EmojiLabel.setObjectName("EmojiLabel")
5666
self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget)
57-
self.gridLayoutWidget.setGeometry(QtCore.QRect(560, 10, 361, 401))
67+
self.gridLayoutWidget.setGeometry(QtCore.QRect(570, 0, 361, 481))
5868
self.gridLayoutWidget.setObjectName("gridLayoutWidget")
5969
self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget)
6070
self.gridLayout.setContentsMargins(0, 0, 0, 0)
6171
self.gridLayout.setObjectName("gridLayout")
6272
self.DetectOffBtn = QtWidgets.QPushButton(self.centralwidget)
63-
self.DetectOffBtn.setGeometry(QtCore.QRect(210, 320, 161, 91))
73+
self.DetectOffBtn.setGeometry(QtCore.QRect(210, 380, 161, 91))
6474
font = QtGui.QFont()
6575
font.setPointSize(28)
6676
self.DetectOffBtn.setFont(font)
6777
self.DetectOffBtn.setObjectName("DetectOffBtn")
6878
self.noticetext = QtWidgets.QTextBrowser(self.centralwidget)
6979
self.noticetext.setGeometry(QtCore.QRect(20, 170, 351, 101))
7080
self.noticetext.setObjectName("noticetext")
81+
self.online = QtWidgets.QLabel(self.centralwidget)
82+
self.online.setGeometry(QtCore.QRect(140, 320, 151, 41))
83+
font = QtGui.QFont()
84+
font.setPointSize(21)
85+
self.online.setFont(font)
86+
self.online.setStyleSheet("color:white")
87+
self.online.setObjectName("online")
88+
self.onlined = QtWidgets.QLabel(self.centralwidget)
89+
self.onlined.setGeometry(QtCore.QRect(30, 320, 151, 41))
90+
font = QtGui.QFont()
91+
font.setPointSize(21)
92+
self.onlined.setFont(font)
93+
self.onlined.setStyleSheet("color:white")
94+
self.onlined.setObjectName("onlined")
7195
MainWindow.setCentralWidget(self.centralwidget)
7296
self.menuBar = QtWidgets.QMenuBar(MainWindow)
7397
self.menuBar.setGeometry(QtCore.QRect(0, 0, 936, 24))
@@ -86,3 +110,5 @@ def retranslateUi(self, MainWindow):
86110
self.emtiontextlabel.setText(_translate("MainWindow", "Loading........"))
87111
self.DetectOffBtn.setText(_translate("MainWindow", "停止识别\n"
88112
"Stop"))
113+
self.online.setText(_translate("MainWindow", "Loading........"))
114+
self.onlined.setText(_translate("MainWindow", "网络状态:"))

0 commit comments

Comments
 (0)