提交 1e6af3bb 编写于 作者: qq_25193841's avatar qq_25193841

merge from new

merge from new
上级 15be3c54
......@@ -2285,13 +2285,15 @@ class MainWindow(QMainWindow):
import pandas as pd
from libs.dataPartitionDialog import DataPartitionDialog
if self.lang == 'ch':
QMessageBox.information(self, "Information", "导出JSON前请保存所有图像的标注且关闭EXCEL!!!!!!!!!!!!")
else:
QMessageBox.information(self, "Information", "Please save all the annotations and close the EXCEL before exporting JSON!!!!!!!!!!!!")
# data partition user input
partitionDialog = DataPartitionDialog(parent=self)
partitionDialog.exec()
if partitionDialog.getStatus() == False:
return
# automatically save annotations
self.saveLabelFile()
self.saveFilestate()
self.savePPlabel(mode='auto')
# load box annotations
labeldict = {}
......@@ -2319,11 +2321,6 @@ class MainWindow(QMainWindow):
# QMessageBox.information(self, "Information", msg)
# return
# data partition user input
partitionDialog = DataPartitionDialog()
partitionDialog.exec()
if partitionDialog.getStatus() == False:
return
train_split, val_split, test_split = partitionDialog.getDataPartition()
# check validate
......@@ -2379,7 +2376,7 @@ class MainWindow(QMainWindow):
# save json
with open("{}/annotation.json".format(self.lastOpenDir), "w", encoding='utf-8') as fid:
fid.write(json.dumps(json_results))
fid.write(json.dumps(json_results, ensure_ascii=False))
msg = 'JSON sucessfully saved in {}/annotation.json'.format(self.lastOpenDir)
QMessageBox.information(self, "Information", msg)
......
......@@ -18,8 +18,9 @@ import numpy as np
BB = QDialogButtonBox
class DataPartitionDialog(QDialog):
def __init__(self):
def __init__(self, parent=None):
super().__init__()
self.parnet = parent
self.title = 'DATA PARTITION'
self.train_ratio = 70
......@@ -34,6 +35,16 @@ class DataPartitionDialog(QDialog):
self.flag_accept = True
if self.parnet.lang == 'ch':
msg = "导出JSON前请保存所有图像的标注且关闭EXCEL!"
else:
msg = "Please save all the annotations and close the EXCEL before exporting JSON!"
info_msg = QLabel(msg, self)
info_msg.setWordWrap(True)
info_msg.setStyleSheet("color: red")
info_msg.setFont(QFont('Arial', 12))
train_lbl = QLabel('Train split: ', self)
train_lbl.setFont(QFont('Arial', 15))
val_lbl = QLabel('Valid split: ', self)
......@@ -58,19 +69,20 @@ class DataPartitionDialog(QDialog):
self.test_input.setValidator(validator)
gridlayout = QGridLayout()
gridlayout.addWidget(train_lbl, 0, 0)
gridlayout.addWidget(val_lbl, 1, 0)
gridlayout.addWidget(test_lbl, 2, 0)
gridlayout.addWidget(self.train_input, 0, 1)
gridlayout.addWidget(self.val_input, 1, 1)
gridlayout.addWidget(self.test_input, 2, 1)
gridlayout.addWidget(info_msg, 0, 0, 1, 2)
gridlayout.addWidget(train_lbl, 1, 0)
gridlayout.addWidget(val_lbl, 2, 0)
gridlayout.addWidget(test_lbl, 3, 0)
gridlayout.addWidget(self.train_input, 1, 1)
gridlayout.addWidget(self.val_input, 2, 1)
gridlayout.addWidget(self.test_input, 3, 1)
bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
bb.button(BB.Ok).setIcon(newIcon('done'))
bb.button(BB.Cancel).setIcon(newIcon('undo'))
bb.accepted.connect(self.validate)
bb.rejected.connect(self.cancel)
gridlayout.addWidget(bb, 3, 0, 1, 2)
gridlayout.addWidget(bb, 4, 0, 1, 2)
self.setLayout(gridlayout)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册