lib.sedna.core.multi_edge_inference.components.feature_extraction

Module Contents

Classes

FEService

In MultiEdgeInference, the Feature Extraction component

class lib.sedna.core.multi_edge_inference.components.feature_extraction.FEService(consumer_topics=['object_detection'], producer_topics=['enriched_object'], plugins: List[sedna.core.multi_edge_inference.plugins.PluggableNetworkService] = [], models: List[sedna.core.multi_edge_inference.plugins.PluggableModel] = [], timeout=10, asynchronous=False)[source]

Bases: sedna.core.multi_edge_inference.components.BaseService

In MultiEdgeInference, the Feature Extraction component is deployed in the edge or the cloud and it used to extract ReID features from frames received by the ObjectDetector component and send back to it the enriched data using Kafka or REST API.

Parameters:
  • consumer_topics (List) – A list of Kafka topics used to communicate with the Object Detector service (to receive data from it). This is accessed only if the Kafka backend is in use.

  • producer_topics (List) – A list of Kafka topics used to communicate with the Object Detector service (to send data to it). This is accessed only if the Kafka backend is in use.

  • plugins (List) – A list of PluggableNetworkService. It can be left empty as the FeatureExtraction service is already preconfigured to connect to the correct network services.

  • models (List) – A list of PluggableModel. By passing a specific instance of the model, it is possible to customize the FeatureExtraction component to, for example, extract differently the objects features.

  • timeout (int) – It sets a timeout condition to terminate the main fetch loop after the specified amount of seconds has passed since we received the last frame.

  • asynchronous (bool) – If True, the AI processing will be decoupled from the data acquisition step. If False, the processing will be sequential. In general, set it to True when ingesting a stream (e.g., RTSP) and to False when reading from disk (e.g., a video file).

Examples

model = FeatureExtractionAI() # A class implementing the PluggableModel abstract class (example pedestrian_tracking/feature_extraction/worker.py)

fe_service = FEService(models=[model], asynchronous=False)

Notes

For the parameters described above, only ‘models’ has to be defined, while for others the default value will work in most cases.

process_data(ai, data, **kwargs)[source]

The user needs to implement this function to call the main processing function of the AI model and decide what to do with the result.

update_operational_mode(status)[source]

The user needs to trigger updates to the AI model, if necessary.

get_target_features(ldata)[source]