Exemplo n.º 1
0
def test_checkModelReady_TrainWindow():

    widget = TrainWindow(True)

    widget.setModel(1)

    assert widget._is_model_ready is True
Exemplo n.º 2
0
def test_conformDatasetToCOCO_TrainWindow(qtbot):

    if not os.path.exists("../data/datasets/p2p3_dummy_dataset"):
        p1 = subprocess.Popen([
            'mkdir', '-p', '../data/datasets/p2p3_dummy_dataset/train_dataset'
        ])
        p1.communicate()
        p2 = subprocess.Popen(
            ['mkdir', '-p', '../data/datasets/p2p3_dummy_dataset/val_dataset'])
        p2.communicate()

    widget = TrainWindow(True)
    qtbot.addWidget(widget)

    qtbot.mouseClick(widget.generate_button, QtCore.Qt.LeftButton)

    assert widget.label_train_process is not None
    widget.label_train_process.kill()
    assert widget.label_val_process is not None
    widget.label_val_process.kill()

    # Clean up test materials.
    if os.path.exists('../data/datasets/p2p3_dummy_dataset'):
        p3 = subprocess.Popen(
            ['rm', '-r', '../data/datasets/p2p3_dummy_dataset'])
        p3.communicate()
Exemplo n.º 3
0
def test_setDataset_TrainWindow(qtbot):

    widget = TrainWindow(True)
    qtbot.addWidget(widget)

    qtbot.mouseClick(widget.dataset_button, QtCore.Qt.LeftButton)

    assert widget._is_dataset_linked is True
Exemplo n.º 4
0
def test_setLabelList_TrainWindow(qtbot):

    widget = TrainWindow(True)
    qtbot.addWidget(widget)

    qtbot.mouseClick(widget.list_button, QtCore.Qt.LeftButton)

    assert widget._is_labellist_linked is True
Exemplo n.º 5
0
def test_setP3_TrainWindow(qtbot):

    widget = TrainWindow()
    qtbot.addWidget(widget)

    qtbot.mouseClick(widget.p3_button, QtCore.Qt.LeftButton)

    assert widget._precision_level == 3
Exemplo n.º 6
0
    def __init__(self):
        '''
        The constructor.
        Sets the size of the window.
        Calls setButtons function to populate window with button.
        '''
        super().__init__()

        self.train_window = TrainWindow(False)
        self.deploy_window = DeployWindow(False)
        self.isTrainOpen = False
        self.isDeployOpen = False

        self._WINDOW_HEIGHT = 375
        self._WINDOW_WIDTH = 500

        self.setWindowTitle('easy_perception_deployment')
        self.setGeometry(0, 0, self._WINDOW_WIDTH, self._WINDOW_HEIGHT)

        self.setButtons()
Exemplo n.º 7
0
def test_runLabelme_TrainWindow(qtbot):

    widget = TrainWindow()
    qtbot.addWidget(widget)

    qtbot.mouseClick(widget.label_button, QtCore.Qt.LeftButton)

    isLabelmeRunning = widget.label_process.poll()
    assert isLabelmeRunning is None

    widget.label_process.kill()
Exemplo n.º 8
0
def test_setModel_TrainWindow(qtbot):

    widget = TrainWindow()
    qtbot.addWidget(widget)

    qtbot.mouseClick(widget.p1_button, QtCore.Qt.LeftButton)
    qtbot.keyClicks(widget.model_selector, 'resnet')

    assert widget.model_name == 'resnet'

    qtbot.mouseClick(widget.p2_button, QtCore.Qt.LeftButton)
    qtbot.keyClicks(widget.model_selector, 'fasterrcnn')

    assert widget.model_name == 'fasterrcnn'

    qtbot.mouseClick(widget.p3_button, QtCore.Qt.LeftButton)
    qtbot.keyClicks(widget.model_selector, 'maskrcnn')

    assert widget.model_name == 'maskrcnn'
Exemplo n.º 9
0
def test_validateDataset_TrainWindow(qtbot):

    widget = TrainWindow()
    qtbot.addWidget(widget)

    widget._precision_level = 1
    widget._path_to_dataset = "invalid_path_to_dataset"
    qtbot.mouseClick(widget.validate_button, QtCore.Qt.LeftButton)

    assert widget._is_dataset_labelled is False

    widget._precision_level = 2
    qtbot.mouseClick(widget.validate_button, QtCore.Qt.LeftButton)
    assert widget._is_dataset_labelled is False

    widget._precision_level = 3
    qtbot.mouseClick(widget.validate_button, QtCore.Qt.LeftButton)
    assert widget._is_dataset_labelled is False
Exemplo n.º 10
0
class MainWindow(QWidget):
    '''
    The MainWindow class is a PySide2 Graphical User Interface (GUI) window
    that starts up as the first user interface.
    '''
    def __init__(self):
        '''
        The constructor.
        Sets the size of the window.
        Calls setButtons function to populate window with button.
        '''
        super().__init__()

        self.train_window = TrainWindow(False)
        self.deploy_window = DeployWindow(False)
        self.isTrainOpen = False
        self.isDeployOpen = False

        self._WINDOW_HEIGHT = 375
        self._WINDOW_WIDTH = 500

        self.setWindowTitle('easy_perception_deployment')
        self.setGeometry(0, 0, self._WINDOW_WIDTH, self._WINDOW_HEIGHT)

        self.setButtons()

    def setButtons(self):
        '''A Mutator function that defines all buttons in MainWindow.'''
        self.train_button = QPushButton('Train', self)
        self.train_button.setIcon(QIcon('img/train.png'))
        self.train_button.setIconSize(QSize(100, 100))
        self.train_button.setGeometry(0, 0, self._WINDOW_WIDTH / 2, 250)

        self.deploy_button = QPushButton('Deploy', self)
        self.deploy_button.setIcon(QIcon('img/deploy.png'))
        self.deploy_button.setIconSize(QSize(100, 100))
        self.deploy_button.setGeometry(self._WINDOW_WIDTH / 2, 0,
                                       self._WINDOW_WIDTH / 2, 250)

        self.quit_button = QPushButton('Quit', self)
        self.quit_button.setIcon(QIcon('img/quit.png'))
        self.quit_button.setIconSize(QSize(250, 250))
        self.quit_button.setGeometry(0, 250, self._WINDOW_WIDTH, 125)

        self.train_button.clicked.connect(self.openTrainWindow)
        self.deploy_button.clicked.connect(self.deployPackage)
        self.quit_button.clicked.connect(self.closeWindow)

    def deployPackage(self):
        '''A function that is triggered by the button labelled, Deploy.'''
        # Start Deploy window that allows you to set the
        self.isDeployOpen = not self.isDeployOpen

        if (self.isDeployOpen):
            self.deploy_window.show()
        else:
            self.deploy_window.close()

    def openTrainWindow(self):
        '''A function that is triggered by the button labelled, Train.'''
        self.isTrainOpen = not self.isTrainOpen

        if (self.isTrainOpen):
            self.train_window.show()
        else:
            self.train_window.close()

    def closeWindow(self):
        '''A function that is triggered by the button labelled, Quit.'''
        self.close()
        self.train_window.close()
        self.deploy_window.close()
Exemplo n.º 11
0
def test_populateModelSelector_TrainWindow(qtbot):

    widget = TrainWindow()
    qtbot.addWidget(widget)

    widget._precision_level = 1
    widget.populateModelSelector()

    assert len(widget._model_list) == 7

    widget._precision_level = 2
    widget.populateModelSelector()

    assert widget._model_list[0] == 'fasterrcnn'

    widget._precision_level = 3
    widget.populateModelSelector()

    assert widget._model_list[0] == 'maskrcnn'
Exemplo n.º 12
0
def test_validateTraining_TrainWindow(qtbot):

    widget = TrainWindow()
    qtbot.addWidget(widget)

    widget._precision_level = 2

    widget.validateTraining()
    assert widget.buttonConnected is False

    widget._is_model_ready = True
    widget.validateTraining()
    assert widget.buttonConnected is False

    widget._is_dataset_linked = True
    widget.validateTraining()
    assert widget.buttonConnected is False

    widget._is_labellist_linked = True
    widget.validateTraining()
    assert widget.buttonConnected is False

    widget._precision_level = 1
    widget.validateTraining()
    assert widget.buttonConnected is True

    widget.buttonConnected = False
    widget._precision_level = 2
    widget._is_dataset_labelled = True
    widget.validateTraining()
    assert widget.buttonConnected is True