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

merge from new

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