I want use Yolov8 segmentation with Hailo-8L on Raspberry pi

So I find in hailo-rpi5-examples, they use Yolov5n like below:

class GStreamerInstanceSegmentationApp(GStreamerApp):
    def __init__(self, args, user_data):
        # Call the parent class constructor
        super().__init__(args, user_data)
        # Additional initialization code can be added here
        # Set Hailo parameters these parameters should be set based on the model used
        self.batch_size = 2
        self.network_width = 640
        self.network_height = 640
        self.network_format = "RGB"
        self.default_postprocess_so = os.path.join(self.postprocess_dir, 'libyolov5seg_post.so')
        self.post_function_name = "yolov5seg"
        self.hef_path = os.path.join(self.current_path, '../resources/yolov5n_seg_h8l_mz.hef')
        self.app_callback = app_callback
        
	    # Set the process title
        setproctitle.setproctitle("Hailo Instance Segmentation App")
        
        self.create_pipeline()

I can get yolov8s-seg.hef from github, but how can I get libyolov8seg_post.so

Hey @jiahao.li,

The post-processing files you’re looking for are located in the following folder:

$TAPPAS_WORKSPACE/apps/h8/gstreamer/libs/post_processes

However, I noticed that the specific library file libyolov8seg_post.so is not currently available in the Tappas workspace.

I will look into when this file might be released or how you can create it yourself. I’ll be sure to provide an update once I have more information.

Please let me know if you have any other questions or if there’s anything else I can assist you with.

Thank you for your replying,could you please tell me how to creat libyolov8seg_post.so, and I will try to creat it by myself, Thanks.

Do we have the steps to get libyolov8seg_post.so ?

I dont know, but I think It shoud have a step to get libyolov8seg_post.so.

Hi @jiahao.li,
In general, in order to create postprocess so files in TAPPAS, you need to perform the following steps:

  1. Create the postprocess cpp & hpp file - you can find a postprocess cpp & hpp files for yolov8seg here:
    Hailo-Application-Code-Examples/runtime/cpp/instance_segmentation/yolov8seg at main · hailo-ai/Hailo-Application-Code-Examples · GitHub
  2. Place the cpp & hpp files for the code under core/hailo/libs/postprocesses in a designated folder - for example, in our case you need to enter core/hailo/libs/postprocesses/instance_segmentation and place the mentioned above files there or have it under a different folder designated for yolov8seg.
  3. Add the relevant commands to the build.meson that is under core/hailo/libs/postprocesses/ - in out example add this:
################################################
# YOLOV8SEG SOURCES
################################################
yolov8seg_post_sources = [
    'instance_segmentation/yolov8seg.cpp',
]

shared_library('yolov8seg_post',
    yolov8seg_post_sources,
    cpp_args : hailo_lib_args + ['-pthread'],
    include_directories: [hailo_general_inc, include_directories('./')] + xtensor_inc + rapidjson_inc,
    dependencies : post_deps + [dependency('threads')],
    gnu_symbol_visibility : 'default',
    install: true,
    install_dir: post_proc_install_dir,
)
  1. Go to the /scripts/gstreamer/ and run the install_hailo_gstreamer.sh bash script.

Please notice that even though it should work, these are general instructions to add the yolov8seg, but we cannot guarantee it would compile out of the box just by following these steps.

You can see the expanded instructions on how to add your own postprocess to TAPPAS in the TAPPAS user guide under “Writing Your Own Postprocess”

Regards,

2 Likes

Thank you for your helping, that is very helpful.

1 Like