def __init__(self, param, parent): core.CWorkflowTaskWidget.__init__(self, parent) if param is None: self.parameters = TrainFasterRcnnParam() else: self.parameters = param # Create layout : QGridLayout by default self.grid_layout = QGridLayout() self.spin_workers = pyqtutils.append_spin( self.grid_layout, label="Data loader workers", value=self.parameters.cfg["num_workers"], min=0, max=8, step=2) self.spin_batch = pyqtutils.append_spin( self.grid_layout, label="Batch size", value=self.parameters.cfg["batch_size"], min=1, max=1024, step=1) self.spin_epoch = pyqtutils.append_spin( self.grid_layout, label="Epochs", value=self.parameters.cfg["epochs"], min=1) self.spin_size = pyqtutils.append_spin( self.grid_layout, label="Input size", value=self.parameters.cfg["input_size"]) label_model_format = QLabel("Model format") row = self.grid_layout.rowCount() self.grid_layout.addWidget(label_model_format, row, 0) self.check_pth = QCheckBox("pth") self.check_pth.setChecked(self.parameters.cfg["export_pth"]) self.grid_layout.addWidget(self.check_pth, row, 1) self.check_onnx = QCheckBox("onnx") self.check_onnx.setChecked(self.parameters.cfg["export_onnx"]) self.grid_layout.addWidget(self.check_onnx, row + 1, 1) self.browse_folder = pyqtutils.append_browse_file( self.grid_layout, label="Output folder", path=self.parameters.cfg["output_folder"], tooltip="Select output folder", mode=QFileDialog.Directory) # PyQt -> Qt wrapping layout_ptr = qtconversion.PyQtToQt(self.grid_layout) # Set widget layout self.setLayout(layout_ptr)
def __init__(self, param, parent): core.CWorkflowTaskWidget.__init__(self, parent) if param is None: self.parameters = TrainResnetParam() else: self.parameters = param # Create layout : QGridLayout by default self.grid_layout = QGridLayout() self.combo_model = pyqtutils.append_combo(self.grid_layout, "Model name") self.combo_model.addItem("resnet18") self.combo_model.addItem("resnet34") self.combo_model.addItem("resnet50") self.combo_model.addItem("resnet101") self.combo_model.addItem("resnet152") self.spin_workers = pyqtutils.append_spin(self.grid_layout, label="Data loader workers", value=self.parameters.cfg["num_workers"], min=0, max=8, step=2) self.spin_batch = pyqtutils.append_spin(self.grid_layout, label="Batch size", value=self.parameters.cfg["batch_size"], min=1, max=1024, step=1) self.spin_epoch = pyqtutils.append_spin(self.grid_layout, label="Epochs", value=self.parameters.cfg["epochs"], min=1) self.spin_classes = pyqtutils.append_spin(self.grid_layout, label="Classes", value=self.parameters.cfg["classes"], min=1) self.spin_size = pyqtutils.append_spin(self.grid_layout, label="Input size", value=self.parameters.cfg["input_size"]) self.check_pretrained = pyqtutils.append_check(self.grid_layout, label="Pre-trained model", checked=self.parameters.cfg["use_pretrained"]) self.check_features = pyqtutils.append_check(self.grid_layout, label="Feature Extract mode", checked=self.parameters.cfg["feature_extract"]) label_model_format = QLabel("Model format") row = self.grid_layout.rowCount() self.grid_layout.addWidget(label_model_format, row, 0) self.check_pth = QCheckBox("pth") self.check_pth.setChecked(self.parameters.cfg["export_pth"]) self.grid_layout.addWidget(self.check_pth, row, 1) self.check_onnx = QCheckBox("onnx") self.check_onnx.setChecked(self.parameters.cfg["export_onnx"]) self.grid_layout.addWidget(self.check_onnx, row+1, 1) self.browse_folder = pyqtutils.append_browse_file(self.grid_layout, label="Output folder", path=self.parameters.cfg["output_folder"], tooltip="Select output folder", mode=QFileDialog.Directory) # PyQt -> Qt wrapping layout_ptr = qtconversion.PyQtToQt(self.grid_layout) # Set widget layout self.setLayout(layout_ptr)
def __init__(self, param, parent): core.CWorkflowTaskWidget.__init__(self, parent) if param is None: self.parameters = ResnetParam() else: self.parameters = param # Create layout : QGridLayout by default self.grid_layout = QGridLayout() self.combo_model = pyqtutils.append_combo(self.grid_layout, "Model name") self.combo_model.addItem("resnet18") self.combo_model.addItem("resnet34") self.combo_model.addItem("resnet50") self.combo_model.addItem("resnet101") self.combo_model.addItem("resnet152") self.combo_model.setCurrentIndex(self._get_model_name_index()) self.combo_dataset = pyqtutils.append_combo(self.grid_layout, "Trained on") self.combo_dataset.addItem("ImageNet") self.combo_dataset.addItem("Custom") self.combo_dataset.setCurrentIndex(self._get_dataset_index()) self.combo_dataset.currentIndexChanged.connect( self.on_combo_dataset_changed) self.spin_size = pyqtutils.append_spin( self.grid_layout, label="Input size", value=self.parameters.input_size) self.browse_model = pyqtutils.append_browse_file( self.grid_layout, "Model path", self.parameters.model_path) self.browse_classes = pyqtutils.append_browse_file( self.grid_layout, "Classes path", self.parameters.classes_path) if self.parameters.dataset == "ImageNet": self.browse_model.set_path("Not used") self.browse_model.setEnabled(False) self.browse_classes.setEnabled(False) # PyQt -> Qt wrapping layout_ptr = qtconversion.PyQtToQt(self.grid_layout) # Set widget layout self.setLayout(layout_ptr)
def __init__(self, param, parent): core.CWorkflowTaskWidget.__init__(self, parent) if param is None: self.parameters = InferYoloV5Param() else: self.parameters = param # Create layout : QGridLayout by default self.grid_layout = QGridLayout() self.combo_model = pyqtutils.append_combo(self.grid_layout, "Model") self.combo_model.addItem("yolov5n") self.combo_model.addItem("yolov5s") self.combo_model.addItem("yolov5m") self.combo_model.addItem("yolov5l") self.combo_model.addItem("yolov5x") self.combo_model.setCurrentText(self.parameters.model_name) self.combo_dataset = pyqtutils.append_combo(self.grid_layout, "Trained on") self.combo_dataset.addItem("COCO") self.combo_dataset.addItem("Custom") self.combo_dataset.setCurrentIndex(0 if self.parameters.dataset == "COCO" else 1) self.combo_dataset.currentIndexChanged.connect( self.on_combo_dataset_changed) self.label_model_path = QLabel("Model path") self.browse_model = pyqtutils.BrowseFileWidget( path=self.parameters.model_path, tooltip="Select file", mode=QFileDialog.ExistingFile) row = self.grid_layout.rowCount() self.grid_layout.addWidget(self.label_model_path, row, 0) self.grid_layout.addWidget(self.browse_model, row, 1) self.label_model_path.setVisible(False if self.parameters.dataset == "COCO" else True) self.browse_model.setVisible(False if self.parameters.dataset == "COCO" else True) self.spin_size = pyqtutils.append_spin(self.grid_layout, "Input size", self.parameters.input_size) self.spin_confidence = pyqtutils.append_double_spin( self.grid_layout, "Confidence", self.parameters.conf_thres, step=0.05, decimals=2) self.spin_iou = pyqtutils.append_double_spin(self.grid_layout, "IOU threshold", self.parameters.iou_thres, step=0.05, decimals=2) # PyQt -> Qt wrapping layout_ptr = qtconversion.PyQtToQt(self.grid_layout) # Set widget layout self.setLayout(layout_ptr)