in camera-sdk/iotccsdk/camera.py [0:0]
def get_inferences(self):
"""
Inference generator for the application.
This inference generator gives inferences from the VA metadata stream.
Yields
------
AiCameraInference: `AiCameraInference` class object
This `AiCameraInference` object yielded
from `VideoInferenceIterator.start()`
Raises
------
EOFError
If the preview is not started.
Or if the vam is not started.
"""
if not self.preview_running:
raise EOFError("preview not started")
if not self.vam_running:
raise EOFError("VAM not started")
if self.cur_resolution == "4K":
preview_width = 3840
preview_height = 2160
elif self.cur_resolution == "1080P":
preview_width = 1920
preview_height = 1080
elif self.cur_resolution == "720P":
preview_width = 1280
preview_height = 720
elif self.cur_resolution == "480P":
preview_width = 640
preview_height = 480
inference_iterator = VideoInferenceIterator(
preview_width, preview_height)
try:
if self.vam_url == "":
self._get_vam_info()
if NULL_IP in self.vam_url:
self.vam_url.replace(NULL_IP, LOOPBACK_IP)
yield inference_iterator.start(self.vam_url)
except Exception as e:
self.logger.exception(e)
raise
finally:
inference_iterator.stop()