ReIdentification
- class ReIdentificationPrediction(id, rank, distance)
A single prediction from
ReIdentification
.- Parameters:
- class ReIdentificationResults(predictions, distance_matrix, duration, image)
All the results of re-identification from
ReIdentification
.Predictions are stored in sorted order, with descending order of rank.
- Parameters:
predictions (
List
[ReIdentificationPrediction
]) – The list of predictions ordered by rank.distance_matrix (
Optional
[ndarray
]) – The cosine distance matrix for the re-identification.duration (
float
) – The duration of the inference.image (
Optional
[ndarray
]) – The image that the inference was performed on.
- property predictions: List[ReIdentificationPrediction]
The list of predictions.
- class ReIdentification(model_id, model_config=None)
Re-identify the object(image) against a set of known/tracked items.
- Parameters:
model_id (
str
) – The ID of the model you want to use for image classification.
- set_per_id_gallery_limit(count, drop_method)
Set the limit of instances per ID to be maintained in the gallery
- extract_features(image, flip_horizontal=True)
Compute feature matrix for the given image
- get_distances(image, gallery_images, flip_horizontal=True, normalize_distance=True)
Calculate the distance matrix between given image and gallery images
- Parameters:
- Return type:
- add_to_gallery(image, id, flip_horizontal=True)
Extract the features for the given image and add against the given ID to the gallery
- remove_from_gallery(id)
Remove all the features corresponding to given ID from the gallery
- Parameters:
id (
int
) – ID for which data needs to be removed
- property accelerator: Accelerator | None
The accelerator being used.
- property colors: ndarray | None
The auto-generated colors for the loaded model.
Note: Initialized to None when the model doesn’t have any labels. Note: To update, the new colors list must be same length as the label list.
- property labels: List[str] | None
The labels for the loaded model.
Note: Initialized to None when the model doesn’t have any labels.
- load(engine=Engine.DNN, accelerator=Accelerator.DEFAULT)
Load the model to an engine and accelerator.
- Parameters:
engine (
Engine
) – The engine to load the model toaccelerator (
Accelerator
) – The accelerator to load the model to
- property model_config: ModelConfig
The configuration of the model that was loaded
- property model_purpose: SupportedPurposes
The purpose of the model being used.
- publish_analytics(results, tag=None, **kwargs)
Publish results to the alwaysAI Analytics Service
Example usage:
try: inference.publish_analytics(results, tag='custom_tag') except edgeiq.PublishError as e: # Retry publish except edgeiq.ConnectionError as e: # Save state and exit app to reconnect
- Parameters:
- Raises:
ConnectionBlockedError
when using connection to the alwaysAI Device Agent and resources are at capacity,- Raises:
PacketRateError
when publish rate exceeds current limit,- Raises:
PacketSizeError
when packet size exceeds current limit. Packet publish size and rate limits will be provided in the error message.
- re_id_image(image, top_k=1, normalize_distance=True, flip_horizontal=True)
Re-identify the given object(image) against a set of known/tracked items (gallery).
- Parameters:
- Return type: