Problems with concurrent/streaming webcam inferencing on imx6

hi im attempting to implement hailo 8 chip on a imx6 board

what i trying to do is connect a webcam video to be inferenced by the hailo chip and stream the results to another place(local webserver or the screen with x11)

imx6 is 32 bit which means i have to use c++ or c (preferably c++) only,
this also restricts me from using tappas or any python libraries which would make this easier.

the examples in the Hailo-Application-Code-Examples github for c++ all seem to deal with taking an input mp4 and inferencing on it,knowing that a file is x frames long, replacing the input path on this example Hailo-Application-Code-Examples runtime cpp detection general_detection_inference , with my gstreamer pipline: “v4l2src device=/dev/video9 ! video/x-raw,format=YUY2,width=320,height=240 ! videoconvert ! appsink” i was able to connect my webcam to the example (replacing it with /dev/video9 does not work)

however the inferencing stops at 1 frame, so i changed the frame_count to 200 that seems to work but it will just stop inferencing and the hailoRT will begin to timeout because the example is not sending any frames to be inferenced?

how would i modify this or another example to do what im trying to?

forgot to mention there is very limited space < 3 gb availible

Hey @devanh ,

You have to make the function that is capturing the frame to handle infinite frames :

hailo_status write_all(InputVStream& input_vstream,
                       std::chrono::time_point<std::chrono::system_clock>& write_time_vec,
                       std::vector<cv::Mat>& frames) {
    // ... [previous code remains the same]

    while (true) {  // Infinite loop for continuous capture
        capture >> org_frame;
        if(org_frame.empty()) {
            std::cerr << "Failed to capture frame from camera" << std::endl;
        cv::resize(org_frame, org_frame, cv::Size(width, height), 1);

        status = input_vstream.write(MemoryView(frames.back().data, input_vstream.get_frame_size()));
        if (HAILO_SUCCESS != status)
            return status;

    // This point is never reached in the continuous version
    return HAILO_SUCCESS;

Then you should change the read function, the post-processing function, and the run_inference, all in the same way to handle an infinite loop of frames.

Hopefully, this fixes the issue.

i have done it, i may post how i did it a a later time

1 Like