Data API
reid.ReIDSplit
dataclass
Holds one split: its image paths and each image's person and camera IDs.
A split is a query split, a gallery split, or a full dataset that an evaluation protocol divides into query and gallery. Its number of images is fixed once built, so its IDs always line up with its images; to add, remove, or relabel images, build a new split, which is checked again.
Attributes:
| Name | Type | Description |
|---|---|---|
image_paths |
Sequence[str]
|
Path of each image, |
pids |
ndarray
|
Person ID of each image. Shape |
camids |
ndarray
|
Camera ID of each image. Shape |
gallery_junk_pids |
frozenset[int]
|
Person IDs whose gallery images are ignored when
ranking, such as Market-1501's bad detections ( |
reid.load_identity_folders(root)
Load identity folders into one ReIDSplit, scanning the disk once.
Expects <root>/<identity>/<image>.(jpg|jpeg|png|bmp): tracking crops or
any identity-labelled pictures. Identity folders are sorted by name and
assigned contiguous person IDs (0..N-1). Camera IDs are set to -1
because the folders carry no camera information; protocols assign synthetic
camera IDs where retrieval needs them. Pass the split to
reid.ReIDModel.evaluate, whose protocol picks the query and gallery
images from it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str | Path
|
Dataset root with one subdirectory per identity. |
required |
Returns:
| Type | Description |
|---|---|
ReIDSplit
|
A |
ReIDSplit
|
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
reid.load_market1501(root)
Load Market-1501 query and gallery splits from root.
Expects query/ and bounding_box_test/. Person and camera IDs are
parsed from filenames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str | Path
|
Path to the Market-1501 directory. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ReIDSplit, ReIDSplit]
|
Query and gallery as |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
ValueError
|
If an image file name does not start with
|
reid.load_msmt17(root)
Load MSMT17 query and gallery splits from root.
Expects test/, list_query.txt, and list_gallery.txt, whose lines
read path pid. The camera ID comes from the image file name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
str | Path
|
Path to the MSMT17 directory. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ReIDSplit, ReIDSplit]
|
Query and gallery as |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
ValueError
|
If a list line is not |