win.py 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345
  1. # -*- coding: utf-8 -*-
  2. import math
  3. # Form implementation generated from reading ui file 'win.ui'
  4. #
  5. # Created by: PyQt5 UI code generator 5.15.4
  6. #
  7. # WARNING: Any manual changes made to this file will be lost when pyuic5 is
  8. # run again. Do not edit this file unless you know what you are doing.
  9. from PyQt5 import QtCore, QtGui, QtWidgets
  10. from PyQt5.QtCore import QTimer
  11. from PyQt5.QtWidgets import QMessageBox
  12. from PyQt5.QtGui import QPixmap, QIcon, QImage
  13. from PyQt5.QtWidgets import QLabel
  14. from PyQt5.QtCore import pyqtSignal
  15. from PyQt5.Qt import QPixmap, QPoint, Qt, QPainter, QIcon
  16. from PyQt5.QtWidgets import QWidget
  17. import cv2
  18. import json
  19. from name import CT_name_zh, CT_name # 演示用coco 后续换成
  20. import numpy as np
  21. class LabelMouse(QLabel):
  22. double_clicked = pyqtSignal()
  23. # 鼠标双击事件
  24. def mouseDoubleClickEvent(self, event):
  25. self.double_clicked.emit()
  26. def mouseMoveEvent(self):
  27. """
  28. 当鼠标划过标签label2时触发事件
  29. :return:
  30. """
  31. print('当鼠标划过标签label2时触发事件')
  32. def component_polygon_Circle_max(ih,iw, poly):
  33. # Calculate the distances to the contour
  34. box = cv2.boundingRect(poly[:, None, :])
  35. x, y, w, h = box
  36. raw_dist = np.empty([ih, iw])
  37. mask = np.zeros([ih, iw, 3], dtype=np.int32)
  38. cv2.fillPoly(mask, [poly.astype(np.int32)], color=(255, 255, 255)) # 在大图上画该类的所有检测多边形
  39. for i in range(x, x + w, ):
  40. for j in range(y, y + h, ):
  41. if mask[j, i, 0] == 255:
  42. raw_dist[j, i] = cv2.pointPolygonTest(poly[:, None:, ], (i, j), True)
  43. # 获取最大值即内接圆半径,中心点坐标
  44. _, maxVal, _, maxLoc = cv2.minMaxLoc(raw_dist)
  45. return maxVal * 2, maxLoc
  46. class Label_click_Mouse(QLabel):
  47. clicked = pyqtSignal()
  48. # # 鼠标点击事件
  49. # def mousePressEvent(self, event):
  50. # self.clicked.emit()
  51. # def __init__(self, *args, **kwargs):
  52. # super(Label_click_Mouse, self).__init__(*args, **kwargs)
  53. # #clicked = pyqtSignal()
  54. def __init__(self, *args, **kwargs):
  55. super(Label_click_Mouse, self).__init__(*args, **kwargs)
  56. self.frame = None
  57. self.scaled_img = None
  58. self.point = QPoint(0, 0) # [100,100]#
  59. self.scale = 1
  60. self.start_pos = None
  61. self.lstart_pos = None
  62. self.end_pos = None
  63. self.left_click = False
  64. self.json_file = ""
  65. self.lable_i = -1
  66. self.lable_click = False
  67. self.delta_scale = 1
  68. self.wheel = False
  69. self.text_lables = []
  70. self.lpoints = []
  71. #计算圆盘的像素长度
  72. self.circle_p1=QPoint(0,0)
  73. self.circle_p2 = QPoint(0, 0)
  74. self.gsd=0 #图像的分辨率
  75. # # 鼠标点击事件
  76. # def mousePressEvent(self, event):
  77. # self.clicked.emit()
  78. def set_init(self):
  79. # w = self.geometry().width()
  80. h = self.geometry().height()
  81. # self.point = QPoint(0, h//8) #[100,100]#
  82. self.point = QPoint(0, 0)
  83. self.scale = 1
  84. self.start_pos = None
  85. self.lstart_pos = None
  86. self.end_pos = None
  87. self.left_click = False
  88. self.lable_i = -1
  89. self.lable_click = False
  90. self.label_i = -1
  91. self.delta_scale = 1
  92. self.wheel = False
  93. print("set_init, len(self.lpoints): ", len(self.lpoints))
  94. #if len(self.lpoints)>0:
  95. len_=len(self.lpoints)
  96. for i in range(len_):
  97. print("del self.lpoints[:],i: ",i)
  98. #self.lpoints[len_ - 1 - i].hide()
  99. del self.lpoints[len_-1-i]
  100. self.lpoints=[]
  101. print("len(self.lpoints): ", len(self.lpoints))
  102. #if len(self.text_lables)>0:
  103. len_=len(self.text_lables)
  104. for i in range(len_):
  105. print("del self.text_lables[:],i: ",i)
  106. self.text_lables[len_ - 1 - i].hide()
  107. del self.text_lables[len_-1-i]
  108. self.text_lables = []
  109. print("len(self.text_lables): ", len(self.text_lables))
  110. self.segments=[]
  111. def set_image(self, img_path, json_file=""):
  112. """
  113. open image file
  114. :param img_path: image file path
  115. :return:
  116. """
  117. # img = QImageReader(img_path)
  118. # img.setScaledSize(QSize(self.size().width(), self.size().height()))
  119. # img = img.read()
  120. # img = cv2.imread(img_path)
  121. # self.set_point(img.shape[0],img.shape[1])
  122. # print("准备执行set_image 函数")
  123. self.set_init()
  124. self.json_file = json_file
  125. # print("img_path: ", type(img_path))
  126. if isinstance(img_path, str):
  127. self.img = QPixmap(img_path)
  128. else:
  129. h, w, d = img_path.shape
  130. img_path = cv2.cvtColor(img_path, cv2.COLOR_BGR2RGB)
  131. img_path = QImage(img_path.data, w, h, w * d, QImage.Format_RGB888)
  132. self.img = QPixmap(img_path)
  133. w = self.geometry().width()
  134. h = self.geometry().height()
  135. ih, iw = self.img.height(), self.img.width()
  136. # print(ih, iw)
  137. # # 保持纵横比
  138. # 找出短边
  139. if w < h:
  140. self.scale = w / iw
  141. else:
  142. self.scale = h / ih
  143. # print("scal, w,iw,h,ih: ", scal,w,iw,h,ih)
  144. # self.scale=scal
  145. if self.json_file:
  146. self.scaled_segments = []
  147. self.segments = []
  148. self.class_id = []
  149. self.class_name = []
  150. self.infos=[]
  151. # self.text_lables = []
  152. # self.lpoints = []
  153. new_dict = {v: k for k, v in CT_name.items()}
  154. with open(self.json_file, 'r') as f:
  155. data = json.load(f)
  156. class_number = data['shapes'] # 类型个数
  157. i =0
  158. for cn in class_number:
  159. #CT_name_zh = {'crack': '裂纹', 'hole': '孔洞', 'debonding': '脱粘','rarefaction': '疏松'}
  160. if cn['label'] in list(CT_name_zh.keys()):
  161. # segments.append(np.array(cn['points'],dtype=np.float32)) #获取每个轮廓点
  162. segment=np.array(cn['points'], dtype=np.int32)
  163. self.segments.append(segment)
  164. if cn['label'] in ["hole","rarefaction"]:
  165. area = round(cv2.contourArea(segment)*self.gsd*self.gsd, 1)
  166. width= round(math.sqrt(4*area/math.pi), 1)
  167. #width = int(width * self.gsd)
  168. self.infos.append("(A: " + str(area) + "mm²; W: " + str(width) + "mm)")
  169. else:
  170. lenth = round(cv2.arcLength(segment, True) / 2*self.gsd, 1)
  171. # 计算宽度
  172. width, maxLoc = component_polygon_Circle_max(ih,iw, segment)
  173. width=round(width*self.gsd, 1)
  174. self.infos.append("(L: " + str(lenth) + "mm; W: " + str(width) + "mm)")
  175. self.class_name.append(CT_name_zh[cn['label']]) # 获取对应的class name
  176. self.class_id.append(new_dict[cn['label']]) # 获取对应的class id
  177. self.text_lables.append(QtWidgets.QLabel(self))
  178. #self.layout().addWidget(self.text_lables[i])
  179. self.lpoints.append(QPoint(0, 0))
  180. #self.layout().addWidget(self.lpoints[i])
  181. i +=1
  182. self.textSize = int(0.04 * self.img.height())
  183. self.resize_seg()
  184. self.resize_img()
  185. self.repaint()
  186. def resize_seg(self):
  187. self.scaled_segments = []
  188. # print("self.label_i before self.lpoints[self.label_i]: ", 5, self.lpoints[5].x(), self.lpoints[5].y(),self.delta_scale)
  189. for i in range(len(self.segments)):
  190. self.scaled_segments.append(self.segments[i] * self.scale)
  191. self.scaled_textSize = int(self.scale * self.textSize)
  192. # self.lpoints[i] *=self.scale
  193. # print("self.label_i after self.lpoints[self.label_i]: ", 5, self.lpoints[5].x(), self.lpoints[5].y())
  194. # print("self.scaled_segments: ", self.scaled_segments)
  195. def resize_img(self):
  196. ih, iw = self.img.height(), self.img.width()
  197. new_w = int(iw * self.scale)
  198. new_h = int(ih * self.scale)
  199. # print(new_w, new_h)
  200. self.scaled_img = self.img.scaled(new_w, new_h, Qt.KeepAspectRatio,
  201. Qt.SmoothTransformation) # ,aspectRatioMode= Qt.AspectRatioMode,transformMode = Qt.SmoothTransformation
  202. def paintEvent(self, event):
  203. if self.scaled_img:
  204. # print("准备执行resize_img函数")
  205. self.resize_img()
  206. painter = QPainter()
  207. painter.begin(self)
  208. # painter.scale(self.scale, self.scale)
  209. painter.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
  210. painter.drawPixmap(self.point, self.scaled_img)
  211. if self.json_file != "":
  212. self.resize_seg()
  213. painter.setPen(QtGui.QColor(167, 255, 100))
  214. # painter.setFont(QtGui.QFont('simhei',self.scaled_textSize))
  215. # painter.drawText(self.point,"你好")
  216. #
  217. # print(len(self.scaled_segments), len(self.class_name), len(self.class_id))
  218. for i in range(len(self.scaled_segments)):
  219. xy_index = np.argmin(self.scaled_segments[i], axis=0) # 其中,axis=1表示按行计算
  220. x = self.scaled_segments[i][xy_index[1], 0]
  221. y = self.scaled_segments[i][xy_index[1], 1]
  222. s = "font-size: " + str(self.scaled_textSize) + "px;font-weight: 500;font-family:'Microsoft Yahei UI'; color:red;border: 1px solid green;"
  223. # print("self.scaled_textSize: ", self.scaled_textSize)
  224. self.text_lables[i].setText(self.class_name[i]+self.infos[i])
  225. self.text_lables[i].setStyleSheet(s)
  226. # self.text_lables[i].move(int(self.point.x() + self.lpoints[i].x()+x), int(self.point.y() + self.lpoints[i].y()+y))
  227. self.text_lables[i].move(int(self.point.x() + self.lpoints[i].x() + x),
  228. int(self.point.y() + self.lpoints[i].y() + y))
  229. #if self.wheel and i == 5:
  230. # self.text_lables[i].move(10,10)#(245, 302)
  231. #print(" delta_scale: ", self.delta_scale)
  232. #print(" move: ", self.point.x() + self.lpoints[i].x() + x,
  233. # self.point.y() + self.lpoints[i].y() + y)
  234. #print(" move: ", self.point.x(), self.lpoints[i].x(), x, self.point.y(), self.lpoints[i].y(), y)
  235. # print(int(self.lpoint.x()+x), int(self.lpoint.y()+y))
  236. self.text_lables[i].adjustSize()
  237. self.text_lables[i].show()
  238. painter.drawLine(int(self.point.x() + self.lpoints[i].x() + x),
  239. int(self.point.y() + self.lpoints[i].y() + y), int(self.point.x() + x),
  240. int(self.point.y() + y),)
  241. painter.end()
  242. def wheelEvent(self, event):
  243. angle = event.angleDelta() / 8 # 返回QPoint对象,为滚轮转过的数值,单位为1/8度
  244. angleY = angle.y()
  245. # 获取当前鼠标相对于view的位置
  246. if angleY > 0:
  247. self.delta_scale = 1.1
  248. # self.wheel_n +=1
  249. self.scale *= 1.1
  250. else: # 滚轮下滚
  251. self.delta_scale = 0.9
  252. # self.wheel_n -= 1
  253. self.scale *= 0.9
  254. # self.scale *=self.delta_scale
  255. # print("self.delta_scale: ", self.delta_scale)
  256. self.wheel = True
  257. # ih, iw = self.img.height(), self.img.width()
  258. # new_w = int(iw * self.scale)
  259. # new_h = int(ih * self.scale)
  260. # self.delta_scale = new_w/self.scaled_img.width() #保持直线长度和图片尺寸的比例不变,这样缩放图的时候直线才会等比例缩放
  261. for i in range(len(self.segments)):
  262. #print("self.delta_scale: ", self.delta_scale)
  263. self.lpoints[i] *= self.delta_scale
  264. self.repaint()
  265. #print("wheelEvent: ", self.lpoints[5].x(), self.scaled_img.width(),
  266. # self.lpoints[5].x() / self.scaled_img.width())
  267. self.wheel = False
  268. def mouseMoveEvent(self, e):
  269. """
  270. mouse move events for the widget
  271. :param e: QMouseEvent
  272. :return:
  273. """
  274. # print("e.pos(): ",e.pos())
  275. if self.left_click:
  276. if not self.lable_click: # 鼠标左键按下并且移到鼠标
  277. self.end_pos = e.pos() - self.start_pos
  278. # self.lend_pos = e.pos() - self.lstart_pos
  279. # print("e.pos(),self.start_pos,self.end_pos: ", e.pos(),self.start_pos,self.end_pos)
  280. self.point = self.point + self.end_pos
  281. # for i in range(len(self.text_lables)):
  282. # self.lpoints[i]=self.lpoints[i] + self.lend_pos
  283. self.start_pos = e.pos()
  284. # self.lstart_pos = e.pos()
  285. self.repaint()
  286. else: # 鼠标点在了文字内,并且移动鼠标
  287. end_pos = e.pos() - self.lstart_pos
  288. # print("self.lpoints[self.label_i], self.label_i:", self.lstart_pos, self.lpoints[self.label_i],self.label_i)
  289. self.lpoints[self.label_i] = self.lpoints[self.label_i] + end_pos
  290. #print("mouseMoveEvent self.lpoints[self.label_i].x(),self.lpoints[self.label_i].y() : ",
  291. # self.lpoints[self.label_i].x(), self.lpoints[self.label_i].y())
  292. self.lstart_pos = e.pos()
  293. self.repaint()
  294. def mousePressEvent(self, e): # 鼠标左键按下事件
  295. """
  296. mouse press events for the widget
  297. :param e: QMouseEvent
  298. :return:
  299. """
  300. if e.button() == Qt.LeftButton:
  301. self.left_click = True
  302. self.start_pos = e.pos()
  303. self.lstart_pos = e.pos()
  304. if self.json_file != "":
  305. print("鼠标左键按下,len(self.text_lables):", len(self.text_lables),self.class_name)
  306. for i in range(len(self.text_lables)):
  307. x = self.text_lables[i].x()
  308. y = self.text_lables[i].y()
  309. w = self.text_lables[i].size().width()
  310. h = self.text_lables[i].size().height()
  311. # print(x,y,w,h)
  312. if e.pos().x() > x and e.pos().x() < x + w and e.pos().y() > y and e.pos().y() < y + h:
  313. print(f"鼠标点在了第{i}个框内,{self.class_name[i]}")
  314. self.lable_click = True
  315. self.label_i = i
  316. break
  317. def mouseReleaseEvent(self, e):
  318. """
  319. mouse release events for the widget
  320. :param e: QMouseEvent
  321. :return:
  322. """
  323. if e.button() == Qt.LeftButton:
  324. self.left_click = False
  325. self.lable_click = False
  326. self.label_i = -1
  327. # print("mouseReleaseEvent: ",self.lpoints[5].x(), self.scaled_img.width(),
  328. # self.lpoints[5].x() / self.scaled_img.width())
  329. self.circle_p1=self.circle_p2
  330. self.circle_p2 =e.pos()/self.scale
  331. # 单按钮对话框,出现到指定时长后自动消失
  332. class MessageBox(QMessageBox):
  333. def __init__(self, *args, title='提示', count=1, time=1000, auto=False, **kwargs):
  334. super(MessageBox, self).__init__(*args, **kwargs)
  335. self._count = count
  336. self._time = time
  337. self._auto = auto # 是否自动关闭
  338. assert count > 0 # 必须大于0
  339. assert time >= 500 # 必须>=500毫秒
  340. self.setStyleSheet('''
  341. QDialog{background:rgb(75, 75, 75);
  342. color:white;}
  343. QLabel{color:white;
  344. background: rgb(75, 75, 75);
  345. font-size: 15px;
  346. font-weight: light;
  347. color:white;}''')
  348. self.setWindowTitle(title)
  349. self.setIconPixmap(QPixmap(":/img/icon/笑脸.png"))
  350. self.setStandardButtons(self.Close) # 关闭按钮
  351. self.closeBtn = self.button(self.Close) # 获取关闭按钮
  352. self.closeBtn.setText('关闭')
  353. self.closeBtn.setVisible(False)
  354. self._timer = QTimer(self, timeout=self.doCountDown)
  355. self._timer.start(self._time)
  356. def doCountDown(self):
  357. # self.closeBtn.setText('关闭(%s)' % self._count)
  358. self._count -= 1
  359. if self._count <= 0:
  360. # self.closeBtn.setText('关闭')
  361. # self.closeBtn.setEnabled(True)
  362. self._timer.stop()
  363. if self._auto: # 自动关闭
  364. self.accept()
  365. self.close()
  366. class InfoMessageBox(QMessageBox):
  367. def __init__(self, *args, **kwargs):
  368. super(MessageBox, self).__init__(*args, **kwargs)
  369. self.setStyleSheet('''
  370. QDialog{background:rgb(75, 75, 75);
  371. color:white;}
  372. QLabel{color:white;
  373. background: rgb(75, 75, 75);
  374. font-size: 15px;
  375. font-weight: light;
  376. color:white;}''')
  377. # self.setWindowTitle(title)
  378. self.setIconPixmap(QPixmap(":/img/icon/笑脸.png"))
  379. # self.setStandardButtons(self.Close) # 关闭按钮
  380. # self.closeBtn = self.button(self.Close) # 获取关闭按钮
  381. # self.closeBtn.setText('关闭')
  382. # self.closeBtn.setVisible(False)
  383. class ImageBox(QWidget):
  384. def __init__(self):
  385. super(ImageBox, self).__init__()
  386. self.img = None
  387. self.scaled_img = None
  388. self.point = QPoint(0, 0)
  389. self.start_pos = None
  390. self.end_pos = None
  391. self.left_click = False
  392. self.scale = 1
  393. # def init_ui(self):
  394. # self.setWindowTitle("ImageBox")
  395. def set_point(self, w, h):
  396. self.point = QPoint(w // 2, h // 2)
  397. def set_image(self, img_path):
  398. """
  399. open image file
  400. :param img_path: image file path
  401. :return:
  402. """
  403. # img = QImageReader(img_path)
  404. # img.setScaledSize(QSize(self.size().width(), self.size().height()))
  405. # img = img.read()
  406. self.img = img_path # QPixmap(img_path)
  407. self.scaled_img = self.img
  408. def paintEvent(self, e):
  409. """
  410. receive paint events
  411. :param e: QPaintEvent
  412. :return:
  413. """
  414. if self.scaled_img:
  415. painter = QPainter()
  416. painter.begin(self)
  417. painter.scale(self.scale, self.scale)
  418. painter.drawPixmap(self.point, self.scaled_img)
  419. painter.end()
  420. def wheelEvent(self, event):
  421. angle = event.angleDelta() / 8 # 返回QPoint对象,为滚轮转过的数值,单位为1/8度
  422. angleY = angle.y()
  423. # 获取当前鼠标相对于view的位置
  424. if angleY > 0:
  425. self.scale *= 1.1
  426. else: # 滚轮下滚
  427. self.scale *= 0.9
  428. self.adjustSize()
  429. self.update()
  430. def mouseMoveEvent(self, e):
  431. """
  432. mouse move events for the widget
  433. :param e: QMouseEvent
  434. :return:
  435. """
  436. if self.left_click:
  437. self.end_pos = e.pos() - self.start_pos
  438. self.point = self.point + self.end_pos
  439. self.start_pos = e.pos()
  440. self.repaint()
  441. def mousePressEvent(self, e):
  442. """
  443. mouse press events for the widget
  444. :param e: QMouseEvent
  445. :return:
  446. """
  447. if e.button() == Qt.LeftButton:
  448. self.left_click = True
  449. self.start_pos = e.pos()
  450. def mouseReleaseEvent(self, e):
  451. """
  452. mouse release events for the widget
  453. :param e: QMouseEvent
  454. :return:
  455. """
  456. if e.button() == Qt.LeftButton:
  457. self.left_click = False
  458. class Ui_mainWindow(object):
  459. def setupUi(self, mainWindow):
  460. mainWindow.setObjectName("mainWindow")
  461. mainWindow.resize(1319, 762)
  462. mainWindow.setMouseTracking(True)
  463. icon = QtGui.QIcon()
  464. icon.addPixmap(QtGui.QPixmap(":/img/icon/图片1.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
  465. mainWindow.setWindowIcon(icon)
  466. mainWindow.setStyleSheet("#mainWindow{border:none;}")
  467. self.centralwidget = QtWidgets.QWidget(mainWindow)
  468. self.centralwidget.setObjectName("centralwidget")
  469. self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralwidget)
  470. self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
  471. self.verticalLayout_2.setSpacing(0)
  472. self.verticalLayout_2.setObjectName("verticalLayout_2")
  473. self.groupBox_18 = QtWidgets.QGroupBox(self.centralwidget)
  474. self.groupBox_18.setStyleSheet("#groupBox_18{border-image: url(:/img/icon/background.jpg);\n"
  475. "border: 0px solid #42adff;\n"
  476. "border-radius:5px;}")
  477. self.groupBox_18.setTitle("")
  478. self.groupBox_18.setObjectName("groupBox_18")
  479. self.verticalLayout_6 = QtWidgets.QVBoxLayout(self.groupBox_18)
  480. self.verticalLayout_6.setContentsMargins(0, 0, 0, 0)
  481. self.verticalLayout_6.setSpacing(0)
  482. self.verticalLayout_6.setObjectName("verticalLayout_6")
  483. self.groupBox = QtWidgets.QGroupBox(self.groupBox_18)
  484. self.groupBox.setMinimumSize(QtCore.QSize(0, 45))
  485. self.groupBox.setMaximumSize(QtCore.QSize(16777215, 45))
  486. self.groupBox.setStyleSheet("#groupBox{\n"
  487. "background-color: rgba(75, 75, 75, 200);\n"
  488. "border: 0px solid #42adff;\n"
  489. "border-left: 0px solid rgba(29, 83, 185, 255);\n"
  490. "border-right: 0px solid rgba(29, 83, 185, 255);\n"
  491. "border-bottom: 1px solid rgba(200, 200, 200,100);\n"
  492. ";\n"
  493. "border-radius:0px;}")
  494. self.groupBox.setTitle("")
  495. self.groupBox.setObjectName("groupBox")
  496. self.horizontalLayout = QtWidgets.QHBoxLayout(self.groupBox)
  497. self.horizontalLayout.setContentsMargins(-1, 0, -1, 0)
  498. self.horizontalLayout.setSpacing(0)
  499. self.horizontalLayout.setObjectName("horizontalLayout")
  500. self.label_4 = QtWidgets.QLabel(self.groupBox)
  501. self.label_4.setStyleSheet("QLabel\n"
  502. "{\n"
  503. " font-size: 24px;\n"
  504. " font-family: \"Microsoft YaHei\";\n"
  505. " font-weight: bold;\n"
  506. " border-radius:9px;\n"
  507. " background:rgba(66, 195, 255, 0);\n"
  508. "color: rgb(218, 218, 218);\n"
  509. "}\n"
  510. "")
  511. self.label_4.setObjectName("label_4")
  512. self.horizontalLayout.addWidget(self.label_4)
  513. spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
  514. self.horizontalLayout.addItem(spacerItem)
  515. self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
  516. self.horizontalLayout_5.setSpacing(0)
  517. self.horizontalLayout_5.setObjectName("horizontalLayout_5")
  518. self.minButton = QtWidgets.QPushButton(self.groupBox)
  519. self.minButton.setMinimumSize(QtCore.QSize(50, 28))
  520. self.minButton.setMaximumSize(QtCore.QSize(50, 28))
  521. self.minButton.setStyleSheet("QPushButton {\n"
  522. "border-style: solid;\n"
  523. "border-width: 0px;\n"
  524. "border-radius: 0px;\n"
  525. "background-color: rgba(223, 223, 223, 0);}\n"
  526. "QPushButton::focus{outline: none;}\n"
  527. "QPushButton::hover {\n"
  528. "border-style: solid;\n"
  529. "border-width: 0px;\n"
  530. "border-radius: 0px;\n"
  531. "background-color: rgba(223, 223, 223, 150);}")
  532. self.minButton.setText("")
  533. icon1 = QtGui.QIcon()
  534. icon1.addPixmap(QtGui.QPixmap(":/img/icon/最小化.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
  535. self.minButton.setIcon(icon1)
  536. self.minButton.setObjectName("minButton")
  537. self.horizontalLayout_5.addWidget(self.minButton)
  538. self.maxButton = QtWidgets.QPushButton(self.groupBox)
  539. self.maxButton.setMinimumSize(QtCore.QSize(50, 28))
  540. self.maxButton.setMaximumSize(QtCore.QSize(50, 28))
  541. self.maxButton.setStyleSheet("QPushButton {\n"
  542. "border-style: solid;\n"
  543. "border-width: 0px;\n"
  544. "border-radius: 0px;\n"
  545. "background-color: rgba(223, 223, 223, 0);}\n"
  546. "QPushButton::focus{outline: none;}\n"
  547. "QPushButton::hover {\n"
  548. "border-style: solid;\n"
  549. "border-width: 0px;\n"
  550. "border-radius: 0px;\n"
  551. "background-color: rgba(223, 223, 223, 150);}")
  552. self.maxButton.setText("")
  553. icon2 = QtGui.QIcon()
  554. icon2.addPixmap(QtGui.QPixmap(":/img/icon/正方形.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
  555. icon2.addPixmap(QtGui.QPixmap(":/img/icon/还原.png"), QtGui.QIcon.Active, QtGui.QIcon.On)
  556. icon2.addPixmap(QtGui.QPixmap(":/img/icon/还原.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
  557. self.maxButton.setIcon(icon2)
  558. self.maxButton.setCheckable(True)
  559. self.maxButton.setObjectName("maxButton")
  560. self.horizontalLayout_5.addWidget(self.maxButton)
  561. self.closeButton = QtWidgets.QPushButton(self.groupBox)
  562. self.closeButton.setMinimumSize(QtCore.QSize(50, 28))
  563. self.closeButton.setMaximumSize(QtCore.QSize(50, 28))
  564. self.closeButton.setStyleSheet("QPushButton {\n"
  565. "border-style: solid;\n"
  566. "border-width: 0px;\n"
  567. "border-radius: 0px;\n"
  568. "background-color: rgba(223, 223, 223, 0);}\n"
  569. "QPushButton::focus{outline: none;}\n"
  570. "QPushButton::hover {\n"
  571. "border-style: solid;\n"
  572. "border-width: 0px;\n"
  573. "border-radius: 0px;\n"
  574. "background-color: rgba(223, 223, 223, 150);}")
  575. self.closeButton.setText("")
  576. icon3 = QtGui.QIcon()
  577. icon3.addPixmap(QtGui.QPixmap(":/img/icon/关闭.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
  578. self.closeButton.setIcon(icon3)
  579. self.closeButton.setObjectName("closeButton")
  580. self.horizontalLayout_5.addWidget(self.closeButton)
  581. self.horizontalLayout.addLayout(self.horizontalLayout_5)
  582. self.verticalLayout_6.addWidget(self.groupBox)
  583. self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
  584. self.horizontalLayout_7.setSpacing(0)
  585. self.horizontalLayout_7.setObjectName("horizontalLayout_7")
  586. self.groupBox_8 = QtWidgets.QGroupBox(self.groupBox_18)
  587. self.groupBox_8.setMinimumSize(QtCore.QSize(320, 0))
  588. self.groupBox_8.setMaximumSize(QtCore.QSize(320, 16777215))
  589. self.groupBox_8.setBaseSize(QtCore.QSize(3, 0))
  590. self.groupBox_8.setStyleSheet("#groupBox_8{\n"
  591. "background-color: rgba(75, 75, 75, 200);\n"
  592. "border: 0px solid #42adff;\n"
  593. "border-radius:0px;}\n"
  594. "")
  595. self.groupBox_8.setTitle("")
  596. self.groupBox_8.setObjectName("groupBox_8")
  597. self.layoutWidget = QtWidgets.QWidget(self.groupBox_8)
  598. self.layoutWidget.setGeometry(QtCore.QRect(10, 500, 211, 37))
  599. self.layoutWidget.setObjectName("layoutWidget")
  600. self.horizontalLayout_13 = QtWidgets.QHBoxLayout(self.layoutWidget)
  601. self.horizontalLayout_13.setContentsMargins(0, 0, 0, 0)
  602. self.horizontalLayout_13.setObjectName("horizontalLayout_13")
  603. self.label_8 = QtWidgets.QLabel(self.layoutWidget)
  604. self.label_8.setMinimumSize(QtCore.QSize(0, 35))
  605. self.label_8.setMaximumSize(QtCore.QSize(80, 16777215))
  606. self.label_8.setStyleSheet("QLabel\n"
  607. "{\n"
  608. " font-size: 18px;\n"
  609. " font-family: \"Microsoft YaHei\";\n"
  610. " font-weight: bold;\n"
  611. " border-radius:9px;\n"
  612. " background:rgba(66, 195, 255, 0);\n"
  613. "color: rgb(218, 218, 218);\n"
  614. "}\n"
  615. "")
  616. self.label_8.setObjectName("label_8")
  617. self.horizontalLayout_13.addWidget(self.label_8)
  618. self.beicepin = QtWidgets.QLineEdit(self.layoutWidget)
  619. self.beicepin.setObjectName("beicepin")
  620. self.horizontalLayout_13.addWidget(self.beicepin)
  621. self.layoutWidget_2 = QtWidgets.QWidget(self.groupBox_8)
  622. self.layoutWidget_2.setGeometry(QtCore.QRect(10, 540, 211, 37))
  623. self.layoutWidget_2.setObjectName("layoutWidget_2")
  624. self.horizontalLayout_14 = QtWidgets.QHBoxLayout(self.layoutWidget_2)
  625. self.horizontalLayout_14.setContentsMargins(0, 0, 0, 0)
  626. self.horizontalLayout_14.setObjectName("horizontalLayout_14")
  627. self.label_12 = QtWidgets.QLabel(self.layoutWidget_2)
  628. self.label_12.setMinimumSize(QtCore.QSize(0, 35))
  629. self.label_12.setMaximumSize(QtCore.QSize(80, 16777215))
  630. self.label_12.setStyleSheet("QLabel\n"
  631. "{\n"
  632. " font-size: 18px;\n"
  633. " font-family: \"Microsoft YaHei\";\n"
  634. " font-weight: bold;\n"
  635. " border-radius:9px;\n"
  636. " background:rgba(66, 195, 255, 0);\n"
  637. "color: rgb(218, 218, 218);\n"
  638. "}\n"
  639. "")
  640. self.label_12.setObjectName("label_12")
  641. self.horizontalLayout_14.addWidget(self.label_12)
  642. self.pici = QtWidgets.QLineEdit(self.layoutWidget_2)
  643. self.pici.setObjectName("pici")
  644. self.horizontalLayout_14.addWidget(self.pici)
  645. self.choose_circle = QtWidgets.QPushButton(self.groupBox_8)
  646. self.choose_circle.setGeometry(QtCore.QRect(200, 600, 76, 21))
  647. self.choose_circle.setObjectName("choose_circle")
  648. self.layoutWidget_3 = QtWidgets.QWidget(self.groupBox_8)
  649. self.layoutWidget_3.setGeometry(QtCore.QRect(10, 590, 174, 37))
  650. self.layoutWidget_3.setObjectName("layoutWidget_3")
  651. self.horizontalLayout_15 = QtWidgets.QHBoxLayout(self.layoutWidget_3)
  652. self.horizontalLayout_15.setContentsMargins(0, 0, 0, 0)
  653. self.horizontalLayout_15.setObjectName("horizontalLayout_15")
  654. self.label_13 = QtWidgets.QLabel(self.layoutWidget_3)
  655. self.label_13.setMinimumSize(QtCore.QSize(0, 35))
  656. self.label_13.setMaximumSize(QtCore.QSize(80, 16777215))
  657. self.label_13.setStyleSheet("QLabel\n"
  658. "{\n"
  659. " font-size: 18px;\n"
  660. " font-family: \"Microsoft YaHei\";\n"
  661. " font-weight: bold;\n"
  662. " border-radius:9px;\n"
  663. " background:rgba(66, 195, 255, 0);\n"
  664. "color: rgb(218, 218, 218);\n"
  665. "}\n"
  666. "")
  667. self.label_13.setObjectName("label_13")
  668. self.horizontalLayout_15.addWidget(self.label_13)
  669. self.zhijing = QtWidgets.QLineEdit(self.layoutWidget_3)
  670. self.zhijing.setMinimumSize(QtCore.QSize(60, 0))
  671. self.zhijing.setMaximumSize(QtCore.QSize(60, 16777215))
  672. self.zhijing.setObjectName("zhijing")
  673. self.horizontalLayout_15.addWidget(self.zhijing)
  674. self.label_14 = QtWidgets.QLabel(self.layoutWidget_3)
  675. self.label_14.setMinimumSize(QtCore.QSize(0, 35))
  676. self.label_14.setMaximumSize(QtCore.QSize(80, 16777215))
  677. self.label_14.setStyleSheet("QLabel\n"
  678. "{\n"
  679. " font-size: 14px;\n"
  680. " font-family: \"Microsoft YaHei\";\n"
  681. " font-weight: bold;\n"
  682. " border-radius:9px;\n"
  683. " background:rgba(66, 195, 255, 0);\n"
  684. "color: rgb(218, 218, 218);\n"
  685. "}\n"
  686. "")
  687. self.label_14.setObjectName("label_14")
  688. self.horizontalLayout_15.addWidget(self.label_14)
  689. self.layoutWidget_4 = QtWidgets.QWidget(self.groupBox_8)
  690. self.layoutWidget_4.setGeometry(QtCore.QRect(10, 640, 211, 37))
  691. self.layoutWidget_4.setObjectName("layoutWidget_4")
  692. self.horizontalLayout_16 = QtWidgets.QHBoxLayout(self.layoutWidget_4)
  693. self.horizontalLayout_16.setContentsMargins(0, 0, 0, 0)
  694. self.horizontalLayout_16.setObjectName("horizontalLayout_16")
  695. self.label_15 = QtWidgets.QLabel(self.layoutWidget_4)
  696. self.label_15.setMinimumSize(QtCore.QSize(0, 35))
  697. self.label_15.setMaximumSize(QtCore.QSize(80, 16777215))
  698. self.label_15.setStyleSheet("QLabel\n"
  699. "{\n"
  700. " font-size: 18px;\n"
  701. " font-family: \"Microsoft YaHei\";\n"
  702. " font-weight: bold;\n"
  703. " border-radius:9px;\n"
  704. " background:rgba(66, 195, 255, 0);\n"
  705. "color: rgb(218, 218, 218);\n"
  706. "}\n"
  707. "")
  708. self.label_15.setObjectName("label_15")
  709. self.horizontalLayout_16.addWidget(self.label_15)
  710. self.gsd = QtWidgets.QLineEdit(self.layoutWidget_4)
  711. sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
  712. sizePolicy.setHorizontalStretch(1)
  713. sizePolicy.setVerticalStretch(0)
  714. sizePolicy.setHeightForWidth(self.gsd.sizePolicy().hasHeightForWidth())
  715. self.gsd.setSizePolicy(sizePolicy)
  716. self.gsd.setMinimumSize(QtCore.QSize(60, 0))
  717. self.gsd.setMaximumSize(QtCore.QSize(50, 16777215))
  718. font = QtGui.QFont()
  719. font.setKerning(True)
  720. self.gsd.setFont(font)
  721. self.gsd.setObjectName("gsd")
  722. self.horizontalLayout_16.addWidget(self.gsd)
  723. self.label_16 = QtWidgets.QLabel(self.layoutWidget_4)
  724. self.label_16.setMinimumSize(QtCore.QSize(0, 35))
  725. self.label_16.setMaximumSize(QtCore.QSize(80, 16777215))
  726. self.label_16.setStyleSheet("QLabel\n"
  727. "{\n"
  728. " font-size: 14px;\n"
  729. " font-family: \"Microsoft YaHei\";\n"
  730. " font-weight: bold;\n"
  731. " border-radius:9px;\n"
  732. " background:rgba(66, 195, 255, 0);\n"
  733. "color: rgb(218, 218, 218);\n"
  734. "}\n"
  735. "")
  736. self.label_16.setObjectName("label_16")
  737. self.horizontalLayout_16.addWidget(self.label_16)
  738. self.layoutWidget1 = QtWidgets.QWidget(self.groupBox_8)
  739. self.layoutWidget1.setGeometry(QtCore.QRect(90, 20, 182, 37))
  740. self.layoutWidget1.setObjectName("layoutWidget1")
  741. self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.layoutWidget1)
  742. self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
  743. self.horizontalLayout_2.setObjectName("horizontalLayout_2")
  744. self.detectbutton = QtWidgets.QPushButton(self.layoutWidget1)
  745. self.detectbutton.setMinimumSize(QtCore.QSize(55, 28))
  746. self.detectbutton.setMaximumSize(QtCore.QSize(16777215, 28))
  747. self.detectbutton.setStyleSheet("QPushButton{font-family: \"Microsoft YaHei\";\n"
  748. "font-size: 14px;\n"
  749. "font-weight: bold;\n"
  750. "color:white;\n"
  751. "text-align: center center;\n"
  752. "padding-left: 5px;\n"
  753. "padding-right: 5px;\n"
  754. "padding-top: 4px;\n"
  755. "padding-bottom: 4px;\n"
  756. "border-style: solid;\n"
  757. "border-width: 0px;\n"
  758. "border-color: rgba(255, 255, 255, 255);\n"
  759. "border-radius: 3px;\n"
  760. "background-color: rgba(48,148,243,0);}\n"
  761. "\n"
  762. "QPushButton:focus{outline: none;}\n"
  763. "\n"
  764. "QPushButton::pressed{font-family: \"Microsoft YaHei\";\n"
  765. " font-size: 14px;\n"
  766. " font-weight: bold;\n"
  767. " color:rgb(200,200,200);\n"
  768. " text-align: center center;\n"
  769. " padding-left: 5px;\n"
  770. " padding-right: 5px;\n"
  771. " padding-top: 4px;\n"
  772. " padding-bottom: 4px;\n"
  773. " border-style: solid;\n"
  774. " border-width: 0px;\n"
  775. " border-color: rgba(255, 255, 255, 255);\n"
  776. " border-radius: 3px;\n"
  777. " background-color: #bf513b;}\n"
  778. "\n"
  779. "QPushButton::disabled{font-family: \"Microsoft YaHei\";\n"
  780. " font-size: 14px;\n"
  781. " font-weight: bold;\n"
  782. " color:rgb(200,200,200);\n"
  783. " text-align: center center;\n"
  784. " padding-left: 5px;\n"
  785. " padding-right: 5px;\n"
  786. " padding-top: 4px;\n"
  787. " padding-bottom: 4px;\n"
  788. " border-style: solid;\n"
  789. " border-width: 0px;\n"
  790. " border-color: rgba(255, 255, 255, 255);\n"
  791. " border-radius: 3px;\n"
  792. " background-color: #bf513b;}\n"
  793. "QPushButton::hover {\n"
  794. "border-style: solid;\n"
  795. "border-width: 0px;\n"
  796. "border-radius: 0px;\n"
  797. "background-color: rgba(48,148,243,80);}")
  798. self.detectbutton.setObjectName("detectbutton")
  799. self.horizontalLayout_2.addWidget(self.detectbutton)
  800. self.trainbutton = QtWidgets.QPushButton(self.layoutWidget1)
  801. self.trainbutton.setMinimumSize(QtCore.QSize(55, 28))
  802. self.trainbutton.setMaximumSize(QtCore.QSize(16777215, 28))
  803. self.trainbutton.setStyleSheet("QPushButton{font-family: \"Microsoft YaHei\";\n"
  804. "font-size: 14px;\n"
  805. "font-weight: bold;\n"
  806. "color:white;\n"
  807. "text-align: center center;\n"
  808. "padding-left: 5px;\n"
  809. "padding-right: 5px;\n"
  810. "padding-top: 4px;\n"
  811. "padding-bottom: 4px;\n"
  812. "border-style: solid;\n"
  813. "border-width: 0px;\n"
  814. "border-color: rgba(255, 255, 255, 255);\n"
  815. "border-radius: 3px;\n"
  816. "background-color: rgba(200, 200, 200,0);}\n"
  817. "\n"
  818. "QPushButton:focus{outline: none;}\n"
  819. "\n"
  820. "QPushButton::pressed{font-family: \"Microsoft YaHei\";\n"
  821. " font-size: 14px;\n"
  822. " font-weight: bold;\n"
  823. " color:rgb(200,200,200);\n"
  824. " text-align: center center;\n"
  825. " padding-left: 5px;\n"
  826. " padding-right: 5px;\n"
  827. " padding-top: 4px;\n"
  828. " padding-bottom: 4px;\n"
  829. " border-style: solid;\n"
  830. " border-width: 0px;\n"
  831. " border-color: rgba(255, 255, 255, 255);\n"
  832. " border-radius: 3px;\n"
  833. " background-color: #bf513b;}\n"
  834. "\n"
  835. "QPushButton::disabled{font-family: \"Microsoft YaHei\";\n"
  836. " font-size: 14px;\n"
  837. " font-weight: bold;\n"
  838. " color:rgb(200,200,200);\n"
  839. " text-align: center center;\n"
  840. " padding-left: 5px;\n"
  841. " padding-right: 5px;\n"
  842. " padding-top: 4px;\n"
  843. " padding-bottom: 4px;\n"
  844. " border-style: solid;\n"
  845. " border-width: 0px;\n"
  846. " border-color: rgba(255, 255, 255, 255);\n"
  847. " border-radius: 3px;\n"
  848. " background-color: #bf513b;}\n"
  849. "QPushButton::hover {\n"
  850. "border-style: solid;\n"
  851. "border-width: 0px;\n"
  852. "border-radius: 0px;\n"
  853. "background-color: rgba(48,148,243,80);}")
  854. self.trainbutton.setObjectName("trainbutton")
  855. self.horizontalLayout_2.addWidget(self.trainbutton)
  856. self.label_11 = QtWidgets.QLabel(self.groupBox_8)
  857. self.label_11.setGeometry(QtCore.QRect(10, 140, 72, 25))
  858. self.label_11.setStyleSheet("QLabel\n"
  859. "{\n"
  860. " font-size: 18px;\n"
  861. " font-family: \"Microsoft YaHei\";\n"
  862. " font-weight: bold;\n"
  863. " border-radius:9px;\n"
  864. " background:rgba(66, 195, 255, 0);\n"
  865. "color: rgb(218, 218, 218);\n"
  866. "}\n"
  867. "")
  868. self.label_11.setObjectName("label_11")
  869. self.resultWidget = QtWidgets.QListWidget(self.groupBox_8)
  870. self.resultWidget.setGeometry(QtCore.QRect(10, 180, 301, 270))
  871. sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
  872. sizePolicy.setHorizontalStretch(0)
  873. sizePolicy.setVerticalStretch(0)
  874. sizePolicy.setHeightForWidth(self.resultWidget.sizePolicy().hasHeightForWidth())
  875. self.resultWidget.setSizePolicy(sizePolicy)
  876. self.resultWidget.setMinimumSize(QtCore.QSize(0, 270))
  877. self.resultWidget.setMaximumSize(QtCore.QSize(16777215, 270))
  878. self.resultWidget.setStyleSheet("QListWidget{\n"
  879. "background-color: rgba(255, 255, 255, 255);\n"
  880. "border: 1px solid rgba(200, 200, 200,100);\n"
  881. "border-bottom: 0px solid rgba(200, 200, 200,100);\n"
  882. "border-radius:0px;\n"
  883. "font-family: \"Microsoft YaHei\";\n"
  884. "font-size: 12px;\n"
  885. "color: rgb(0, 0, 0);\n"
  886. "}\n"
  887. "")
  888. self.resultWidget.setObjectName("resultWidget")
  889. self.choose_file = QtWidgets.QPushButton(self.groupBox_8)
  890. self.choose_file.setGeometry(QtCore.QRect(90, 105, 76, 24))
  891. self.choose_file.setObjectName("choose_file")
  892. self.choose_folder = QtWidgets.QPushButton(self.groupBox_8)
  893. self.choose_folder.setGeometry(QtCore.QRect(180, 105, 101, 24))
  894. self.choose_folder.setObjectName("choose_folder")
  895. self.label_3 = QtWidgets.QLabel(self.groupBox_8)
  896. self.label_3.setGeometry(QtCore.QRect(10, 60, 72, 35))
  897. self.label_3.setMinimumSize(QtCore.QSize(0, 35))
  898. self.label_3.setMaximumSize(QtCore.QSize(80, 16777215))
  899. self.label_3.setStyleSheet("QLabel\n"
  900. "{\n"
  901. " font-size: 18px;\n"
  902. " font-family: \"Microsoft YaHei\";\n"
  903. " font-weight: bold;\n"
  904. " border-radius:9px;\n"
  905. " background:rgba(66, 195, 255, 0);\n"
  906. "color: rgb(218, 218, 218);\n"
  907. "}\n"
  908. "")
  909. self.label_3.setObjectName("label_3")
  910. self.comboBox = QtWidgets.QComboBox(self.groupBox_8)
  911. self.comboBox.setGeometry(QtCore.QRect(90, 57, 194, 35))
  912. self.comboBox.setMinimumSize(QtCore.QSize(0, 35))
  913. self.comboBox.setStyleSheet("QComboBox QAbstractItemView {\n"
  914. "font-family: \"Microsoft YaHei\";\n"
  915. "font-size: 16px;\n"
  916. "background:rgba(200, 200, 200,150);\n"
  917. "selection-background-color: rgba(200, 200, 200,50);\n"
  918. "color: rgb(218, 218, 218);\n"
  919. "outline:none;\n"
  920. "border:none;}\n"
  921. "QComboBox{\n"
  922. "font-family: \"Microsoft YaHei\";\n"
  923. "font-size: 16px;\n"
  924. "color: rgb(218, 218, 218);\n"
  925. "border-width:0px;\n"
  926. "border-color:white;\n"
  927. "border-style:solid;\n"
  928. "background-color: rgba(200, 200, 200,0);}\n"
  929. "\n"
  930. "QComboBox::drop-down {\n"
  931. "margin-top:8;\n"
  932. "height:20;\n"
  933. "background:rgba(255,255,255,0);\n"
  934. "border-image: url(:/img/icon/下拉_白色.png);\n"
  935. "}\n"
  936. "")
  937. self.comboBox.setObjectName("comboBox")
  938. self.comboBox.addItem("")
  939. self.comboBox.addItem("")
  940. self.comboBox.addItem("")
  941. self.comboBox.addItem("")
  942. self.label_5 = QtWidgets.QLabel(self.groupBox_8)
  943. self.label_5.setGeometry(QtCore.QRect(10, 20, 72, 35))
  944. self.label_5.setMinimumSize(QtCore.QSize(0, 35))
  945. self.label_5.setMaximumSize(QtCore.QSize(80, 16777215))
  946. self.label_5.setStyleSheet("QLabel\n"
  947. "{\n"
  948. " font-size: 18px;\n"
  949. " font-family: \"Microsoft YaHei\";\n"
  950. " font-weight: bold;\n"
  951. " border-radius:9px;\n"
  952. " background:rgba(66, 195, 255, 0);\n"
  953. "color: rgb(218, 218, 218);\n"
  954. "}\n"
  955. "")
  956. self.label_5.setObjectName("label_5")
  957. self.label_10 = QtWidgets.QLabel(self.groupBox_8)
  958. self.label_10.setGeometry(QtCore.QRect(10, 100, 72, 35))
  959. self.label_10.setMinimumSize(QtCore.QSize(0, 35))
  960. self.label_10.setMaximumSize(QtCore.QSize(80, 16777215))
  961. self.label_10.setStyleSheet("QLabel\n"
  962. "{\n"
  963. " font-size: 18px;\n"
  964. " font-family: \"Microsoft YaHei\";\n"
  965. " font-weight: bold;\n"
  966. " border-radius:9px;\n"
  967. " background:rgba(66, 195, 255, 0);\n"
  968. "color: rgb(218, 218, 218);\n"
  969. "}\n"
  970. "")
  971. self.label_10.setObjectName("label_10")
  972. self.layoutWidget_5 = QtWidgets.QWidget(self.groupBox_8)
  973. self.layoutWidget_5.setGeometry(QtCore.QRect(10, 460, 211, 37))
  974. self.layoutWidget_5.setObjectName("layoutWidget_5")
  975. self.horizontalLayout_17 = QtWidgets.QHBoxLayout(self.layoutWidget_5)
  976. self.horizontalLayout_17.setContentsMargins(0, 0, 0, 0)
  977. self.horizontalLayout_17.setObjectName("horizontalLayout_17")
  978. self.label_17 = QtWidgets.QLabel(self.layoutWidget_5)
  979. self.label_17.setMinimumSize(QtCore.QSize(0, 35))
  980. self.label_17.setMaximumSize(QtCore.QSize(80, 16777215))
  981. self.label_17.setStyleSheet("QLabel\n"
  982. "{\n"
  983. " font-size: 18px;\n"
  984. " font-family: \"Microsoft YaHei\";\n"
  985. " font-weight: bold;\n"
  986. " border-radius:9px;\n"
  987. " background:rgba(66, 195, 255, 0);\n"
  988. "color: rgb(218, 218, 218);\n"
  989. "}\n"
  990. "")
  991. self.label_17.setObjectName("label_17")
  992. self.horizontalLayout_17.addWidget(self.label_17)
  993. self.shebei = QtWidgets.QLineEdit(self.layoutWidget_5)
  994. self.shebei.setObjectName("shebei_2")
  995. self.horizontalLayout_17.addWidget(self.shebei)
  996. self.horizontalLayout_7.addWidget(self.groupBox_8)
  997. self.groupBox_201 = QtWidgets.QGroupBox(self.groupBox_18)
  998. self.groupBox_201.setStyleSheet("#groupBox_201{\n"
  999. "background-color: rgba(95, 95, 95, 200);\n"
  1000. "border: 0px solid #42adff;\n"
  1001. "border-left: 1px solid rgba(200, 200, 200,100);\n"
  1002. "border-right: 0px solid rgba(29, 83, 185, 255);\n"
  1003. "border-radius:0px;}")
  1004. self.groupBox_201.setTitle("")
  1005. self.groupBox_201.setObjectName("groupBox_201")
  1006. self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.groupBox_201)
  1007. self.verticalLayout_4.setContentsMargins(-1, 0, -1, 0)
  1008. self.verticalLayout_4.setObjectName("verticalLayout_4")
  1009. self.groupBox_3 = QtWidgets.QGroupBox(self.groupBox_201)
  1010. self.groupBox_3.setMinimumSize(QtCore.QSize(0, 42))
  1011. self.groupBox_3.setMaximumSize(QtCore.QSize(16777215, 42))
  1012. font = QtGui.QFont()
  1013. font.setPointSize(1)
  1014. font.setBold(True)
  1015. font.setWeight(75)
  1016. self.groupBox_3.setFont(font)
  1017. self.groupBox_3.setStyleSheet("#groupBox_3{\n"
  1018. "border: 0px solid #42adff;\n"
  1019. "border-radius:0px;}")
  1020. self.groupBox_3.setTitle("")
  1021. self.groupBox_3.setObjectName("groupBox_3")
  1022. self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.groupBox_3)
  1023. self.horizontalLayout_3.setObjectName("horizontalLayout_3")
  1024. self.label_6 = QtWidgets.QLabel(self.groupBox_3)
  1025. font = QtGui.QFont()
  1026. font.setFamily("Microsoft YaHei")
  1027. font.setPointSize(-1)
  1028. font.setBold(True)
  1029. font.setWeight(75)
  1030. self.label_6.setFont(font)
  1031. self.label_6.setStyleSheet("QLabel\n"
  1032. "{\n"
  1033. " font-size: 20px;\n"
  1034. " font-family: \"Microsoft YaHei\";\n"
  1035. " font-weight: bold;\n"
  1036. " border-radius:9px;\n"
  1037. " background:rgba(66, 195, 255, 0);\n"
  1038. "color: rgb(218, 218, 218);\n"
  1039. "}")
  1040. self.label_6.setAlignment(QtCore.Qt.AlignCenter)
  1041. self.label_6.setObjectName("label_6")
  1042. self.horizontalLayout_3.addWidget(self.label_6)
  1043. self.label_9 = QtWidgets.QLabel(self.groupBox_3)
  1044. font = QtGui.QFont()
  1045. font.setFamily("Microsoft YaHei")
  1046. font.setPointSize(-1)
  1047. font.setBold(True)
  1048. font.setWeight(75)
  1049. self.label_9.setFont(font)
  1050. self.label_9.setStyleSheet("QLabel\n"
  1051. "{\n"
  1052. " font-size: 20px;\n"
  1053. " font-family: \"Microsoft YaHei\";\n"
  1054. " font-weight: bold;\n"
  1055. " border-radius:9px;\n"
  1056. " background:rgba(66, 195, 255, 0);\n"
  1057. "color: rgb(218, 218, 218);\n"
  1058. "}")
  1059. self.label_9.setAlignment(QtCore.Qt.AlignCenter)
  1060. self.label_9.setObjectName("label_9")
  1061. self.horizontalLayout_3.addWidget(self.label_9)
  1062. self.verticalLayout_4.addWidget(self.groupBox_3)
  1063. self.splitter = QtWidgets.QSplitter(self.groupBox_201)
  1064. self.splitter.setEnabled(True)
  1065. self.splitter.setStyleSheet("#splitter::handle{background: 1px solid rgba(200, 200, 200,100);}")
  1066. self.splitter.setFrameShape(QtWidgets.QFrame.NoFrame)
  1067. self.splitter.setLineWidth(10)
  1068. self.splitter.setOrientation(QtCore.Qt.Horizontal)
  1069. self.splitter.setHandleWidth(1)
  1070. self.splitter.setObjectName("splitter")
  1071. self.raw_video = Label_click_Mouse(self.splitter)
  1072. self.raw_video.setEnabled(True)
  1073. sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
  1074. sizePolicy.setHorizontalStretch(0)
  1075. sizePolicy.setVerticalStretch(0)
  1076. sizePolicy.setHeightForWidth(self.raw_video.sizePolicy().hasHeightForWidth())
  1077. self.raw_video.setSizePolicy(sizePolicy)
  1078. self.raw_video.setMinimumSize(QtCore.QSize(200, 0))
  1079. font = QtGui.QFont()
  1080. font.setFamily("微软雅黑")
  1081. font.setPointSize(36)
  1082. self.raw_video.setFont(font)
  1083. self.raw_video.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
  1084. self.raw_video.setStyleSheet("color: rgb(218, 218, 218);\n"
  1085. "")
  1086. self.raw_video.setText("")
  1087. self.raw_video.setScaledContents(False)
  1088. self.raw_video.setAlignment(QtCore.Qt.AlignCenter)
  1089. self.raw_video.setObjectName("raw_video")
  1090. self.out_video = Label_click_Mouse(self.splitter)
  1091. self.out_video.setEnabled(True)
  1092. sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Ignored)
  1093. sizePolicy.setHorizontalStretch(0)
  1094. sizePolicy.setVerticalStretch(0)
  1095. sizePolicy.setHeightForWidth(self.out_video.sizePolicy().hasHeightForWidth())
  1096. self.out_video.setSizePolicy(sizePolicy)
  1097. self.out_video.setMinimumSize(QtCore.QSize(200, 0))
  1098. font = QtGui.QFont()
  1099. font.setFamily("微软雅黑")
  1100. font.setPointSize(36)
  1101. self.out_video.setFont(font)
  1102. self.out_video.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
  1103. self.out_video.setStyleSheet("color: rgb(218, 218, 218);\n"
  1104. "")
  1105. self.out_video.setText("")
  1106. self.out_video.setScaledContents(False)
  1107. self.out_video.setAlignment(QtCore.Qt.AlignCenter)
  1108. self.out_video.setObjectName("out_video")
  1109. self.verticalLayout_4.addWidget(self.splitter)
  1110. self.horizontalLayout_12 = QtWidgets.QHBoxLayout()
  1111. self.horizontalLayout_12.setContentsMargins(-1, -1, 0, -1)
  1112. self.horizontalLayout_12.setObjectName("horizontalLayout_12")
  1113. self.action = QtWidgets.QPushButton(self.groupBox_201)
  1114. self.action.setMinimumSize(QtCore.QSize(55, 28))
  1115. self.action.setMaximumSize(QtCore.QSize(16777215, 28))
  1116. self.action.setStyleSheet("QPushButton{font-family: \"Microsoft YaHei\";\n"
  1117. "font-size: 16px;\n"
  1118. "font-weight: bold;\n"
  1119. "color:white;\n"
  1120. "text-align: center center;\n"
  1121. "padding-left: 5px;\n"
  1122. "padding-right: 5px;\n"
  1123. "padding-top: 4px;\n"
  1124. "padding-bottom: 4px;\n"
  1125. "border-style: solid;\n"
  1126. "border-width: 0px;\n"
  1127. "border-color: rgba(255, 255, 255, 255);\n"
  1128. "border-radius: 3px;\n"
  1129. "background-color: rgba(200, 200, 200,0);}\n"
  1130. "\n"
  1131. "QPushButton:focus{outline: none;}\n"
  1132. "\n"
  1133. "QPushButton::pressed{font-family: \"Microsoft YaHei\";\n"
  1134. " font-size: 14px;\n"
  1135. " font-weight: bold;\n"
  1136. " color:rgb(200,200,200);\n"
  1137. " text-align: center center;\n"
  1138. " padding-left: 5px;\n"
  1139. " padding-right: 5px;\n"
  1140. " padding-top: 4px;\n"
  1141. " padding-bottom: 4px;\n"
  1142. " border-style: solid;\n"
  1143. " border-width: 0px;\n"
  1144. " border-color: rgba(255, 255, 255, 255);\n"
  1145. " border-radius: 3px;\n"
  1146. " background-color: #bf513b;}\n"
  1147. "\n"
  1148. "QPushButton::disabled{font-family: \"Microsoft YaHei\";\n"
  1149. " font-size: 14px;\n"
  1150. " font-weight: bold;\n"
  1151. " color:rgb(200,200,200);\n"
  1152. " text-align: center center;\n"
  1153. " padding-left: 5px;\n"
  1154. " padding-right: 5px;\n"
  1155. " padding-top: 4px;\n"
  1156. " padding-bottom: 4px;\n"
  1157. " border-style: solid;\n"
  1158. " border-width: 0px;\n"
  1159. " border-color: rgba(255, 255, 255, 255);\n"
  1160. " border-radius: 3px;\n"
  1161. " background-color: #bf513b;}\n"
  1162. "QPushButton::hover {\n"
  1163. "border-style: solid;\n"
  1164. "border-width: 0px;\n"
  1165. "border-radius: 0px;\n"
  1166. "background-color: rgba(48,148,243,80);}")
  1167. icon4 = QtGui.QIcon()
  1168. icon4.addPixmap(QtGui.QPixmap(":/img/icon/运行.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
  1169. self.action.setIcon(icon4)
  1170. self.action.setObjectName("action")
  1171. self.horizontalLayout_12.addWidget(self.action)
  1172. self.pre_page = QtWidgets.QPushButton(self.groupBox_201)
  1173. self.pre_page.setObjectName("pre_page")
  1174. self.horizontalLayout_12.addWidget(self.pre_page)
  1175. self.next_page = QtWidgets.QPushButton(self.groupBox_201)
  1176. self.next_page.setObjectName("next_page")
  1177. self.horizontalLayout_12.addWidget(self.next_page)
  1178. self.show_result = QtWidgets.QPushButton(self.groupBox_201)
  1179. icon5 = QtGui.QIcon()
  1180. icon5.addPixmap(QtGui.QPixmap(":/img/icon/数据探索.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
  1181. self.show_result.setIcon(icon5)
  1182. self.show_result.setObjectName("show_result")
  1183. self.horizontalLayout_12.addWidget(self.show_result)
  1184. self.error_correction = QtWidgets.QPushButton(self.groupBox_201)
  1185. self.error_correction.setObjectName("error_correction")
  1186. self.horizontalLayout_12.addWidget(self.error_correction)
  1187. # self.close_info = QtWidgets.QPushButton(self.groupBox_201)
  1188. # self.close_info.setObjectName("close_info")
  1189. # self.horizontalLayout_12.addWidget(self.close_info)
  1190. self.result_export = QtWidgets.QPushButton(self.groupBox_201)
  1191. icon6 = QtGui.QIcon()
  1192. icon6.addPixmap(QtGui.QPixmap(":/img/icon/打开.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
  1193. self.result_export.setIcon(icon6)
  1194. self.result_export.setObjectName("result_export")
  1195. self.horizontalLayout_12.addWidget(self.result_export)
  1196. self.verticalLayout_4.addLayout(self.horizontalLayout_12)
  1197. self.horizontalLayout_7.addWidget(self.groupBox_201)
  1198. self.verticalLayout_6.addLayout(self.horizontalLayout_7)
  1199. self.groupBox_4 = QtWidgets.QGroupBox(self.groupBox_18)
  1200. self.groupBox_4.setMinimumSize(QtCore.QSize(0, 30))
  1201. self.groupBox_4.setMaximumSize(QtCore.QSize(16777215, 30))
  1202. self.groupBox_4.setStyleSheet("#groupBox_4{\n"
  1203. "background-color: rgba(75, 75, 75, 200);\n"
  1204. "border: 0px solid #42adff;\n"
  1205. "border-left: 0px solid rgba(29, 83, 185, 255);\n"
  1206. "border-right: 0px solid rgba(29, 83, 185, 255);\n"
  1207. "border-top: 1px solid rgba(200, 200, 200,100);\n"
  1208. "border-radius:0px;}")
  1209. self.groupBox_4.setTitle("")
  1210. self.groupBox_4.setObjectName("groupBox_4")
  1211. self.horizontalLayout_10 = QtWidgets.QHBoxLayout(self.groupBox_4)
  1212. self.horizontalLayout_10.setContentsMargins(-1, 0, -1, 0)
  1213. self.horizontalLayout_10.setSpacing(0)
  1214. self.horizontalLayout_10.setObjectName("horizontalLayout_10")
  1215. self.statistic_label = QtWidgets.QLabel(self.groupBox_4)
  1216. self.statistic_label.setMouseTracking(False)
  1217. self.statistic_label.setStyleSheet("QLabel\n"
  1218. "{\n"
  1219. " font-size: 16px;\n"
  1220. " font-family: \"Microsoft YaHei\";\n"
  1221. " font-weight: light;\n"
  1222. " border-radius:9px;\n"
  1223. " background:rgba(66, 195, 255, 0);\n"
  1224. "color: rgb(218, 218, 218);\n"
  1225. "}\n"
  1226. "")
  1227. self.statistic_label.setText("")
  1228. self.statistic_label.setObjectName("statistic_label")
  1229. self.horizontalLayout_10.addWidget(self.statistic_label)
  1230. self.verticalLayout_6.addWidget(self.groupBox_4)
  1231. self.verticalLayout_2.addWidget(self.groupBox_18)
  1232. mainWindow.setCentralWidget(self.centralwidget)
  1233. self.retranslateUi(mainWindow)
  1234. QtCore.QMetaObject.connectSlotsByName(mainWindow)
  1235. def retranslateUi(self, mainWindow):
  1236. _translate = QtCore.QCoreApplication.translate
  1237. mainWindow.setWindowTitle(_translate("mainWindow", "工业CT缺陷图像识别软件"))
  1238. self.label_4.setText(_translate("mainWindow", "工业CT缺陷图像识别软件"))
  1239. self.label_8.setText(_translate("mainWindow", "被测品:"))
  1240. self.label_12.setText(_translate("mainWindow", "批次名:"))
  1241. self.choose_circle.setText(_translate("mainWindow", "对应圆盘"))
  1242. self.label_13.setText(_translate("mainWindow", "直径值:"))
  1243. self.label_14.setText(_translate("mainWindow", "毫米"))
  1244. self.label_15.setText(_translate("mainWindow", "分辨率:"))
  1245. self.label_16.setText(_translate("mainWindow", "毫米/像素"))
  1246. self.detectbutton.setToolTip(_translate("mainWindow", "相机"))
  1247. self.detectbutton.setText(_translate("mainWindow", "检测"))
  1248. self.trainbutton.setToolTip(_translate("mainWindow", "文件"))
  1249. self.trainbutton.setText(_translate("mainWindow", "训练"))
  1250. self.label_11.setText(_translate("mainWindow", "图片列表"))
  1251. self.choose_file.setText(_translate("mainWindow", "选择图像"))
  1252. self.choose_folder.setText(_translate("mainWindow", "选择图像文件夹"))
  1253. self.label_3.setText(_translate("mainWindow", "模型选择"))
  1254. self.comboBox.setItemText(0, _translate("mainWindow", "yolov5s.pt"))
  1255. self.comboBox.setItemText(1, _translate("mainWindow", "yolov5m.pt"))
  1256. self.comboBox.setItemText(2, _translate("mainWindow", "yolov5l.pt"))
  1257. self.comboBox.setItemText(3, _translate("mainWindow", "yolov5x.pt"))
  1258. self.label_5.setText(_translate("mainWindow", "模式选择"))
  1259. self.label_10.setText(_translate("mainWindow", "数据选择"))
  1260. self.label_17.setText(_translate("mainWindow", "设备名:"))
  1261. self.label_6.setText(_translate("mainWindow", "原图像"))
  1262. self.label_9.setText(_translate("mainWindow", "检测结果"))
  1263. self.action.setToolTip(_translate("mainWindow", "文件"))
  1264. self.action.setText(_translate("mainWindow", "开始"))
  1265. self.pre_page.setText(_translate("mainWindow", "上一张"))
  1266. self.next_page.setText(_translate("mainWindow", "下一张"))
  1267. self.show_result.setText(_translate("mainWindow", "显示结果"))
  1268. self.error_correction.setText(_translate("mainWindow", "纠错"))
  1269. # self.close_info.setText(_translate("mainWindow", "打开信息显示"))
  1270. self.result_export.setText(_translate("mainWindow", "结果导出"))