-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert_mask2txt.py
151 lines (142 loc) · 7.71 KB
/
convert_mask2txt.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
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'convert_mask2txt.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
#
# 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_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
MainWindow.setStyleSheet("")
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setContentsMargins(10, 20, -1, -1)
self.gridLayout_2.setObjectName("gridLayout_2")
self.pushButton_start = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_start.setMaximumSize(QtCore.QSize(16777215, 16777215))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.pushButton_start.setFont(font)
self.pushButton_start.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.pushButton_start.setObjectName("pushButton_start")
self.gridLayout_2.addWidget(self.pushButton_start, 9, 1, 1, 1)
spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_2.addItem(spacerItem, 1, 1, 1, 1)
self.pushButton_outputpath = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_outputpath.setMaximumSize(QtCore.QSize(100, 16777215))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.pushButton_outputpath.setFont(font)
self.pushButton_outputpath.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.pushButton_outputpath.setObjectName("pushButton_outputpath")
self.gridLayout_2.addWidget(self.pushButton_outputpath, 6, 2, 1, 1)
self.pushButton_maskpath = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_maskpath.setMaximumSize(QtCore.QSize(100, 16777215))
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.pushButton_maskpath.setFont(font)
self.pushButton_maskpath.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.pushButton_maskpath.setObjectName("pushButton_maskpath")
self.gridLayout_2.addWidget(self.pushButton_maskpath, 2, 2, 1, 1)
self.progressBar = QtWidgets.QProgressBar(self.centralwidget)
self.progressBar.setProperty("value", 0)
self.progressBar.setAlignment(QtCore.Qt.AlignCenter)
self.progressBar.setObjectName("progressBar")
self.gridLayout_2.addWidget(self.progressBar, 12, 1, 1, 1)
spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_2.addItem(spacerItem1, 8, 1, 1, 1)
self.lineEdit_outputpath = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_outputpath.setObjectName("lineEdit_outputpath")
self.gridLayout_2.addWidget(self.lineEdit_outputpath, 6, 1, 1, 1)
spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_2.addItem(spacerItem2, 10, 1, 1, 1)
self.label_3 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(13)
font.setBold(True)
font.setItalic(True)
font.setWeight(75)
font.setStrikeOut(False)
self.label_3.setFont(font)
self.label_3.setObjectName("label_3")
self.gridLayout_2.addWidget(self.label_3, 6, 0, 1, 1)
self.label_4 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(13)
font.setBold(True)
font.setItalic(True)
font.setWeight(75)
self.label_4.setFont(font)
self.label_4.setObjectName("label_4")
self.gridLayout_2.addWidget(self.label_4, 3, 0, 1, 1)
self.lineEdit_maskpath = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_maskpath.setObjectName("lineEdit_maskpath")
self.gridLayout_2.addWidget(self.lineEdit_maskpath, 2, 1, 1, 1)
self.label = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(15)
font.setBold(True)
font.setWeight(75)
self.label.setFont(font)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.gridLayout_2.addWidget(self.label, 0, 1, 1, 1)
self.label_2 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(13)
font.setBold(True)
font.setItalic(True)
font.setWeight(75)
self.label_2.setFont(font)
self.label_2.setObjectName("label_2")
self.gridLayout_2.addWidget(self.label_2, 2, 0, 1, 1)
spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_2.addItem(spacerItem3, 5, 1, 1, 1)
self.lineEdit_classId = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_classId.setAlignment(QtCore.Qt.AlignCenter)
self.lineEdit_classId.setObjectName("lineEdit_classId")
self.gridLayout_2.addWidget(self.lineEdit_classId, 3, 1, 1, 1)
spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout_2.addItem(spacerItem4, 13, 1, 1, 1)
self.gridLayout.addLayout(self.gridLayout_2, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.pushButton_start.setText(_translate("MainWindow", "Start"))
self.pushButton_outputpath.setText(_translate("MainWindow", "Add"))
self.pushButton_maskpath.setText(_translate("MainWindow", "Add"))
self.lineEdit_outputpath.setToolTip(_translate("MainWindow", "Select Output Path"))
self.label_3.setText(_translate("MainWindow", "Save Output Path: "))
self.label_4.setText(_translate("MainWindow", "Class Id:"))
self.lineEdit_maskpath.setToolTip(_translate("MainWindow", "Select Mask Path"))
self.label.setText(_translate("MainWindow", "Convert Mask to Yolo Format txt"))
self.label_2.setText(_translate("MainWindow", "Mask Path: "))
self.lineEdit_classId.setToolTip(_translate("MainWindow", "<html><head/><body><p align=\"justify\">If you have masks belonging to different classes, you can separate them into different folders. </p><p align=\"justify\">You can manually add the class ID when making transformations from these folders.</p></body></html>"))
self.lineEdit_classId.setPlaceholderText(_translate("MainWindow", "default: 0"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())