-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mask_img_detect.py
211 lines (204 loc) · 12.6 KB
/
mask_img_detect.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mask_img_detect.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(1049, 656)
self.gridLayout_7 = QtWidgets.QGridLayout(Form)
self.gridLayout_7.setObjectName("gridLayout_7")
self.tabWidget = QtWidgets.QTabWidget(Form)
self.tabWidget.setObjectName("tabWidget")
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
self.gridLayout_4 = QtWidgets.QGridLayout(self.tab)
self.gridLayout_4.setObjectName("gridLayout_4")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.label_image = QtWidgets.QLabel(self.tab)
self.label_image.setMinimumSize(QtCore.QSize(0, 0))
self.label_image.setMaximumSize(QtCore.QSize(960, 800))
self.label_image.setText("")
self.label_image.setObjectName("label_image")
self.gridLayout.addWidget(self.label_image, 1, 1, 1, 1)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem, 0, 1, 1, 1)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem1, 1, 0, 1, 1)
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem2, 1, 2, 1, 1)
spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem3, 2, 1, 1, 1)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setContentsMargins(-1, 0, -1, 0)
self.horizontalLayout.setSpacing(20)
self.horizontalLayout.setObjectName("horizontalLayout")
spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem4)
self.pushButton_choose_model = QtWidgets.QPushButton(self.tab)
self.pushButton_choose_model.setMinimumSize(QtCore.QSize(100, 60))
self.pushButton_choose_model.setObjectName("pushButton_choose_model")
self.horizontalLayout.addWidget(self.pushButton_choose_model)
self.pushButton_openimg = QtWidgets.QPushButton(self.tab)
self.pushButton_openimg.setMinimumSize(QtCore.QSize(100, 60))
self.pushButton_openimg.setObjectName("pushButton_openimg")
self.horizontalLayout.addWidget(self.pushButton_openimg)
self.pushButton_detect = QtWidgets.QPushButton(self.tab)
self.pushButton_detect.setMinimumSize(QtCore.QSize(100, 60))
self.pushButton_detect.setObjectName("pushButton_detect")
self.horizontalLayout.addWidget(self.pushButton_detect)
spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem5)
self.horizontalLayout_2.addLayout(self.horizontalLayout)
self.gridLayout.addLayout(self.horizontalLayout_2, 3, 1, 1, 1)
self.verticalLayout.addLayout(self.gridLayout)
self.gridLayout_4.addLayout(self.verticalLayout, 0, 0, 1, 1)
self.tabWidget.addTab(self.tab, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.gridLayout_6 = QtWidgets.QGridLayout(self.tab_2)
self.gridLayout_6.setObjectName("gridLayout_6")
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.gridLayout_5 = QtWidgets.QGridLayout()
self.gridLayout_5.setObjectName("gridLayout_5")
self.label_image_2 = QtWidgets.QLabel(self.tab_2)
self.label_image_2.setMinimumSize(QtCore.QSize(0, 0))
self.label_image_2.setMaximumSize(QtCore.QSize(960, 800))
self.label_image_2.setText("")
self.label_image_2.setObjectName("label_image_2")
self.gridLayout_5.addWidget(self.label_image_2, 1, 1, 1, 1)
spacerItem6 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_5.addItem(spacerItem6, 0, 1, 1, 1)
spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_5.addItem(spacerItem7, 1, 0, 1, 1)
spacerItem8 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_5.addItem(spacerItem8, 1, 2, 1, 1)
spacerItem9 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_5.addItem(spacerItem9, 2, 1, 1, 1)
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setContentsMargins(-1, 0, -1, 0)
self.horizontalLayout_6.setSpacing(20)
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_6.addItem(spacerItem10)
self.pushButton_choose_model_2 = QtWidgets.QPushButton(self.tab_2)
self.pushButton_choose_model_2.setMinimumSize(QtCore.QSize(100, 60))
self.pushButton_choose_model_2.setObjectName("pushButton_choose_model_2")
self.horizontalLayout_6.addWidget(self.pushButton_choose_model_2)
self.pushButton_openvideo = QtWidgets.QPushButton(self.tab_2)
self.pushButton_openvideo.setMinimumSize(QtCore.QSize(100, 60))
self.pushButton_openvideo.setObjectName("pushButton_openvideo")
self.horizontalLayout_6.addWidget(self.pushButton_openvideo)
self.pushButton_opencamera = QtWidgets.QPushButton(self.tab_2)
self.pushButton_opencamera.setMinimumSize(QtCore.QSize(100, 60))
self.pushButton_opencamera.setObjectName("pushButton_opencamera")
self.horizontalLayout_6.addWidget(self.pushButton_opencamera)
spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_6.addItem(spacerItem11)
self.horizontalLayout_5.addLayout(self.horizontalLayout_6)
self.gridLayout_5.addLayout(self.horizontalLayout_5, 3, 1, 1, 1)
self.verticalLayout_3.addLayout(self.gridLayout_5)
self.gridLayout_6.addLayout(self.verticalLayout_3, 0, 0, 1, 1)
self.tabWidget.addTab(self.tab_2, "")
self.gridLayout_7.addWidget(self.tabWidget, 0, 0, 1, 1)
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.label = QtWidgets.QLabel(Form)
self.label.setMinimumSize(QtCore.QSize(0, 32))
self.label.setObjectName("label")
self.verticalLayout_2.addWidget(self.label)
self.label_model = QtWidgets.QLabel(Form)
self.label_model.setMinimumSize(QtCore.QSize(0, 32))
self.label_model.setText("")
self.label_model.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label_model.setObjectName("label_model")
self.verticalLayout_2.addWidget(self.label_model)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.label_3 = QtWidgets.QLabel(Form)
self.label_3.setMinimumSize(QtCore.QSize(0, 32))
self.label_3.setObjectName("label_3")
self.horizontalLayout_4.addWidget(self.label_3)
self.label_detect_device = QtWidgets.QLabel(Form)
self.label_detect_device.setMinimumSize(QtCore.QSize(0, 32))
self.label_detect_device.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.label_detect_device.setLayoutDirection(QtCore.Qt.LeftToRight)
self.label_detect_device.setText("")
self.label_detect_device.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label_detect_device.setObjectName("label_detect_device")
self.horizontalLayout_4.addWidget(self.label_detect_device)
self.verticalLayout_2.addLayout(self.horizontalLayout_4)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.label_2 = QtWidgets.QLabel(Form)
self.label_2.setMinimumSize(QtCore.QSize(0, 32))
self.label_2.setObjectName("label_2")
self.horizontalLayout_3.addWidget(self.label_2)
self.label_detect_time = QtWidgets.QLabel(Form)
self.label_detect_time.setMinimumSize(QtCore.QSize(0, 32))
self.label_detect_time.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.label_detect_time.setLayoutDirection(QtCore.Qt.LeftToRight)
self.label_detect_time.setText("")
self.label_detect_time.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.label_detect_time.setObjectName("label_detect_time")
self.horizontalLayout_3.addWidget(self.label_detect_time)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
self.groupBox = QtWidgets.QGroupBox(Form)
self.groupBox.setMinimumSize(QtCore.QSize(200, 0))
self.groupBox.setMaximumSize(QtCore.QSize(300, 16777215))
self.groupBox.setObjectName("groupBox")
self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox)
self.gridLayout_3.setObjectName("gridLayout_3")
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setObjectName("gridLayout_2")
self.tableWidget_result = QtWidgets.QTableWidget(self.groupBox)
self.tableWidget_result.setObjectName("tableWidget_result")
self.tableWidget_result.setColumnCount(1)
self.tableWidget_result.setRowCount(2)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_result.setVerticalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_result.setVerticalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget_result.setHorizontalHeaderItem(0, item)
self.tableWidget_result.verticalHeader().setCascadingSectionResizes(False)
self.gridLayout_2.addWidget(self.tableWidget_result, 0, 0, 1, 1)
self.gridLayout_3.addLayout(self.gridLayout_2, 0, 0, 1, 1)
self.verticalLayout_2.addWidget(self.groupBox)
self.gridLayout_7.addLayout(self.verticalLayout_2, 0, 1, 1, 1)
self.retranslateUi(Form)
self.tabWidget.setCurrentIndex(0)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.pushButton_choose_model.setText(_translate("Form", "选择模型"))
self.pushButton_openimg.setText(_translate("Form", "打开图片"))
self.pushButton_detect.setText(_translate("Form", "开始检测"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("Form", "Tab 1"))
self.pushButton_choose_model_2.setText(_translate("Form", "选择模型"))
self.pushButton_openvideo.setText(_translate("Form", "视频检测"))
self.pushButton_opencamera.setText(_translate("Form", "摄像头检测"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("Form", "Tab 2"))
self.label.setText(_translate("Form", " 使用模型:"))
self.label_3.setText(_translate("Form", " 使用设备:"))
self.label_2.setText(_translate("Form", " 检测时间:"))
self.groupBox.setTitle(_translate("Form", "检测结果:"))
item = self.tableWidget_result.verticalHeaderItem(0)
item.setText(_translate("Form", "带口罩"))
item = self.tableWidget_result.verticalHeaderItem(1)
item.setText(_translate("Form", "不戴口罩"))
item = self.tableWidget_result.horizontalHeaderItem(0)
item.setText(_translate("Form", "人数"))