Merge features: 1.autoSaving while nexting 2.Add predefined classes 3. avoid using 0-valued coordinates, from https://github.com/tzutalin/labelImg/pull/1
This commit is contained in:
parent
ef61f0d827
commit
66645103e5
BIN
icons/prev.png
Normal file
BIN
icons/prev.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
12
labelImg.py
12
labelImg.py
@ -65,13 +65,17 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
# Whether we need to save or not.
|
# Whether we need to save or not.
|
||||||
self.dirty = False
|
self.dirty = False
|
||||||
|
|
||||||
|
# Enble auto saving if pressing next
|
||||||
|
self.autoSaving = True
|
||||||
self._noSelectionSlot = False
|
self._noSelectionSlot = False
|
||||||
self._beginner = True
|
self._beginner = True
|
||||||
self.screencastViewer = "firefox"
|
self.screencastViewer = "firefox"
|
||||||
self.screencast = "https://youtu.be/p0nR2YsCY_U"
|
self.screencast = "https://youtu.be/p0nR2YsCY_U"
|
||||||
|
|
||||||
# Main widgets and related state.
|
# Main widgets and related state.
|
||||||
self.labelDialog = LabelDialog(parent=self)
|
predefined_classes = ['person', 'dog']
|
||||||
|
self.labelHist = predefined_classes
|
||||||
|
self.labelDialog = LabelDialog(parent=self, listItem=self.labelHist)
|
||||||
|
|
||||||
self.labelList = QListWidget()
|
self.labelList = QListWidget()
|
||||||
self.itemsToShapes = {}
|
self.itemsToShapes = {}
|
||||||
@ -822,8 +826,14 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
|
|
||||||
|
|
||||||
def openNextImg(self, _value=False):
|
def openNextImg(self, _value=False):
|
||||||
|
# Proceding next image without dialog if having any label
|
||||||
|
if self.autoSaving is True and self.defaultSaveDir is not None:
|
||||||
|
if self.dirty is True and self.hasLabels():
|
||||||
|
self.saveFile()
|
||||||
|
|
||||||
if not self.mayContinue():
|
if not self.mayContinue():
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(self.mImgList) <= 0:
|
if len(self.mImgList) <= 0:
|
||||||
return
|
return
|
||||||
filename = self.mImgList.pop(0)
|
filename = self.mImgList.pop(0)
|
||||||
|
|||||||
@ -49,3 +49,4 @@ class LabelDialog(QDialog):
|
|||||||
def listItemClick(self, tQListWidgetItem):
|
def listItemClick(self, tQListWidgetItem):
|
||||||
text = tQListWidgetItem.text().trimmed()
|
text = tQListWidgetItem.text().trimmed()
|
||||||
self.edit.setText(text)
|
self.edit.setText(text)
|
||||||
|
self.validate()
|
||||||
|
|||||||
@ -87,8 +87,18 @@ class LabelFile(object):
|
|||||||
for p in points:
|
for p in points:
|
||||||
x = p[0]
|
x = p[0]
|
||||||
y = p[1]
|
y = p[1]
|
||||||
xmin = min(x,xmin)
|
xmin = min(x,xmin)
|
||||||
ymin = min(y,ymin)
|
ymin = min(y,ymin)
|
||||||
xmax = max(x,xmax)
|
xmax = max(x,xmax)
|
||||||
ymax = max(y,ymax)
|
ymax = max(y,ymax)
|
||||||
|
|
||||||
|
# Martin Kersner, 2015/11/12
|
||||||
|
# 0-valued coordinates of BB caused an error while
|
||||||
|
# training faster-rcnn object detector.
|
||||||
|
if (xmin < 1):
|
||||||
|
xmin = 1
|
||||||
|
|
||||||
|
if (ymin < 1):
|
||||||
|
ymin = 1
|
||||||
|
|
||||||
return (int(xmin), int(ymin), int(xmax), int(ymax))
|
return (int(xmin), int(ymin), int(xmax), int(ymax))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user