sima.operations =============== .. py:module:: sima.operations Attributes ---------- .. autoapisummary:: sima.operations.logger Classes ------- .. autoapisummary:: sima.operations.ColorConversionCodes sima.operations.SimaOperation sima.operations.SimaOperationCVU sima.operations.SimaGenericPreproc sima.operations.SimaQuantTess sima.operations.SimaDetessDequant sima.operations.SimaModelRunner sima.operations.SimaBoxRender sima.operations.SimaBoxDecode Functions --------- .. autoapisummary:: sima.operations.get_json sima.operations.set_log_level sima.operations.resize sima.operations.cvtColor Module Contents --------------- .. py:data:: logger .. py:class:: ColorConversionCodes Generic enumeration. Derive from this class to define new enumerations. .. py:attribute:: COLOR_BGRTORGB :value: 'SIMA_COLOR_BGRTORGB' .. py:attribute:: COLOR_RGBTOBGR :value: 'SIMA_COLOR_RGBTOBGR' .. py:attribute:: COLOR_BGRTOGRAY :value: 'SIMA_COLOR_BGRTOGRAY' .. py:attribute:: COLOR_RGBTOGRAY :value: 'SIMA_COLOR_RGBTOGRAY' .. py:attribute:: COLOR_IYUVTOBGR :value: 'SIMA_COLOR_IYUVTOBGR' .. py:attribute:: COLOR_IYUVTONV12 :value: 'SIMA_COLOR_IYUVTONV12' .. py:attribute:: COLOR_NV12TOBGR :value: 'SIMA_COLOR_NV12TOBGR' .. py:attribute:: COLOR_BGRTONV12 :value: 'SIMA_COLOR_BGRTONV12' .. py:attribute:: COLOR_RGBTONV12 :value: 'SIMA_COLOR_RGBTONV12' .. py:attribute:: COLOR_NV12TORGB :value: 'SIMA_COLOR_NV12TORGB' .. py:class:: SimaOperation(name: str, configuration: dict) .. py:attribute:: configuration .. py:attribute:: name .. py:method:: configure(config: dict) -> None .. py:method:: run(tensor: numpy.ndarray) -> numpy.ndarray :abstractmethod: Abstract method for executing the operation. .. py:class:: SimaOperationCVU(name: str, configuration: dict) .. py:attribute:: offset :value: None .. py:attribute:: cvu_obj :value: None .. py:method:: configure(config: dict) -> None Configure CVU-specific settings. .. py:method:: run(tensor: numpy.ndarray) -> numpy.ndarray Abstract method for executing the operation. .. py:class:: SimaGenericPreproc(parser_obj) .. py:method:: run(tensor: numpy.ndarray) -> numpy.ndarray Run the CVU operation. .. py:class:: SimaQuantTess(parser_obj) .. py:method:: run(tensor: numpy.ndarray) -> numpy.ndarray Run the CVU operation. .. py:class:: SimaDetessDequant(parser_obj) .. py:attribute:: tensor_shapes .. py:method:: reshape_ev_buffer(tensor: numpy.ndarray) -> List[numpy.ndarray] Reshape flattened EV buffer to list of tensors .. py:method:: run(tensor: numpy.ndarray) -> numpy.ndarray Abstract method for executing the operation. .. py:class:: SimaModelRunner(parser_obj) .. py:attribute:: parser_obj .. py:method:: configure(config: dict) -> None .. py:method:: run(tensor: numpy.ndarray) -> numpy.ndarray Abstract method for executing the operation. .. py:class:: SimaBoxRender A class for rendering bounding boxes on images using ARM A65 Core. .. py:attribute:: apu_obj :value: None .. py:method:: render(image: numpy.ndarray, boxes: spy.defines.BoundingBox, frame_width: int, frame_height: int, labelfile: str) -> numpy.ndarray :classmethod: Renders bounding boxes and labels on the given image. :param image: Input image. :type image: np.ndarray :param boxes: List of bounding boxes with attributes (_x, _y, _w, _h, _class_id). :type boxes: list[BoundingBox] :param frame_height: Height of the frame. :type frame_height: int :param frame_width: Width of the frame. :type frame_width: int :param label_map_file: Path to the label map file (used only for first-time initialization). :type label_map_file: str :returns: Image with rendered bounding boxes and labels. :rtype: np.ndarray .. py:class:: SimaBoxDecode(parser_obj) .. py:attribute:: parser_obj .. py:attribute:: apu_obj .. py:method:: configure(config: dict) -> None .. py:method:: run(tensor: numpy.ndarray) -> numpy.ndarray Abstract method for executing the operation. .. py:function:: get_json(config, name) .. py:function:: set_log_level(level: spy.logger.LogLevel) Set the log level for the PePPi component. This function configures the verbosity of logging for PePPi, controlling which log messages are recorded. Logs are written to the file located at: ``/var/log/simaai_peppi.log``. :param level: The desired logging level (e.g., DEBUG, INFO, WARNING, ERROR). :type level: LogLevel .. py:function:: resize(image, target_width, target_height) -> numpy.ndarray Resize image to the specified width and height using EV74 kernel. :param image: The input image as a NumPy array. :type image: numpy.ndarray :param target_width: The desired width of the resized image. :type target_width: int :param target_height: The desired height of the resized image. :type target_height: int :returns: The resized image as a NumPy array. :rtype: numpy.ndarray .. py:function:: cvtColor(image, width: int, height: int, color_type: ColorConversionCodes) -> numpy.ndarray Convert the color space of an image using the EV74's Transform Color Conversion kernel. This operation is optimized for performance and leverages hardware acceleration for color conversion. :param image: The input image as a NumPy array. :type image: numpy.ndarray :param width: The width of the image. :type width: int :param height: The height of the image. :type height: int :param color_type: The color conversion code indicating the desired color transformation. :type color_type: ColorConversionCodes Available color conversion options: - sima.COLOR_BGRTORGB - sima.COLOR_RGBTOBGR - sima.COLOR_BGRTOGRAY - sima.COLOR_RGBTOGRAY - sima.COLOR_IYUVTOBGR - sima.COLOR_IYUVTONV12 - sima.COLOR_NV12TOBGR - sima.COLOR_BGRTONV12 - sima.COLOR_RGBTONV12 - sima.COLOR_NV12TORGB :returns: The image with the converted color space. :rtype: numpy.ndarray