Hailo guide 4: Simplifying instance segmentation on a Hailo device using DeGirum PySDK

Absolutely! You just need to define video source gizmo to read frames from PiCamera.
Something like that (I did not check this code myself, but it is based on one of our examples: 016_custom_video_source.ipynb):

from picamera2 import Picamera2

class PiCameraSourceGizmo(dgstreams.Gizmo):
    """Picamera2-based video source gizmo"""

    def __init__(self):
        super().__init__()

    def run(self):
        picam2 = Picamera2()
        picam2.configure(picam2.preview_configuration(main={"format": "BGR888"}))
        picam2.start()
        try:
            while not self._abort:
                data = picam2.capture_array()
                self.send_result(dgstreams.StreamData(data))
        finally:
            picam2.stop()

Then you use PiCameraSourceGizmo() instead of dgstreams.VideoSourceGizmo(video_source) in the code above.

Thanks again!
Great support

2 Likes

Hi Vladk, do we need to add this option:
selection_strategy=degirum_tools.ObjectSelectionStrategies.CUSTOM_METRIC
Because, it’s no defined:

class ObjectSelectionStrategies(Enum):
    """
    Object selection strategies
    """
    HIGHEST_SCORE = 1  # select objects with highest score
    LARGEST_AREA = 2  # select objects with largest area


@jhidalgo ,

Please update degirum tools package to the latest version 0.16.7:

pip uninstall -y degirum_tools && pip install -U degirum_tools