From ad14623cd4210b01d8928cc3d5f276be849ae8ac Mon Sep 17 00:00:00 2001 From: Leon-Leyang Date: Sun, 29 Jan 2023 21:21:39 +0800 Subject: [PATCH] Rename 'Generated Files' to 'Output Folder' and add relevant check in `check_profile` --- launcher/controllers/docker_ctrl.py | 4 +- launcher/controllers/main_ctrl.py | 20 +++++-- launcher/model/model.py | 20 +++---- launcher/resources/launcher_v2.ui | 42 +++++++-------- launcher/views/main_view.py | 2 +- launcher/views/main_view_ui.py | 84 ++++++++++++++--------------- 6 files changed, 91 insertions(+), 81 deletions(-) diff --git a/launcher/controllers/docker_ctrl.py b/launcher/controllers/docker_ctrl.py index 20b8a2c1..b3418700 100644 --- a/launcher/controllers/docker_ctrl.py +++ b/launcher/controllers/docker_ctrl.py @@ -199,7 +199,7 @@ def start_new_cpu_server(self, image, config_file): source=get_system_path(self.model.profile["paired_path"]), type="bind"), docker.types.Mount(target="/Robustar2/generated", - source=get_system_path(self.model.profile["gen_path"]), + source=get_system_path(self.model.profile["out_path"]), type="bind"), docker.types.Mount(target="/Robustar2/influence_images", source=get_system_path(self.model.profile["inf_path"]), @@ -238,7 +238,7 @@ def start_new_cuda_server(self, image, config_file): source=get_system_path(self.model.profile["paired_path"]), type="bind"), docker.types.Mount(target="/Robustar2/generated", - source=get_system_path(self.model.profile["gen_path"]), + source=get_system_path(self.model.profile["out_path"]), type="bind"), docker.types.Mount(target="/Robustar2/influence_images", source=get_system_path(self.model.profile["inf_path"]), diff --git a/launcher/controllers/main_ctrl.py b/launcher/controllers/main_ctrl.py index 1cd87355..d1423914 100644 --- a/launcher/controllers/main_ctrl.py +++ b/launcher/controllers/main_ctrl.py @@ -88,13 +88,13 @@ def set_m_paired_path(self): if path: self.model.paired_path = path - def set_m_gen_path(self): + def set_m_out_path(self): path = QFileDialog.getExistingDirectory( - self.main_view, "Choose Generated Files Path", self.model.cwd + self.main_view, "Choose Output Folder Path", self.model.cwd ) self.model.cwd = os.path.dirname(path) if path: - self.model.gen_path = path + self.model.out_path = path def set_m_ckpt_path(self): path = QFileDialog.getExistingDirectory( @@ -219,8 +219,8 @@ def set_v_test_path(self, val): def set_v_paired_path(self, val): self.main_view.ui.paired_line_edit.setText(val) - def set_v_gen_path(self, val): - self.main_view.ui.gen_line_edit.setText(val) + def set_v_out_path(self, val): + self.main_view.ui.out_line_edit.setText(val) def set_v_ckpt_path(self, val): self.main_view.ui.ckpt_line_edit.setText(val) @@ -277,28 +277,38 @@ def disable_control(self): def check_profile(self): miss_profile_dict = { + "name": "container name", + "port": "port", "train_path": "train set path", "val_path": "validation set path", "test_path": "test set path", + "paired_path": "paired set path", + "out_path": "output folder path", "inf_path": "influence result path", "ckpt_path": "check point path", "batch": "batch size", "worker": "worker number", "cls": "class number", "size": "image size", + "device": "device" } miss_profile_prompt = [] for profile_name in [ + "name", + "port", "train_path", "val_path", "test_path", + "paired_path", + "out_path", "inf_path", "ckpt_path", "batch", "worker", "cls", "size", + "device" ]: if not self.model.profile[profile_name].strip(): miss_profile_prompt.append(miss_profile_dict[profile_name]) diff --git a/launcher/model/model.py b/launcher/model/model.py index d817636a..e2fa7df0 100644 --- a/launcher/model/model.py +++ b/launcher/model/model.py @@ -10,7 +10,7 @@ class Model(QObject): valPathChanged = Signal(str) testPathChanged = Signal(str) pairedPathChanged = Signal(str) - genPathChanged = Signal(str) + outPathChanged = Signal(str) ckptPathChanged = Signal(str) infPathChanged = Signal(str) archChanged = Signal(str) @@ -38,7 +38,7 @@ def __init__(self, ctrl): "val_path": "", "test_path": "", "paired_path": "", - "gen_path": "", + "out_path": "", "ckpt_path": "", "inf_path": "", "arch": "resnet-18", @@ -79,7 +79,7 @@ def __init__(self, ctrl): self.trainPathChanged.connect(self.ctrl.set_v_train_path) self.valPathChanged.connect(self.ctrl.set_v_val_path) self.pairedPathChanged.connect(self.ctrl.set_v_paired_path) - self.genPathChanged.connect(self.ctrl.set_v_gen_path) + self.outPathChanged.connect(self.ctrl.set_v_out_path) self.testPathChanged.connect(self.ctrl.set_v_test_path) self.ckptPathChanged.connect(self.ctrl.set_v_ckpt_path) self.infPathChanged.connect(self.ctrl.set_v_inf_path) @@ -158,13 +158,13 @@ def paired_path(self, val): self.pairedPathChanged.emit(val) @property - def gen_path(self): - return self._profile['gen_path'] + def out_path(self): + return self._profile['out_path'] - @gen_path.setter - def gen_path(self, val): - self._profile['gen_path'] = val - self.genPathChanged.emit(val) + @out_path.setter + def out_path(self, val): + self._profile['out_path'] = val + self.outPathChanged.emit(val) @property def ckpt_path(self): @@ -287,7 +287,7 @@ def profile(self, val): self.val_path = val["val_path"] self.test_path = val["test_path"] self.paired_path = val["paired_path"] - self.gen_path = val["gen_path"] + self.out_path = val["out_path"] self.ckpt_path = val["ckpt_path"] self.inf_path = val["inf_path"] self.arch = val["arch"] diff --git a/launcher/resources/launcher_v2.ui b/launcher/resources/launcher_v2.ui index 15b07caf..7b46234c 100644 --- a/launcher/resources/launcher_v2.ui +++ b/launcher/resources/launcher_v2.ui @@ -1368,12 +1368,9 @@ QPushButton:hover { - - - 0 - + - + 0 @@ -1402,15 +1399,15 @@ QPushButton:hover { - The root path of the generated files + The root path for all checkpoint files saved by Robustar - Generated Set + Checkpoint - + 0 @@ -1444,7 +1441,7 @@ QPushButton:hover { - + 0 @@ -1480,9 +1477,9 @@ QPushButton:hover { - + - + 0 @@ -1511,15 +1508,15 @@ QPushButton:hover { - The root path for all checkpoint files saved by Robustar + The root path for all influence result calculated by Robustar - Checkpoint + Influence Result - + 0 @@ -1553,7 +1550,7 @@ QPushButton:hover { - + 0 @@ -1589,9 +1586,12 @@ QPushButton:hover { - + + + 0 + - + 0 @@ -1620,15 +1620,15 @@ QPushButton:hover { - The root path for all influence result calculated by Robustar + The root path of the generated files - Influence Result + Output Folder - + 0 @@ -1662,7 +1662,7 @@ QPushButton:hover { - + 0 diff --git a/launcher/views/main_view.py b/launcher/views/main_view.py index 5b630536..62803b1c 100644 --- a/launcher/views/main_view.py +++ b/launcher/views/main_view.py @@ -18,7 +18,7 @@ def __init__(self, ctrl): self.ui.val_push_button.clicked.connect(self.ctrl.set_m_val_path) self.ui.test_push_button.clicked.connect(self.ctrl.set_m_test_path) self.ui.paired_push_button.clicked.connect(self.ctrl.set_m_paired_path) - self.ui.gen_push_button.clicked.connect(self.ctrl.set_m_gen_path) + self.ui.out_push_button.clicked.connect(self.ctrl.set_m_out_path) self.ui.ckpt_push_button.clicked.connect(self.ctrl.set_m_ckpt_path) self.ui.inf_push_button.clicked.connect(self.ctrl.set_m_inf_path) diff --git a/launcher/views/main_view_ui.py b/launcher/views/main_view_ui.py index 02b05bc1..90943963 100644 --- a/launcher/views/main_view_ui.py +++ b/launcher/views/main_view_ui.py @@ -502,42 +502,6 @@ def setupUi(self, main_widget): self.data_v_layout.addLayout(self.paired_h_layout) - self.gen_h_layout = QHBoxLayout() - self.gen_h_layout.setObjectName(u"gen_h_layout") - self.gen_h_layout.setContentsMargins(-1, -1, 0, -1) - self.gen_label = QLabel(self.layoutWidget4) - self.gen_label.setObjectName(u"gen_label") - sizePolicy1.setHeightForWidth(self.gen_label.sizePolicy().hasHeightForWidth()) - self.gen_label.setSizePolicy(sizePolicy1) - self.gen_label.setMinimumSize(QSize(174, 39)) - self.gen_label.setMaximumSize(QSize(174, 39)) - self.gen_label.setFont(font) - - self.gen_h_layout.addWidget(self.gen_label) - - self.gen_line_edit = QLineEdit(self.layoutWidget4) - self.gen_line_edit.setObjectName(u"gen_line_edit") - sizePolicy1.setHeightForWidth(self.gen_line_edit.sizePolicy().hasHeightForWidth()) - self.gen_line_edit.setSizePolicy(sizePolicy1) - self.gen_line_edit.setMinimumSize(QSize(137, 24)) - self.gen_line_edit.setMaximumSize(QSize(137, 24)) - self.gen_line_edit.setFont(font) - - self.gen_h_layout.addWidget(self.gen_line_edit) - - self.gen_push_button = QPushButton(self.layoutWidget4) - self.gen_push_button.setObjectName(u"gen_push_button") - sizePolicy1.setHeightForWidth(self.gen_push_button.sizePolicy().hasHeightForWidth()) - self.gen_push_button.setSizePolicy(sizePolicy1) - self.gen_push_button.setMinimumSize(QSize(28, 20)) - self.gen_push_button.setMaximumSize(QSize(28, 20)) - self.gen_push_button.setFont(font) - - self.gen_h_layout.addWidget(self.gen_push_button) - - - self.data_v_layout.addLayout(self.gen_h_layout) - self.ckpt_h_layout = QHBoxLayout() self.ckpt_h_layout.setObjectName(u"ckpt_h_layout") self.ckpt_label = QLabel(self.layoutWidget4) @@ -608,6 +572,42 @@ def setupUi(self, main_widget): self.data_v_layout.addLayout(self.inf_h_layout) + self.out_h_layout = QHBoxLayout() + self.out_h_layout.setObjectName(u"out_h_layout") + self.out_h_layout.setContentsMargins(-1, -1, 0, -1) + self.out_label = QLabel(self.layoutWidget4) + self.out_label.setObjectName(u"out_label") + sizePolicy1.setHeightForWidth(self.out_label.sizePolicy().hasHeightForWidth()) + self.out_label.setSizePolicy(sizePolicy1) + self.out_label.setMinimumSize(QSize(174, 39)) + self.out_label.setMaximumSize(QSize(174, 39)) + self.out_label.setFont(font) + + self.out_h_layout.addWidget(self.out_label) + + self.out_line_edit = QLineEdit(self.layoutWidget4) + self.out_line_edit.setObjectName(u"out_line_edit") + sizePolicy1.setHeightForWidth(self.out_line_edit.sizePolicy().hasHeightForWidth()) + self.out_line_edit.setSizePolicy(sizePolicy1) + self.out_line_edit.setMinimumSize(QSize(137, 24)) + self.out_line_edit.setMaximumSize(QSize(137, 24)) + self.out_line_edit.setFont(font) + + self.out_h_layout.addWidget(self.out_line_edit) + + self.out_push_button = QPushButton(self.layoutWidget4) + self.out_push_button.setObjectName(u"out_push_button") + sizePolicy1.setHeightForWidth(self.out_push_button.sizePolicy().hasHeightForWidth()) + self.out_push_button.setSizePolicy(sizePolicy1) + self.out_push_button.setMinimumSize(QSize(28, 20)) + self.out_push_button.setMaximumSize(QSize(28, 20)) + self.out_push_button.setFont(font) + + self.out_h_layout.addWidget(self.out_push_button) + + + self.data_v_layout.addLayout(self.out_h_layout) + self.docker_data_v_layout.addWidget(self.data_group_box) @@ -1083,12 +1083,6 @@ def retranslateUi(self, main_widget): self.paired_label.setText(QCoreApplication.translate("main_widget", u"Paired Set", None)) self.paired_line_edit.setText("") self.paired_push_button.setText(QCoreApplication.translate("main_widget", u"...", None)) -#if QT_CONFIG(tooltip) - self.gen_label.setToolTip(QCoreApplication.translate("main_widget", u"The root path of the generated files", None)) -#endif // QT_CONFIG(tooltip) - self.gen_label.setText(QCoreApplication.translate("main_widget", u"Generated Set", None)) - self.gen_line_edit.setText("") - self.gen_push_button.setText(QCoreApplication.translate("main_widget", u"...", None)) #if QT_CONFIG(tooltip) self.ckpt_label.setToolTip(QCoreApplication.translate("main_widget", u"The root path for all checkpoint files saved by Robustar", None)) #endif // QT_CONFIG(tooltip) @@ -1101,6 +1095,12 @@ def retranslateUi(self, main_widget): self.inf_label.setText(QCoreApplication.translate("main_widget", u"Influence Result", None)) self.inf_line_edit.setText("") self.inf_push_button.setText(QCoreApplication.translate("main_widget", u"...", None)) +#if QT_CONFIG(tooltip) + self.out_label.setToolTip(QCoreApplication.translate("main_widget", u"The root path of the generated files", None)) +#endif // QT_CONFIG(tooltip) + self.out_label.setText(QCoreApplication.translate("main_widget", u"Output Folder", None)) + self.out_line_edit.setText("") + self.out_push_button.setText(QCoreApplication.translate("main_widget", u"...", None)) self.model_group_box.setTitle(QCoreApplication.translate("main_widget", u"Model", None)) #if QT_CONFIG(tooltip) self.arch_label.setToolTip(QCoreApplication.translate("main_widget", u"The architecture of the model", None))