dgs.models.dataset.torchreid_pose_dataset.TorchreidPoseDataManager¶
- class dgs.models.dataset.torchreid_pose_dataset.TorchreidPoseDataManager(*args: Any, **kwargs: Any)[source]¶
Custom torchreid DataManager for pose-based data.
- Parameters:
root – Root path to the directory containing all the datasets.
sources – The types of source pose dataset(s).
**kwargs – Additional keyword arguments, see Other Parameters below.
combineall (bool) – Combine train, query and gallery in a dataset for training. Default is False.
targets (Type[TorchreidPoseDataset] | list[Type[TorchreidPoseDataset]]) – The types of target dataset(s). If not given, it equals to
sources
.transforms (list[str | Callable]) – One or multiple transformations applied to model training. Default is ‘random_flip’.
train_sampler (str) – Name of the Sampler during training. Default “RandomSampler”.
use_gpu (bool) – Whether to use the gpu. Default is True.
batch_size_train (int) – The number of images in a training batch. Default is 32.
batch_size_test (int) – The number of images in a test batch. Default is 32.
num_instances (int) – The number of instances per identity in a batch. Default is 4.
num_cams (int) – The number of cameras to sample in a batch (when using
RandomDomainSampler
). Default is 1.num_datasets (int) – The number of datasets to sample in a batch (when using
RandomDatasetSampler
). Default is 1.train_sampler – Name of the torchreid sampler. Default is RandomSampler.
train_sampler_t (str) – Name of the torchreid sampler for the target train loader. Default is RandomSampler.
verbose (bool) – Print more debug information. Default is False.
workers (int) – Number of workers for the torch DataLoader. As long as no multi-GPU context is available, this value should not be changed. Default 0.
Notes
The original image-based transforms are overwritten to support key-points as input.
Methods
- __init__(root: str, sources: Type[TorchreidPoseDataset] | list[Type[TorchreidPoseDataset]], **kwargs) None [source]¶
- static build_transforms(transforms: str | list[str] | callable | list[callable] | None = None, **kwargs)[source]¶
Build transforms for pose data. Can’t use torchreid transforms.
Possible transforms:¶
- random_flip
Randomly flip along the horizontal or vertical axis.
- random_horizontal_flip
Randomly flip along the horizontal axis.
- random_vertical_flip
Randomly flip along the vertical axis.
- random_move
Adds normally distributed noise to the key points.
- random_resize
Randomly resizes the key points by a factor in range (0.95, 1.05)
- param transforms:
List of transform names or functions which will be applied to the data during training. Not used for testing! The transforms will be inserted into a tvt.Compose in the order they are defined in this list. Default is None.
- keyword random_horizontal_flip_prob:
Probability of flipping the coordinates horizontally. Default 0.5
- kwtype random_horizontal_flip_prob:
float
- keyword random_vertical_flip_prob:
Probability of flipping the coordinates vertically. Default 0.5
- kwtype random_vertical_flip_prob:
float
- keyword random_move_prob:
Probability to use add normally distributed movement. Default 0.5
- kwtype random_move_prob:
float
- keyword random_resize_prob:
Probability to randomly resize. Default 0.5
- kwtype random_resize_prob:
float
- keyword random_flip_prob:
Probability of using random flipping. Default 0.5
- kwtype random_flip_prob:
float
- keyword random_flip_probs:
When a ‘random_flip’ is done, these are the probabilities of flipping horizontal and vertical. Default [0.8, 0.2]
- kwtype random_flip_probs:
list[float]
- returns:
One composed transform for training and testing.
- rtype:
(tvt.Compose, tvt.Compose)
- raises ValueError:
If
transforms
is an invalid object or contains invalid transform names.