def PreviewInferenceDialogue(self): """ Load preview inference dialogue. """ if self.trainInProgress: QtWidgets.QMessageBox.information(self.previewInferenceDialogue, "Cannot Preview Model", "Training is already in progress.", QtWidgets.QMessageBox.Ok) else: # Set generate XML variable self.generateXML = False # Load preview images number ui_general.SetPreviewImagesNum(self, self.previewInferenceDialogue) # Load snapshots dataSets, errorMsg = general.ModelNames(config.snapshots) if errorMsg is not None: errorMessage = "There was an error with preprocessing.get_all_files(). Reason: " + errorMsg self.previewInferenceDialogue.textEdit.append(errorMessage) # Insert snapshots error, errorMsg = ui_general.InsertModels(self.previewInferenceDialogue, dataSets) if error: errorMessage = "Could not add datasets to dialogue. Reason: " + errorMsg self.previewInferenceDialogue.textEdit.append(errorMessage) # Save datasets self.updatePIDatasets = dataSets # Set confidence threshold ui_general.SetConfThresh(self, self.previewInferenceDialogue) # Update model name SetModelName(self) # Update delete models checkbox self.previewInferenceDialogue.deleteModelsCheckBox.setChecked(self.deleteModels) # Make dialogue cursor invisible self.previewInferenceDialogue.textEdit.setCursorWidth(0) # Enable widgets in dialogue EnablePiWidgets(self) # Start update combo timer StartUpdateTimer(self) # Set default button ui_general.DefaultButton(self.previewInferenceDialogue) # Show dialogue self.previewInferenceDialogue.show() # Cancel all if dialogue is rejected (x button is clicked) if self.previewInferenceDialogue.exec_() == QtWidgets.QDialog.Rejected: # Cancel threads ui_general.CancelButton(self, self.previewInferenceDialogue) # Cancel toggle timer StopTogglePiWidgets(self)
def TrainingDialogue2(self): """ Load training config dialogue. """ # Ensure that training is not already in progress if self.trainInProgress: QtWidgets.QMessageBox.information(self.trainDialogue2, "Cannot Edit Training Settings", "Training is already in progress.", QtWidgets.QMessageBox.Ok) else: # Set generate XML variable self.generateXML = False # Set text widgets self.trainDialogue2.epochsText.setText(str(self.epochs)) self.trainDialogue2.batchSizeText.setText(str(self.batchSize)) # Start update combo timer StartUpdateCombo(self) # Load pretrained models dataSets, errorMsg = general.ModelNames(config.pretrainedModels) if errorMsg is not None: errorMessage = "There was an error with preprocessing.get_all_files(). Reason: " + errorMsg self.textEdit.append(errorMessage) # Insert pretrained models error, errorMsg = ui_general.InsertModels(self.trainDialogue2, dataSets) if error: errorMessage = "Could not add datasets to dialogue. Reason: " + errorMsg self.textEdit.append(errorMessage) # Select pretrained model in train dialogue 2 ui_general.SelectPretrainedModel(self) # Save datasets self.updateTRDatasets = dataSets #Set framework combobox self.trainDialogue2.frameworkComboBox.addItem("RetinaNet") # Load training settings ui_general.SetTrainSettings(self) # Show training configuration dialogue self.trainDialogue2.show() # Cancel all if dialogue is rejected (x button is clicked) if self.trainDialogue2.exec_() == QtWidgets.QDialog.Rejected: ui_general.CancelButton(self, self.trainDialogue2)
def UpdateCombo(self): """ Updates combo box when directory changes. """ # Load snapshots dataSets, errorMsg = general.ModelNames(config.snapshots) if errorMsg is not None: errorMessage = "There was an error with preprocessing.get_all_files(). Reason: " + errorMsg self.previewInferenceDialogue.textEdit.append(errorMessage) if dataSets != self.updatePIDatasets: self.updatePIDatasets = dataSets # Insert snapshots error, errorMsg = ui_general.InsertModels(self, self.previewInferenceDialogue, dataSets) if error: errorMessage = "Could not add datasets to dialogue. Reason: " + errorMsg self.previewInferenceDialogue.textEdit.append(errorMessage)
def UpdateCombo(self): """ Updates combo box when directory changes. """ # Load pretrained models dataSets, errorMsg = general.ModelNames(config.pretrainedModels) if errorMsg is not None: errorMessage = "There was an error with preprocessing.get_all_files(). Reason: " + errorMsg self.textEdit.append(errorMessage) if dataSets != self.updateTRDatasets: self.updateTRDatasets = dataSets # Insert pretrained models error, errorMsg = ui_general.InsertModels(self.trainDialogue2, dataSets) if error: errorMessage = "Could not add datasets to dialogue. Reason: " + errorMsg self.textEdit.append(errorMessage)
def UpdateCombos(self): """ Updates combo boxes when directory changes. """ # Load datasets modelList, errorMsg = general.ReturnDirNames(config.datasets) if errorMsg is not None: errorMessage = "Could not add pretrained models. Reason: " + errorMsg self.autoAnnotateDialogue.textEdit.append(errorMessage) if modelList != self.updateAADatasets: self.updateAADatasets = modelList # Insert pretrained models error, errorMsg = ui_general.InsertModels(self.autoAnnotateDialogue, modelList) if error: errorMessage = "Could not add datasets to dialogue. Reason: " + errorMsg self.autoAnnotationDialogue.textEdit.append(errorMessage) if self.multiClassCheckBox: # Load pretrained models dataSets, errorMsg = general.ModelNames(config.snapshots) if errorMsg is not None: errorMessage = "There was an error with preprocessing.get_all_files(). Reason: " + errorMsg self.autoAnnotateDialogue.textEdit.append(errorMessage) if dataSets != self.updateAAAnnotateDatasets: self.updateAAAnnotateDatasets = dataSets # Insert pretrained models error, errorMsg = InsertAnnotateModels(self.autoAnnotateDialogue, dataSets) if error: errorMessage = "Could not add datasets to dialogue. Reason: " + errorMsg self.autoAnnotateDialogue.textEdit.append(errorMessage)
def AutoAnnotateDialogue(self): """ Load auto-annotate dialogue. """ if self.trainInProgress: QtWidgets.QMessageBox.information(self.autoAnnotateDialogue, "Cannot Open Auto-Annotator", "Training is already in progress.", QtWidgets.QMessageBox.Ok) else: # Load datasets #dataSets, error, errorMsg = interface_preprocessing.ReturnDatasets(config.datasets) modelList, errorMsg = general.ReturnDirNames(config.datasets) if errorMsg is not None: errorMessage = "Could not add models. Reason: " + errorMsg self.autoAnnotateDialogue.textEdit.append(errorMessage) # Insert pretrained models error, errorMsg = ui_general.InsertModels(self.autoAnnotateDialogue, modelList) if error: errorMessage = "Could not add datasets to dialogue. Reason: " + errorMsg self.textEdit.append(errorMessage) # Add single class name self.autoAnnotateDialogue.annotatorComboBox.addItem( "single_class_annotator.h5") # Save datasets self.updateAADatasets = modelList # Update showImagesCheckBox self.autoAnnotateDialogue.showImagesCheckBox.setChecked( self.showImages) # Set confidence threshold ui_general.SetConfThresh(self, self.autoAnnotateDialogue) # Update delete models checkbox self.autoAnnotateDialogue.multiClassCheckBox.setChecked( self.multiClassCheckBox) # Update single class name UpdateClassName(self) # Start update combo timer StartUpdateTimer(self) # Make dialogue cursor invisible self.autoAnnotateDialogue.textEdit.setCursorWidth(0) # Set default button ui_general.DefaultButton(self.autoAnnotateDialogue) # Show dialogue self.autoAnnotateDialogue.show() # Cancel all if dialogue is rejected (x button is clicked) if self.autoAnnotateDialogue.exec_() == QtWidgets.QDialog.Rejected: # Cancel threads ui_general.CancelButton(self, self.autoAnnotateDialogue) # Cancel toggle timer StopToggleAaWidgets(self)
def RunInferenceDialogue(self): """ Load run inference dialogue. """ if self.trainInProgress: QtWidgets.QMessageBox.information(self, "Object Detection Unavailable", "Training is already in progress.", QtWidgets.QMessageBox.Ok) else: # Set generate XML variable self.generateXML = False # Load models dataSets, errorMsg = general.ModelNames(config.pretrainedModels) if errorMsg is not None: errorMessage = "There was an error with preprocessing.get_all_files(). Reason: " + errorMsg self.previewInferenceDialogue.textEdit.append(errorMessage) # Insert models error, errorMsg = ui_general.InsertModels(self.runInferenceDialogue, dataSets) if error: errorMessage = "Could not add datasets to dialogue. Reason: " + errorMsg self.previewInferenceDialogue.textEdit.append(errorMessage) # Save datasets self.updateRIDatasets = dataSets # Set confidence threshold ui_general.SetConfThresh(self, self.runInferenceDialogue) # Make dialogue cursor invisible self.runInferenceDialogue.textEdit.setCursorWidth(0) # Update self.generateReport value self.generateReport = self.generateReportRi # Update showImagesCheckBox self.runInferenceDialogue.showImagesCheckBox.setChecked( self.showImages) # Update reportCheckBox self.runInferenceDialogue.reportCheckBox.setChecked( self.generateReport) # Update image count, if directory already previously selected if self.testImagesPath is not None: GetRunImagesCount(self, False) # Update reportTitle UpdateReportTitle(self) # Disable/enable report title ToggleReportTitle(self) # Enable widgets in dialogue EnableRiWidgets(self) # Start update combo timer StartUpdateTimer(self) # Set default button ui_general.DefaultButton(self.runInferenceDialogue) # Show dialogue self.runInferenceDialogue.show() # Close threads, if dialogue is rejected (x button is clicked) if self.runInferenceDialogue.exec_() == QtWidgets.QDialog.Rejected: ui_general.CancelButton(self, self.runInferenceDialogue) # Cancel toggle timer StopToggleRiWidgets(self)