Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions tests/fixtures/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,16 @@ def valid_bboxes_dataset_in_seconds(valid_bboxes_dataset):

@pytest.fixture
def valid_bboxes_dataset_with_nan(valid_bboxes_dataset):
"""Return a valid bboxes dataset with NaN values in the position array."""
# Set 3 NaN values in the position array for id_0
valid_bboxes_dataset.position.loc[
{"individual": "id_0", "time": [3, 7, 8]}
] = np.nan
"""Return a valid bboxes dataset with NaN values for some detections.
A missing detection is represented by NaN in the ``position``, ``shape``
and ``confidence`` arrays simultaneously, mirroring how real bounding box
data (e.g. from VIA-tracks) encodes frames where an individual is absent.
Here, individual ``id_0`` is missing at frames 3, 7 and 8.
"""
nan_selection = {"individual": "id_0", "time": [3, 7, 8]}
valid_bboxes_dataset.position.loc[nan_selection] = np.nan
valid_bboxes_dataset.shape.loc[nan_selection] = np.nan
valid_bboxes_dataset.confidence.loc[nan_selection] = np.nan
Comment thread
anna-teruel marked this conversation as resolved.
Outdated
return valid_bboxes_dataset


Expand Down
Loading