[some improvements]
This commit is contained in:
parent
116e0ce5de
commit
03ebb6485a
@ -84,7 +84,7 @@ class TrackingData(QObject):
|
|||||||
logging.debug("TrackingData.setSelection: %i number of ids", len(ids))
|
logging.debug("TrackingData.setSelection: %i number of ids", len(ids))
|
||||||
self._selection_indices = self._find(ids)
|
self._selection_indices = self._find(ids)
|
||||||
self._selected_ids = ids
|
self._selected_ids = ids
|
||||||
print(self._selected_ids, self._selection_indices)
|
# print(self._selected_ids, self._selection_indices)
|
||||||
|
|
||||||
def setTrack(self, track_id:int, setUserLabeled:bool=True)-> None:
|
def setTrack(self, track_id:int, setUserLabeled:bool=True)-> None:
|
||||||
"""Assign a new track_id to the user-selected detections
|
"""Assign a new track_id to the user-selected detections
|
||||||
@ -97,12 +97,12 @@ class TrackingData(QObject):
|
|||||||
Should the "userlabeled" state of the detections be set to True? Otherwise they will be left untouched.
|
Should the "userlabeled" state of the detections be set to True? Otherwise they will be left untouched.
|
||||||
"""
|
"""
|
||||||
logging.info("TrackingData: set track id %i for selection, set user-labeled status %s", track_id, str(setUserLabeled))
|
logging.info("TrackingData: set track id %i for selection, set user-labeled status %s", track_id, str(setUserLabeled))
|
||||||
print(self._selected_ids, self._selection_indices)
|
# print(self._selected_ids, self._selection_indices)
|
||||||
print("before: ", self["track"][self._selection_indices], self["frame"][self._selection_indices])
|
# print("before: ", self["track"][self._selection_indices], self["frame"][self._selection_indices])
|
||||||
self["track"][self._selection_indices] = track_id
|
self["track"][self._selection_indices] = track_id
|
||||||
if setUserLabeled:
|
if setUserLabeled:
|
||||||
self.setUserLabeledStatus(True, True)
|
self.setUserLabeledStatus(True, True)
|
||||||
print("after: ", self["track"][self._selection_indices], self["frame"][self._selection_indices])
|
# print("after: ", self["track"][self._selection_indices], self["frame"][self._selection_indices])
|
||||||
|
|
||||||
def setUserLabeledStatus(self, new_status: bool, selection=True):
|
def setUserLabeledStatus(self, new_status: bool, selection=True):
|
||||||
"""Sets the status of the "userlabeled" column to a given value (True|False). This can done for ALL data in one go, or only for the UserSelection.
|
"""Sets the status of the "userlabeled" column to a given value (True|False). This can done for ALL data in one go, or only for the UserSelection.
|
||||||
|
@ -94,6 +94,7 @@ class ConsistencyWorker(QRunnable):
|
|||||||
logging.debug("Encountered probably invalid position %s", str(self.positions[i]))
|
logging.debug("Encountered probably invalid position %s", str(self.positions[i]))
|
||||||
continue
|
continue
|
||||||
if self._min_confidence > 0.0 and self.confidence[i] < self._min_confidence:
|
if self._min_confidence > 0.0 and self.confidence[i] < self._min_confidence:
|
||||||
|
self.tracks[i] = -1
|
||||||
continue
|
continue
|
||||||
d = Detection(i, frame, self.tracks[i], self.positions[i],
|
d = Detection(i, frame, self.tracks[i], self.positions[i],
|
||||||
self.orientations[i], self.lengths[i],
|
self.orientations[i], self.lengths[i],
|
||||||
@ -135,7 +136,7 @@ class ConsistencyWorker(QRunnable):
|
|||||||
|
|
||||||
def check_multiple_detections(detections):
|
def check_multiple_detections(detections):
|
||||||
if self._min_confidence > 0.0:
|
if self._min_confidence > 0.0:
|
||||||
for i, d in detections:
|
for i, d in enumerate(detections):
|
||||||
if d.confidence < self._min_confidence:
|
if d.confidence < self._min_confidence:
|
||||||
del detections[i]
|
del detections[i]
|
||||||
distances = np.zeros((len(detections), len(detections)))
|
distances = np.zeros((len(detections), len(detections)))
|
||||||
@ -236,6 +237,7 @@ class ConsistencyWorker(QRunnable):
|
|||||||
if assignments[0] == assignments[1]:
|
if assignments[0] == assignments[1]:
|
||||||
d.track = -1
|
d.track = -1
|
||||||
error = True
|
error = True
|
||||||
|
errors += 1
|
||||||
message = f"Frame {f}: Classification error: both detections in the same frame are assigned to the same track!"
|
message = f"Frame {f}: Classification error: both detections in the same frame are assigned to the same track!"
|
||||||
break
|
break
|
||||||
elif assignments[0] != assignments[1]:
|
elif assignments[0] != assignments[1]:
|
||||||
@ -254,6 +256,7 @@ class ConsistencyWorker(QRunnable):
|
|||||||
self.tracks[detections[0].id] = -1
|
self.tracks[detections[0].id] = -1
|
||||||
message = f"Frame: {f}: Decision based on distance not safe. Track set to unassigned."
|
message = f"Frame: {f}: Decision based on distance not safe. Track set to unassigned."
|
||||||
error = True
|
error = True
|
||||||
|
errors += 1
|
||||||
|
|
||||||
if not error:
|
if not error:
|
||||||
for k in temp:
|
for k in temp:
|
||||||
@ -263,7 +266,7 @@ class ConsistencyWorker(QRunnable):
|
|||||||
for idx in indices:
|
for idx in indices:
|
||||||
self.tracks[idx] = -1
|
self.tracks[idx] = -1
|
||||||
errors += 1
|
errors += 1
|
||||||
if self._stoponerror:
|
if error and self._stoponerror:
|
||||||
self.signals.message.emit(message)
|
self.signals.message.emit(message)
|
||||||
break
|
break
|
||||||
processed += 1
|
processed += 1
|
||||||
@ -271,6 +274,7 @@ class ConsistencyWorker(QRunnable):
|
|||||||
if steps > 0 and f % steps == 0:
|
if steps > 0 and f % steps == 0:
|
||||||
progress += 1
|
progress += 1
|
||||||
self.signals.progress.emit(progress, processed, errors)
|
self.signals.progress.emit(progress, processed, errors)
|
||||||
|
|
||||||
self.signals.message.emit(f"Tracking stopped at frame {f}.")
|
self.signals.message.emit(f"Tracking stopped at frame {f}.")
|
||||||
self.signals.stopped.emit(f)
|
self.signals.stopped.emit(f)
|
||||||
|
|
||||||
@ -475,6 +479,7 @@ class ConsistencyClassifier(QWidget):
|
|||||||
self._all_lengths = None
|
self._all_lengths = None
|
||||||
self._all_bendedness = None
|
self._all_bendedness = None
|
||||||
self._all_scores = None
|
self._all_scores = None
|
||||||
|
self._confidence = None
|
||||||
self._userlabeled = None
|
self._userlabeled = None
|
||||||
self._maxframes = 0
|
self._maxframes = 0
|
||||||
self._frames = None
|
self._frames = None
|
||||||
@ -603,6 +608,7 @@ class ConsistencyClassifier(QWidget):
|
|||||||
self._startframe_spinner.setMaximum(max_startframe)
|
self._startframe_spinner.setMaximum(max_startframe)
|
||||||
self._startframe_spinner.setValue(min_startframe)
|
self._startframe_spinner.setValue(min_startframe)
|
||||||
self._startframe_spinner.setSingleStep(20)
|
self._startframe_spinner.setSingleStep(20)
|
||||||
|
self._startframe_spinner.setToolTip(f"Maximum possible start frame: {max_startframe}")
|
||||||
self._startbtn.setEnabled(True)
|
self._startbtn.setEnabled(True)
|
||||||
self._assignedlabel.setText("0")
|
self._assignedlabel.setText("0")
|
||||||
self._errorlabel.setText("0")
|
self._errorlabel.setText("0")
|
||||||
|
@ -55,8 +55,10 @@ class FixTracks(QWidget):
|
|||||||
self._keypointcombo = QComboBox()
|
self._keypointcombo = QComboBox()
|
||||||
self._keypointcombo.currentIndexChanged.connect(self.on_keypointSelected)
|
self._keypointcombo.currentIndexChanged.connect(self.on_keypointSelected)
|
||||||
|
|
||||||
self._gotoframe = QSpinBox()
|
self._goto_spinner = QSpinBox()
|
||||||
self._gotoframe.setSingleStep(1)
|
self._goto_spinner.setSingleStep(1)
|
||||||
|
self._goto_spinner.returnPressed.connect(self.on_goto)
|
||||||
|
|
||||||
self._gotobtn = QPushButton("go!")
|
self._gotobtn = QPushButton("go!")
|
||||||
self._gotobtn.setToolTip("Jump to a given frame")
|
self._gotobtn.setToolTip("Jump to a given frame")
|
||||||
self._gotobtn.clicked.connect(self.on_goto)
|
self._gotobtn.clicked.connect(self.on_goto)
|
||||||
@ -65,12 +67,12 @@ class FixTracks(QWidget):
|
|||||||
combo_layout.addWidget(QLabel("Window width:"))
|
combo_layout.addWidget(QLabel("Window width:"))
|
||||||
combo_layout.addWidget(self._windowspinner)
|
combo_layout.addWidget(self._windowspinner)
|
||||||
combo_layout.addWidget(QLabel("frames"))
|
combo_layout.addWidget(QLabel("frames"))
|
||||||
combo_layout.addItem(QSpacerItem(10, 10, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed))
|
combo_layout.addItem(QSpacerItem(10, 10, QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed))
|
||||||
combo_layout.addWidget(QLabel("Keypoint:"))
|
combo_layout.addWidget(QLabel("Keypoint:"))
|
||||||
combo_layout.addWidget(self._keypointcombo)
|
combo_layout.addWidget(self._keypointcombo)
|
||||||
combo_layout.addItem(QSpacerItem(10, 10, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed))
|
combo_layout.addItem(QSpacerItem(10, 10, QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed))
|
||||||
combo_layout.addWidget(QLabel("Jump to frame:"))
|
combo_layout.addWidget(QLabel("Jump to frame:"))
|
||||||
combo_layout.addWidget(self._gotoframe)
|
combo_layout.addWidget(self._goto_spinner)
|
||||||
combo_layout.addWidget(self._gotobtn)
|
combo_layout.addWidget(self._gotobtn)
|
||||||
combo_layout.addItem(QSpacerItem(100, 10, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed))
|
combo_layout.addItem(QSpacerItem(100, 10, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed))
|
||||||
combo_layout.setSpacing(1)
|
combo_layout.setSpacing(1)
|
||||||
@ -234,7 +236,7 @@ class FixTracks(QWidget):
|
|||||||
self._currentWindowPos = 0
|
self._currentWindowPos = 0
|
||||||
self._currentWindowWidth = self._windowspinner.value()
|
self._currentWindowWidth = self._windowspinner.value()
|
||||||
self._maxframes = np.max(self._data["frame"])
|
self._maxframes = np.max(self._data["frame"])
|
||||||
self._gotoframe.setMaximum(self._maxframes)
|
self._goto_spinner.setMaximum(self._maxframes)
|
||||||
self.populateKeypointCombo(self._data.numKeypoints())
|
self.populateKeypointCombo(self._data.numKeypoints())
|
||||||
self._timeline.setData(self._data)
|
self._timeline.setData(self._data)
|
||||||
# self._timeline.setWindow(self._currentWindowPos / self._maxframes,
|
# self._timeline.setWindow(self._currentWindowPos / self._maxframes,
|
||||||
@ -359,7 +361,7 @@ class FixTracks(QWidget):
|
|||||||
self._controls_widget.setSelectedTracks(None)
|
self._controls_widget.setSelectedTracks(None)
|
||||||
|
|
||||||
def on_goto(self):
|
def on_goto(self):
|
||||||
target = self._gotoframe.value()
|
target = self._goto_spinner.value()
|
||||||
if target > self._maxframes - self._currentWindowWidth:
|
if target > self._maxframes - self._currentWindowWidth:
|
||||||
target = self._maxframes - self._currentWindowWidth
|
target = self._maxframes - self._currentWindowWidth
|
||||||
logging.info("Jump to frame %i", target)
|
logging.info("Jump to frame %i", target)
|
||||||
|
Loading…
Reference in New Issue
Block a user