[trackingdata] scores returns None, if no detections in range
This commit is contained in:
parent
d300f72949
commit
35be41282a
@ -169,11 +169,11 @@ class TrackingData(QObject):
|
||||
numpy.ndarray
|
||||
A NumPy array of type float32 containing the keypoint scores of the shape (N, M)
|
||||
with N the number of detections and M the number of keypoints.
|
||||
"""
|
||||
"""
|
||||
if selection:
|
||||
if len(self._indices) < 1:
|
||||
logging.info("TrackingData.scores returns empty array, not detections in range!")
|
||||
return np.ndarray([])
|
||||
return None
|
||||
return np.stack(self._data["keypoint_score"][self._indices]).astype(np.float32)
|
||||
return np.stack(self._data["keypoint_score"]).astype(np.float32)
|
||||
|
||||
@ -195,6 +195,8 @@ class TrackingData(QObject):
|
||||
A NumPy array of shape (N, 2) containing the center of gravity for each detection.
|
||||
"""
|
||||
scores = self.keypointScores(selection)
|
||||
if scores is None:
|
||||
return None
|
||||
scores[scores < threshold] = 0.0
|
||||
scores[:, np.setdiff1d(np.arange(scores.shape[1]), nodes)] = 0.0
|
||||
weighted_coords = self.coordinates(selection=selection) * scores[:, :, np.newaxis]
|
||||
|
Loading…
Reference in New Issue
Block a user