get_current_predictions
  • 1 Minute to read

get_current_predictions


Article summary

This method returns the model's predictions just once at the moment it is called. It is used when the model is activated with continues_msg in True. It takes the information from the topic that are publishing.

Reference

Arguments

ArgumentsTypeDefault valueDescription
as_dictboolFalseIf set to true, the predictions will be sent as a dictionary; otherwise, they will be returned as a list.
get_timestampboolFalseIf set to true, a tuple with the predictions and the prediction timestamp will be returned; otherwise, only the predictions will be returned.

Return

if as_dict is True and get_timestamp is True:

TypeDescription
tuple(dict, tuple) Dictionary with prediccions and tuple with timestamp (sec, nanosec).

if as_dict is True and get_timestamp is False:

TypeDescription
dictDictionary with prediccions.

if as_dict is False and get_timestamp is True:

TypeDescription
tuple(list, tuple) List with prediccions and tuple with timestamp (sec, nanosec).

if as_dict is False and get_timestamp is False:

TypeDescription
listList with prediccions.

Exceptions

None

See the complete list of cv exceptions.

Examples

...
self.predictor = await self.cv.enable_model(
        name='predictor_name',
        continues_msg=True,
        source='chest',
    )
...
last_predictions, timestamp = \
        await self.predictor.get_current_predictions(get_timestamp=True)
...

Was this article helpful?