def __init__(self, text="Enter object label", parent=None, listItem=None):
        super(LabelDialog, self).__init__(parent)

        self.edit = QLineEdit()
        self.edit.setText(text)
        self.edit.setValidator(labelValidator())
        self.edit.editingFinished.connect(self.postProcess)

        model = QStringListModel()
        model.setStringList(listItem)
        completer = QCompleter()
        completer.setModel(model)
        self.edit.setCompleter(completer)

        layout = QVBoxLayout()
        layout.addWidget(self.edit)
        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)
        layout.addWidget(bb)

        if listItem is not None and len(listItem) > 0:
            self.listWidget = QListWidget(self)
            for item in listItem:
                self.listWidget.addItem(item)
            self.listWidget.itemClicked.connect(self.listItemClick)
            self.listWidget.itemDoubleClicked.connect(self.listItemDoubleClick)
            layout.addWidget(self.listWidget)

        self.setLayout(layout)
示例#2
0
    def __init__(self, parent=None, listcheck=None, curCpt=None):
        super(choose_checkpoint, self).__init__()
        self.setWindowTitle('Choose checkpoint product use')

        self.listCheckBox = listcheck
        self.curCpt = curCpt
        grid = QGridLayout()
        self.choose = None
        self.ButtonGroup = QButtonGroup()
        for i, c in enumerate(self.listCheckBox):
            self.listCheckBox[i] = QRadioButton(c)
            if c == self.curCpt:
                self.listCheckBox[i].setStyleSheet("font-weight:bold;")
            self.ButtonGroup.addButton(self.listCheckBox[i])
            grid.addWidget(self.listCheckBox[i], i, 0)

        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Ok).setText('Choose')

        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.acceptCheckpoint)
        bb.rejected.connect(self.reject)
        grid.addWidget(bb)
        self.resize(self.sizeHint())

        self.setLayout(grid)
示例#3
0
    def __init__(self, checkpointDf=None, parent=None):
        super(trainning_history_dialog, self).__init__()

        self.isStop = False
        self.checkpointDf = checkpointDf
        self.tableWidget = QTableWidget()
        self.setData()
        self.tableWidget.resize(self.tableWidget.sizeHint())

        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)

        bb.button(BB.Cancel).setIcon(newIcon('cancel'))
        bb.button(BB.Cancel).hide()

        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Ok).setText('Ok')

        bb.accepted.connect(self.continueBtn)

        # Add box layout, add table to box layout and add box layout to widget
        self.layout = QGridLayout()

        self.Label1 = QLabel('History Train')
        self.Label1.setAlignment(Qt.AlignCenter)
        self.layout.addWidget(self.Label1)

        self.layout.addWidget(self.tableWidget)
        self.setLayout(self.layout)
        self.layout.addWidget(bb, 1, 0)
示例#4
0
    def __init__(self, text="Enter object label", parent=None, ocr=None, mImgList=None, lenbar=0):
        super(AutoDialog, self).__init__(parent)
        self.setFixedWidth(1000)
        self.parent = parent
        self.ocr = ocr
        self.mImgList = mImgList
        self.pb = QProgressBar()
        self.pb.setRange(0, lenbar)
        self.pb.setValue(0)

        layout = QVBoxLayout()
        layout.addWidget(self.pb)
        self.model = 'paddle'
        self.listWidget = QListWidget(self)
        layout.addWidget(self.listWidget)

        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)
        layout.addWidget(bb)
        bb.button(BB.Ok).setEnabled(False)

        self.setLayout(layout)
        # self.setWindowTitle("自动标注中")
        self.setWindowModality(Qt.ApplicationModal)

        # self.setWindowFlags(Qt.WindowCloseButtonHint)

        self.thread_1 = Worker(self.ocr, self.mImgList, self.parent, 'paddle')
        self.thread_1.progressBarValue.connect(self.handleProgressBarSingal)
        self.thread_1.listValue.connect(self.handleListWidgetSingal)
        self.thread_1.endsignal.connect(self.handleEndsignalSignal)
示例#5
0
    def __init__(self):
        super(AngleDialog, self).__init__()
        title = 'Angle rotate win'
        self.setWindowTitle(title)

        self.count = 0
        self.layout = QGridLayout()

        edit = QLineEdit()
        edit.setText('0')

        edit.setValidator(labelValidator())

        model = QStringListModel()
        completer = QCompleter()
        completer.setModel(model)
        edit.setCompleter(completer)
        self.mainLabel = edit
        self.mainLabel.setValidator(QIntValidator())
        self.mainLabel.setFocus()
        self.layout.addWidget(self.mainLabel)

        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.accept)

        bb.rejected.connect(self.reject)

        # self.layout.addWidget(self.addBtn, 1, 1)
        self.layout.addWidget(bb)

        self.setLayout(self.layout)
示例#6
0
    def __init__(self, label=None, subLabels=None):
        super(LabelDialog, self).__init__()
        title = 'Label win'
        self.setWindowTitle(title)

        self.count = 0
        self.layout = QGridLayout()

        self.layout_label = QGridLayout()
        self.listLabel = []
        self.mainLabel = None

        self.addLabel(txt=label, opt=False)
        if subLabels is not None:
            for lb in subLabels:
                self.addLabel(lb)

        self.addBtn = QPushButton('Add')
        self.addBtn.clicked.connect(
            lambda x: self.addLabel(txt=None, listHint=[], opt=True))

        self.saveCheckBox = QCheckBox('Save format')
        self.saveCheckBox.setChecked(False)

        checkAddLayout = QVBoxLayout()
        checkAddLayout.addWidget(self.saveCheckBox)
        checkAddLayout.addWidget(self.addBtn)

        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)

        self.layout.addLayout(self.layout_label, 0, 0, 1, 5)
        self.layout.addLayout(checkAddLayout, 0, 5)

        # self.layout.addWidget(self.addBtn, 1, 1)
        self.layout.addWidget(bb, 2, 0)

        self.layout.setColumnStretch(0, 5)
        self.layout.setColumnStretch(1, 1)
        self.layout.setColumnStretch(2, 1)

        self.setLayout(self.layout)
        # self.mainLabel.show
        # self.resize(self.sizeHint())

        # self.mainLabel.setMinimumWidth(300)
        # self.mainLabel.showMaximized()
        # self.showMaximized()

        self.mainLabel.setFocus()
示例#7
0
    def __init__(self, checkpointDf=None, parent=None, training_log=None):
        super(TrainStatus, self).__init__()
        title = 'Train Status'
        self.setWindowTitle(title)

        self.isStop = False
        self.parent = parent

        self.checkpointDf = checkpointDf
        self.tableWidget = QTableWidget()
        self.setData()
        self.tableWidget.resize(self.tableWidget.sizeHint())
        self.tableWidget.doubleClicked.connect(self.on_click)

        self.training_log = training_log
        if self.training_log is not None:
            self.tableWidget_log = QTableWidget()
            self.setData_log()
            self.tableWidget_log.resize(self.tableWidget_log.sizeHint())
            if 'Error' not in self.training_log:
                self.tableWidget_log.doubleClicked.connect(self.on_click_log)

        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)

        bb.button(BB.Cancel).setIcon(newIcon('cancel'))
        bb.button(BB.Cancel).hide()

        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Ok).setText('Ok')

        bb.accepted.connect(self.continueBtn)

        # Add box layout, add table to box layout and add box layout to widget
        self.layout = QGridLayout()

        self.Label1 = QLabel('Finished models')
        self.Label1.setAlignment(Qt.AlignCenter)
        self.layout.addWidget(self.Label1)
        self.layout.addWidget(self.tableWidget)

        if self.training_log is not None:
            self.Label2 = QLabel('Traning Status')
            self.Label2.setAlignment(Qt.AlignCenter)
            self.layout.addWidget(self.Label2)
            self.layout.addWidget(self.tableWidget_log)

        self.setLayout(self.layout)
        self.layout.addWidget(bb, 1, 0)
示例#8
0
    def __init__(self, text="Enter text", parent=None):
        super(TextDialog, self).__init__(parent)

        self.edit = QLineEdit()
        self.edit.setText(text)
        self.edit.setValidator(labelValidator())
        self.edit.editingFinished.connect(self.postProcess)

        layout = QVBoxLayout()
        layout.addWidget(self.edit)
        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)
        layout.addWidget(bb)

        self.setLayout(layout)
示例#9
0
    def __init__(self, text="", parent=None):
        super(confirmDialog, self).__init__(parent)

        self.setWindowTitle("请确认")
        self.label = QLabel()
        self.label.setText(text)
        self.confirmFlag = False

        layout = QVBoxLayout()
        layout.addWidget(self.label)
        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)
        layout.addWidget(bb)

        self.setLayout(layout)
示例#10
0
    def __init__(self, checkpointDf=None, parent=None, training_log=None):
        super(trainning_log_dialog, self).__init__()

        self.isStop = False

        self.checkpointDf = checkpointDf
        if self.checkpointDf.shape[0] > 0:
            self.tableWidget = QTableWidget()
            self.setData()
            self.tableWidget.resize(self.tableWidget.sizeHint())

        self.training_log = training_log
        if self.training_log is not None:
            self.tableWidget_log = QTableWidget()
            self.setData_log()
            self.tableWidget_log.resize(self.tableWidget_log.sizeHint())

        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)

        bb.button(BB.Cancel).setIcon(newIcon('cancel'))
        bb.button(BB.Cancel).setText('Stop Train')

        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Ok).setText('Ok')

        bb.accepted.connect(self.continueBtn)
        bb.rejected.connect(self.stopbtn)

        bb.button(BB.Cancel).show()

        # Add box layout, add table to box layout and add box layout to widget
        self.layout = QGridLayout()
        if self.checkpointDf.shape[0] > 0:
            self.Label1 = QLabel('training history')
            self.Label1.setAlignment(Qt.AlignCenter)
            self.layout.addWidget(self.Label1)
            self.layout.addWidget(self.tableWidget)
        if self.training_log is not None:
            self.Label2 = QLabel('training status')
            self.Label2.setAlignment(Qt.AlignCenter)
            self.layout.addWidget(self.Label2)
            self.layout.addWidget(self.tableWidget_log)
        self.layout.addWidget(bb)
        self.setLayout(self.layout)
示例#11
0
    def __init__(self, imagePath, parent=None):
        super(QCustomQWidget, self).__init__(parent)
        self.imagePath = imagePath
        self.parent = parent
        self.textUpQLabel = QLabel()
        self.allQHBoxLayout = QHBoxLayout()
        self.iconQLabel = None
        # self.iconQLabel = QLabel()
        self.allQHBoxLayout.addWidget(self.iconQLabel)
        self.allQHBoxLayout.addWidget(self.textUpQLabel)

        self.btn = QPushButton('')
        self.btn.setIcon(newIcon('rotate90_2'))
        self.btn.clicked.connect(self.rotater)
        self.allQHBoxLayout.addWidget(self.btn)

        self.CBox = QCheckBox()
        self.CBox.setChecked(False)
        # self.CBox.resize(QSize(10,10))
        # self.CBox.setStyleSheet("color: white; border: 3px solid; background-color: white;")
        self.CBox.setStyleSheet('''background-color: white;''')

        self.allQHBoxLayout.addWidget(self.CBox)
        self.CBox.setFixedSize(self.CBox.sizeHint())

        self.VBoxLayout = QVBoxLayout()
        self.VBoxLayout.addLayout(self.allQHBoxLayout)

        self.line = QHLine()
        self.VBoxLayout.addWidget(self.line, Qt.AlignBottom)
        self.line.resize(self.line.minimumSizeHint())
        self.line.setStyleSheet("padding-top: 5px;  color: black;")
        self.line.hide()

        self.setLayout(self.VBoxLayout)
        self.textUpQLabel.setStyleSheet('''
            color: rgb(255, 255, 255);
        ''')
        # # pxmap = QPixmap(imagePath)

        self.imageData = self.read(self.imagePath, None)
        # img = cv2.imdecode(np.fromstring(self.imageData, np.uint8), cv2.IMREAD_COLOR)

        # img = cv2.imdecode(np.fromstring(self.imageData, np.uint8), cv2.IMREAD_COLOR)
        # if img is not None:
        #     image = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
        #
        #     height, width, byteValue = image.shape
        #     byteValue = byteValue * width
        #
        #     image = QImage(image, width, height, byteValue, QImage.Format_RGB888)
        #
        #     self.iconQLabel.setPixmap(QPixmap.fromImage(image).scaledToWidth(64))

        self.textUpQLabel.setText(os.path.basename(imagePath))
示例#12
0
    def __init__(self, parent=None):
        super(set_api_adress, self).__init__()
        self.setWindowTitle('set IP adress of server')

        self.parent = parent
        self.cur_api_adress = self.parent.api_adress
        grid = QGridLayout()

        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Ok).setText('Choose')

        self.lineEdit = QLineEdit()
        self.lineEdit.setText('{}'.format(self.cur_api_adress))
        grid.addWidget(self.lineEdit)

        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.accept_api_adress)
        bb.rejected.connect(self.reject)
        grid.addWidget(bb)
        self.resize(self.sizeHint())
        self.setLayout(grid)
    def __init__(self, parent=None, listItem=None):
        super(LabelDialog, self).__init__(parent)

        self.edit = QLineEdit()

        layout = QVBoxLayout()
        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.validate)
        bb.rejected.connect(self.reject)
        layout.addWidget(bb)

        if listItem is not None and len(listItem) > 0:
            self.listWidget = QListWidget(self)
            for item in listItem:
                self.listWidget.addItem(item)
            self.listWidget.itemClicked.connect(self.listItemClick)
            self.listWidget.itemDoubleClicked.connect(self.listItemDoubleClick)
            layout.addWidget(self.listWidget)

        self.setLayout(layout)
示例#14
0
def get_main_app(argv=[]):
    """
    Standard boilerplate Qt application code.
    Do everything but app.exec_()
    -- so that we can test the application in one thread
    """
    app = QApplication(argv)
    app.setApplicationName(__appname__)
    app.setWindowIcon(newIcon("logo"))
    # Tzutalin 201705+: Accept extra agruments to change predefined class file
    # Usage : labelImg.py image predefClassFile saveDir
    win = StartWindow(
        __appname__,
        Path(argv[1]) if len(argv) >= 2 else nonePath,
        Path(argv[2]) if len(argv) >= 3 else
        (Path(argv[0]).parent / Path('data') / Path('predefined_classes.txt')),
        Path(argv[3]) if len(argv) >= 4 else nonePath)
    win.show()
    return app, win
示例#15
0
    def __init__(self,
                 parent=None,
                 data_folders={
                     'aa': ['a.txt'],
                     'ccc': ['c.txt'],
                     'dd': ['b.txt'],
                     'ee': ['b.txt']
                 }):
        super(viewServerDataDialog, self).__init__()
        title = 'List folder data from server'
        self.setWindowTitle(title)
        grid = QGridLayout()

        self.exists_folders_label = QLabel('Exists data in server')
        grid.addWidget(self.exists_folders_label)

        self.parent = parent
        self.data_folders = data_folders
        self.name_folders = list(data_folders.keys())
        # self.fileListWidget = QGridLayout()
        self.scrollArea = QScrollArea(self)
        self.scrollArea.setWidgetResizable(True)
        self.scrollAreaWidgetContents = QWidget()
        self.fileListWidget = QGridLayout(self.scrollAreaWidgetContents)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        grid.addWidget(self.scrollArea)

        self.foldername = ''
        self.Label1 = QLabel('Your choose:')
        self.Label1.hide()

        self.nameLabel = QLabel('{}'.format(self.foldername))
        self.nameLabel.hide()

        self.nameLabelLayout = QHBoxLayout()
        self.nameLabelLayout.addWidget(self.Label1)
        self.nameLabelLayout.addWidget(self.nameLabel)

        self.folderList = []
        for i, fname in enumerate(self.name_folders):
            myQCustomQWidget = QCustomQWidget_3(folder_icon_path,
                                                text=fname,
                                                nameLabel=self.nameLabel,
                                                parent=self)
            self.fileListWidget.addWidget(myQCustomQWidget, i // 3, i % 3)
            self.folderList.append(myQCustomQWidget)

        self.note = QLabel('')
        self.note.hide()
        grid.addWidget(self.note)

        grid.addItem(self.nameLabelLayout)

        self.saveDirLayout = QHBoxLayout()

        self.saveDir = os.getcwd()

        self.buttonBox = bb = BB(BB.Save | BB.No | BB.Cancel, Qt.Horizontal,
                                 self)

        self.buttonBox.button(BB.Save).clicked.connect(self.download)
        self.buttonBox.button(BB.No).clicked.connect(self.delFolder)
        self.buttonBox.button(BB.Cancel).clicked.connect(self.reject)

        self.buttonBox.button(BB.No).setIcon(newIcon('del'))
        self.buttonBox.button(BB.No).setText('Del')

        # bb.Save.connect(self.accept_check)
        grid.addWidget(bb)

        w_size = int(QFontMetrics(QFont()).width(title) * 1.6)

        self.setMinimumWidth(w_size)
        self.setLayout(grid)
        self.show()
示例#16
0
    def __init__(self,
                 parent=None,
                 listData=['a', 'c'],
                 listPretrain=['c', 'd'],
                 listnote=['c', 'd'],
                 numEpoch=1000,
                 charlists=None):
        super(trainDialog, self).__init__()
        title = 'Setting To Start Training'
        self.setWindowTitle(title)
        listData = sorted(listData)
        self.listDataBox = len(listData) * ['']
        grid = QGridLayout()
        self.choose = []
        self.dataLabel = QLabel('Data folders')
        grid.addWidget(self.dataLabel, 0, 1)

        self.scrollArea = QScrollArea(self)
        self.scrollArea.setWidgetResizable(True)
        self.scrollAreaWidgetContents = QWidget()
        self.listDataWidget = QGridLayout(self.scrollAreaWidgetContents)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        grid.addWidget(self.scrollArea, 1, 1, 10, 1)

        # grid.setColumnStretch(1, 5)

        for i, v in enumerate(listData):
            self.listDataBox[i] = QCheckBox(v)
            self.listDataWidget.addWidget(self.listDataBox[i], i + 1, 0)

        self.PretrainLabel = QLabel('Pretrain checkpoint')
        grid.addWidget(self.PretrainLabel, 0, 0)
        self.listPretrainBox = QComboBox(self)
        self.listPretrain = listPretrain
        for i, (v, note) in enumerate(zip(listPretrain, listnote)):
            self.listPretrainBox.addItem('{} (note: {})'.format(v, note))
        grid.addWidget(self.listPretrainBox, 1, 0)

        self.charlistLabel = QLabel('Charlist file')
        grid.addWidget(self.charlistLabel, 2, 0)
        self.charlistsBox = QComboBox(self)
        self.charlists = charlists
        for i, v in enumerate(charlists):
            self.charlistsBox.addItem('{}'.format(v))
        grid.addWidget(self.charlistsBox, 3, 0)

        self.numEpochLabel = QLabel('Number Epochs trainning')
        grid.addWidget(self.numEpochLabel, 4, 0)
        self.numEpochEdit = QLineEdit()
        self.numEpochEdit.setPlaceholderText('number epoch')
        self.numEpochEdit.setText('{}'.format(numEpoch))
        self.numEpochEdit.setValidator(QIntValidator())
        grid.addWidget(self.numEpochEdit, 5, 0)

        self.prefixNameLabel = QLabel(
            'Model tag insert to folder checkpoint name')
        grid.addWidget(self.prefixNameLabel, 6, 0)
        self.prefixNameEdit = QLineEdit()
        self.prefixNameEdit.setPlaceholderText('model_tag')
        self.prefixNameEdit.setText('{}'.format('model_tag'))
        # self.numEpochEdit.setValidator(QIntValidator())
        grid.addWidget(self.prefixNameEdit, 7, 0)

        # grid.addWidget(self.scrollArea, 0, 1)

        self.buttonBox = bb = BB(BB.Ok | BB.Cancel, Qt.Horizontal, self)
        bb.button(BB.Ok).setIcon(newIcon('done'))
        bb.button(BB.Ok).setText('Train')

        bb.button(BB.Cancel).setIcon(newIcon('undo'))
        bb.accepted.connect(self.acceptTraining)
        bb.rejected.connect(self.reject)
        grid.addWidget(bb)

        w_size = int(QFontMetrics(QFont()).width(title) * 1.6)

        self.setMinimumWidth(w_size)
        self.setLayout(grid)