nicetoolbox.detectors.feature_detectors.proximity.body_distance¶
Body Distance feature detector class for the proximity component.
Classes
The BodyDistance class is a feature detector that computes the proximity component. |
- class nicetoolbox.detectors.feature_detectors.proximity.body_distance.BodyDistance(io, data, sequence_context, algorithm_instance: str)[source]¶
The BodyDistance class is a feature detector that computes the proximity component.
The BodyDistance feature detector calculates the Euclidean distance between keypoints of different individuals in the scene, essentially determining the proximity between individuals from one frame to the next.
Initialize base detector with references.
Subclasses should call super().__init__() and set inference_config.
- compute()[source]¶
Computes the proximity component.
This method calculates the Euclidean distance between the keypoints of personL and personR. If the length of the keypoint index list is greater than 1, the midpoint of the keypoints will be used in the proximity measure.
The results are saved in a numpy .npz file with the following structure: - body_distance_2d: A numpy array containing the proximity scores in 2D. - body_distance_3d: A numpy array containing the proximity scores in 3D. - data_description: A dictionary containing the data description for the above
output numpy arrays. See the documentation of the output for more details.
- Returns:
A dictionary containing the proximity scores (2D and/or 3D).
- Return type:
out_dict (dict)
- visualization(out_dict)[source]¶
Creates visualizations for the computed proximity component.
The visualization includes a line graph of the proximity scores over time, and the proximity scores are also displayed on top of the original video frames. The video is saved as ‘proximity_score_on_video.mp4’ in the visualization folder.
- Parameters:
out_dict (dict) – A dictionary containing the proximity scores computed by the feature detector. It should contain keys ‘body_distance_2d’ and/or
'body_distance_3d' – scores for the respective dimension.
proximity (each mapping to a numpy array containing the) – scores for the respective dimension.