dgs.models.embedding_generator.embedding_generator.EmbeddingGeneratorModule¶
- class dgs.models.embedding_generator.embedding_generator.EmbeddingGeneratorModule(*args: Any, **kwargs: Any)[source]¶
Base class for handling modules of embedding generators.
Description¶
Given some model-specific data through the State, child models of this class will predict one embedding per single sample (detection) of data, describing it. The child models should also work for batched input data.
Params¶
- embedding_size (int):
The size of the embedding. This size does not necessarily have to match other embedding sizes.
- nof_classes (int):
The number of classes in the dataset. Used during training to predict the id.
Optional Params¶
- embedding_key (str, optional):
The key to use to retrieve the embedding of the image. Default
DEF_VAL.embed_gen.embedding_key
.- save_embeddings (bool, optional):
Whether to save the computed embeddings in the given
State
. DefaultDEF_VAL.embed_gen.save_embeddings
.
- __init__(config: dict[str, any], path: list[str])[source]¶
Methods
configure_torch_module
(module[, train])Set compute mode and send model to the device or multiple parallel devices if applicable.
Return whether the embedding_key of this model exists in a given state.
forward
(ds)Predict next outputs, given any data in a State object, using this Re-ID model.
Terminate this module and all of its submodules.
validate_params
(validations[, attrib_name])Given per key validations, validate this module's parameters.
Attributes
Get the device of this module.
Get whether this module is set to training-mode.
Get the name of the module.
Get the name of the module.
Get the escaped name of the module usable in filepaths by replacing spaces and underscores.
Get the (floating point) precision used in multiple parts of this module.
The size of the embedding.
The number of classes in the dataset / embedding.