nicetoolbox.detectors.method_detectors.head_orientation.spiga_detector

SPIGA method detector class.

Functions

extract_key_per_value

Extracts keys from a dictionary based on the type of their values.

return_direction_vector

Classes

Spiga

SPIGA is a method detector that computes the head_orientation component.

class nicetoolbox.detectors.method_detectors.head_orientation.spiga_detector.Spiga(config, io, data)[source]

SPIGA is a method detector that computes the head_orientation component.

Component: head_orientation

components

A list containing the name of the component: head_orientation

Type:

list

algorithm

Algorithm name used to compute the head_orientation component.

Type:

str

camera_names

List of camera names used to capture original input data.

Type:

list

Initialize the SPIGA method detector with all inference preparation.

Parameters:
  • config (dict) – Configuration settings for SPIGA.

  • io (class) – IO class instance for input/output operations.

  • data (class) – Data class instance for frame and subject data.

post_inference()[source]

Calculate head orientation in 2D image after SPIGA inference.

visualization(data)[source]

Abstract method to visualize the output of the method, preferably as a video.

This method is intended to generate a visual representation of the method detector’s output. The visualization should be saved in the self.viz_folder.

Parameters:

data (any) – The data to be visualized. The type and content of this parameter depend on the specific implementation of the method detector.

Returns:

None. This method does not return any value. However, it should save the

visualization in the self.viz_folder.

Raises:

NotImplementedError – If this method is not implemented in the derived classes.

nicetoolbox.detectors.method_detectors.head_orientation.spiga_detector.extract_key_per_value(input_dict)[source]

Extracts keys from a dictionary based on the type of their values.

If all values in the dictionary are integers, it returns a list of keys. If any value is a list, it appends an index to the key to create a unique key.

Parameters:

input_dict (dict) – The input dictionary to extract keys from.

Returns:

A list of keys extracted from the input dictionary.

Return type:

return_keys (list)

Raises:
  • NotImplementedError – If a value in the dictionary is neither an integer nor a

  • list.