Skip to main content
Question

Run a custom model with end-to-end C/C++ pipeline

  • November 17, 2025
  • 7 replies
  • 113 views

Forum|alt.badge.img+1

Hi,
How can I implement the following preprocessing to run the end-to-end C/C++ pipeline?
I've already implemented the build_gst function of the custom decoder with C++.

def override_preprocess(self, img: PIL.Image.Image | np.ndarray) -> torch.Tensor:

#trasformazione immagine

img = np.array(img)

if img.ndim == 2:

img = cv2.cvtColor(img, cv2.COLOR_GRAY2RGB)

else:

img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

 

img = np.float32(img/255.)

#Stima rumore

sigma_est = estimate_sigma(img, channel_axis=-1, average_sigmas=True)

sigma_est = np.sqrt(sigma_est)

sigma_est = min(sigma_est, 0.08)

 

img = cv2.resize(img, (640,480), interpolation=cv2.INTER_LINEAR)

img_tensor = torch.from_numpy(np.ascontiguousarray(img)).permute(2, 0, 1).float()

noise_tensor = torch.full_like(img_tensor[:1, :, :], fill_value=sigma_est, dtype=torch.float32)

final_tensor = torch.cat([img_tensor, noise_tensor], dim=0).to(torch.float32)

return final_tensor

7 replies

Spanner
Axelera Team
Forum|alt.badge.img+2
  • Axelera Team
  • November 17, 2025

Hi ​@Giodst! Just to clarify a bit - are you aiming to run the entire pipeline in C++, or are you looking to implement just the preprocessing step in C++ and integrate it into a Voyager pipeline?

If it’s the former, Voyager SDK doesn’t really support fully end-to-end pipelines written and executed in C++ as far as I know...


Forum|alt.badge.img+1
  • Author
  • Lieutenant Commander
  • November 17, 2025

I'm asking if I can also implement pre-processing in C++, as I did with post-processing through the decoder:

def build_gst(self, gst: gst_builder.Builder, stream_idx: str):

gst.decode_muxer(lib='libgenerative_decoder.so', options=f'meta_key:{str(self.task_name)};')

The reason is that I can't implement preprocessing of this particular model via yaml preprocess operators (https://github.com/axelera-ai-hub/voyager-sdk/blob/release/v1.3/docs/reference/yaml_operators.md#preprocess).
 

So i need an alternative method to Build End-to-End GStreamer Pipelines (https://github.com/axelera-ai-hub/voyager-sdk/blob/release/v1.3/ax_models/tutorials/general/tutorials.md#tutorial-5-building-end-to-end-gstreamer-pipelines).


Forum|alt.badge.img
  • Axelera Team
  • November 19, 2025

Hi ​@Giodst 

Have you tried looking into the operators/src here: https://github.com/axelera-ai-hub/voyager-sdk/tree/release/v1.4/operators. This contains, almost all of the pre and post proc gst-operators used by the gst pipeline that is built with inference,py. You can also define your own pre proc operator, and then modify the CMake here: https://github.com/axelera-ai-hub/voyager-sdk/blob/release/v1.4/operators/CMakeLists.txt#L160 

You will have to build the operators again with make operators and also have to make sure that your pre proc operator is bing used by the pipeline, by modifying the low-level gst yaml file. You can generate this file with --save-compiled-gst flag and then use the modified gst yaml with --ax-precompiled-gst flag in the inference.py.

But perhaps, you can try out your custom pre and post proc with AxInferenceNet directly, as shown in the examples, here: https://github.com/axelera-ai-hub/voyager-sdk/tree/release/v1.4/examples/axinferencenet

Please try it out, and let us know if you have more questions or queries.
Thanks!


Forum|alt.badge.img+1
  • Author
  • Lieutenant Commander
  • November 19, 2025

Hi ​@Habib 
I'll try, thank you very much!


Forum|alt.badge.img+1
  • Author
  • Lieutenant Commander
  • December 5, 2025

Help:
(venv) aetina@aetina:/axelera/voyager-sdk-release-v1.5$ make examples
make -C operators
make[1]: Entering directory '/mnt/microsd/axelera/voyager-sdk-release-v1.5/operators'
make[1]: Nothing to be done for 'gst_ops_install'.
make[1]: Leaving directory '/mnt/microsd/axelera/voyager-sdk-release-v1.5/operators'
make -C examples
make[1]: Entering directory '/mnt/microsd/axelera/voyager-sdk-release-v1.5/examples'
ninja -C Release install
ninja: Entering directory `Release'
[1/7] Building CXX object axinferencenet/CMakeFiles/axinferencenet_DPIR.dir/axinferencenet_DPIR.cpp.o
FAILED: axinferencenet/CMakeFiles/axinferencenet_DPIR.dir/axinferencenet_DPIR.cpp.o 
/usr/bin/c++   -O3 -DNDEBUG -std=gnu++20 -fPIE -MD -MT axinferencenet/CMakeFiles/axinferencenet_DPIR.dir/axinferencenet_DPIR.cpp.o -MF axinferencenet/CMakeFiles/axinferencenet_DPIR.dir/axinferencenet_DPIR.cpp.o.d -o axinferencenet/CMakeFiles/axinferencenet_DPIR.dir/axinferencenet_DPIR.cpp.o -c /mnt/microsd/axelera/voyager-sdk-release-v1.5/examples/axinferencenet/axinferencenet_DPIR.cpp
/mnt/microsd/axelera/voyager-sdk-release-v1.5/examples/axinferencenet/axinferencenet_DPIR.cpp:14:10: fatal error: AxInferenceNet.hpp: No such file or directory
   14 | #include "AxInferenceNet.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
[2/7] Linking CXX executable axinferencenet/axinferencenet_example
FAILED: axinferencenet/axinferencenet_example 
: && /usr/bin/c++ -O3 -DNDEBUG  axinferencenet/CMakeFiles/axinferencenet_example.dir/axinferencenet_example.cpp.o -o axinferencenet/axinferencenet_example -L/opt/axelera/runtime-1.5.1-1/lib   -L/mnt/microsd/axelera/voyager-sdk-release-v1.5/operators/lib -Wl,-rpath,/opt/axelera/runtime-1.5.1-1/lib:/mnt/microsd/axelera/voyager-sdk-release-v1.5/operators/lib:  -laxruntime  -lopencv_stitching  -lopencv_alphamat  -lopencv_aruco  -lopencv_barcode  -lopencv_bgsegm  -lopencv_bioinspired  -lopencv_ccalib  -lopencv_dnn_objdetect  -lopencv_dnn_superres  -lopencv_dpm  -lopencv_face  -lopencv_freetype  -lopencv_fuzzy  -lopencv_hdf  -lopencv_hfs  -lopencv_img_hash  -lopencv_intensity_transform  -lopencv_line_descriptor  -lopencv_mcc  -lopencv_quality  -lopencv_rapid  -lopencv_reg  -lopencv_rgbd  -lopencv_saliency  -lopencv_shape  -lopencv_stereo  -lopencv_structured_light  -lopencv_phase_unwrapping  -lopencv_superres  -lopencv_optflow  -lopencv_surface_matching  -lopencv_tracking  -lopencv_highgui  -lopencv_datasets  -lopencv_text  -lopencv_plot  -lopencv_ml  -lopencv_videostab  -lopencv_videoio  -lopencv_viz  -lopencv_wechat_qrcode  -lopencv_ximgproc  -lopencv_video  -lopencv_xobjdetect  -lopencv_objdetect  -lopencv_calib3d  -lopencv_imgcodecs  -lopencv_features2d  -lopencv_dnn  -lopencv_flann  -lopencv_xphoto  -lopencv_photo  -lopencv_imgproc  -lopencv_core  -laxstreamer && :
/usr/bin/ld: axinferencenet/CMakeFiles/axinferencenet_example.dir/axinferencenet_example.cpp.o: in function `main':
axinferencenet_example.cpp:(.text.startup+0x3e0): undefined reference to `Ax::create_inference_net(Ax::InferenceNetProperties const&, Ax::Logger&, std::function<void (Ax::CompletedFrame&)>)'
collect2: error: ld returned 1 exit status
[3/7] Linking CXX executable axinferencenet/axinferencenet_cascaded
FAILED: axinferencenet/axinferencenet_cascaded 
: && /usr/bin/c++ -O3 -DNDEBUG  axinferencenet/CMakeFiles/axinferencenet_cascaded.dir/axinferencenet_cascaded.cpp.o -o axinferencenet/axinferencenet_cascaded -L/opt/axelera/runtime-1.5.1-1/lib   -L/mnt/microsd/axelera/voyager-sdk-release-v1.5/operators/lib -Wl,-rpath,/opt/axelera/runtime-1.5.1-1/lib:/mnt/microsd/axelera/voyager-sdk-release-v1.5/operators/lib:  -laxruntime  -lopencv_stitching  -lopencv_alphamat  -lopencv_aruco  -lopencv_barcode  -lopencv_bgsegm  -lopencv_bioinspired  -lopencv_ccalib  -lopencv_dnn_objdetect  -lopencv_dnn_superres  -lopencv_dpm  -lopencv_face  -lopencv_freetype  -lopencv_fuzzy  -lopencv_hdf  -lopencv_hfs  -lopencv_img_hash  -lopencv_intensity_transform  -lopencv_line_descriptor  -lopencv_mcc  -lopencv_quality  -lopencv_rapid  -lopencv_reg  -lopencv_rgbd  -lopencv_saliency  -lopencv_shape  -lopencv_stereo  -lopencv_structured_light  -lopencv_phase_unwrapping  -lopencv_superres  -lopencv_optflow  -lopencv_surface_matching  -lopencv_tracking  -lopencv_highgui  -lopencv_datasets  -lopencv_text  -lopencv_plot  -lopencv_ml  -lopencv_videostab  -lopencv_videoio  -lopencv_viz  -lopencv_wechat_qrcode  -lopencv_ximgproc  -lopencv_video  -lopencv_xobjdetect  -lopencv_objdetect  -lopencv_calib3d  -lopencv_imgcodecs  -lopencv_features2d  -lopencv_dnn  -lopencv_flann  -lopencv_xphoto  -lopencv_photo  -lopencv_imgproc  -lopencv_core  -laxstreamer && :
/usr/bin/ld: axinferencenet/CMakeFiles/axinferencenet_cascaded.dir/axinferencenet_cascaded.cpp.o: in function `main':
axinferencenet_cascaded.cpp:(.text.startup+0x488): undefined reference to `Ax::create_inference_net(Ax::InferenceNetProperties const&, Ax::Logger&, std::function<void (Ax::CompletedFrame&)>)'
/usr/bin/ld: axinferencenet_cascaded.cpp:(.text.startup+0x538): undefined reference to `Ax::create_inference_net(Ax::InferenceNetProperties const&, Ax::Logger&, std::function<void (Ax::CompletedFrame&)>)'
/usr/bin/ld: axinferencenet_cascaded.cpp:(.text.startup+0x584): undefined reference to `Ax::create_inference_net(Ax::InferenceNetProperties const&, Ax::Logger&, std::function<void (Ax::CompletedFrame&)>)'
collect2: error: ld returned 1 exit status
[4/7] Linking CXX executable axinferencenet/axinferencenet_tracker
FAILED: axinferencenet/axinferencenet_tracker 
: && /usr/bin/c++ -O3 -DNDEBUG  axinferencenet/CMakeFiles/axinferencenet_tracker.dir/axinferencenet_tracker.cpp.o -o axinferencenet/axinferencenet_tracker -L/opt/axelera/runtime-1.5.1-1/lib   -L/mnt/microsd/axelera/voyager-sdk-release-v1.5/operators/lib -Wl,-rpath,/opt/axelera/runtime-1.5.1-1/lib:/mnt/microsd/axelera/voyager-sdk-release-v1.5/operators/lib:/mnt/microsd/axelera/voyager-sdk-release-v1.5/examples/../operators/lib:  -laxruntime  -lopencv_stitching  -lopencv_alphamat  -lopencv_aruco  -lopencv_barcode  -lopencv_bgsegm  -lopencv_bioinspired  -lopencv_ccalib  -lopencv_dnn_objdetect  -lopencv_dnn_superres  -lopencv_dpm  -lopencv_face  -lopencv_freetype  -lopencv_fuzzy  -lopencv_hdf  -lopencv_hfs  -lopencv_img_hash  -lopencv_intensity_transform  -lopencv_line_descriptor  -lopencv_mcc  -lopencv_quality  -lopencv_rapid  -lopencv_reg  -lopencv_rgbd  -lopencv_saliency  -lopencv_shape  -lopencv_stereo  -lopencv_structured_light  -lopencv_phase_unwrapping  -lopencv_superres  -lopencv_optflow  -lopencv_surface_matching  -lopencv_tracking  -lopencv_highgui  -lopencv_datasets  -lopencv_text  -lopencv_plot  -lopencv_ml  -lopencv_videostab  -lopencv_videoio  -lopencv_viz  -lopencv_wechat_qrcode  -lopencv_ximgproc  -lopencv_video  -lopencv_xobjdetect  -lopencv_objdetect  -lopencv_calib3d  -lopencv_imgcodecs  -lopencv_features2d  -lopencv_dnn  -lopencv_flann  -lopencv_xphoto  -lopencv_photo  -lopencv_imgproc  -lopencv_core  -laxstreamer  /mnt/microsd/axelera/voyager-sdk-release-v1.5/examples/../operators/lib/libtracker_factory.so && :
/usr/bin/ld: axinferencenet/CMakeFiles/axinferencenet_tracker.dir/axinferencenet_tracker.cpp.o: in function `main':
axinferencenet_tracker.cpp:(.text.startup+0x458): undefined reference to `Ax::create_inference_net(Ax::InferenceNetProperties const&, Ax::Logger&, std::function<void (Ax::CompletedFrame&)>)'
/usr/bin/ld: axinferencenet_tracker.cpp:(.text.startup+0x4a8): undefined reference to `Ax::create_inference_net(Ax::InferenceNetProperties const&, Ax::Logger&, std::function<void (Ax::CompletedFrame&)>)'
collect2: error: ld returned 1 exit status
[5/7] Linking CXX executable axinferencenet/axinferencenet_tensor
FAILED: axinferencenet/axinferencenet_tensor 
: && /usr/bin/c++ -O3 -DNDEBUG  axinferencenet/CMakeFiles/axinferencenet_tensor.dir/axinferencenet_tensor.cpp.o -o axinferencenet/axinferencenet_tensor -L/opt/axelera/runtime-1.5.1-1/lib   -L/mnt/microsd/axelera/voyager-sdk-release-v1.5/operators/lib -Wl,-rpath,/opt/axelera/runtime-1.5.1-1/lib:/mnt/microsd/axelera/voyager-sdk-release-v1.5/operators/lib:  -laxruntime  -lopencv_stitching  -lopencv_alphamat  -lopencv_aruco  -lopencv_barcode  -lopencv_bgsegm  -lopencv_bioinspired  -lopencv_ccalib  -lopencv_dnn_objdetect  -lopencv_dnn_superres  -lopencv_dpm  -lopencv_face  -lopencv_freetype  -lopencv_fuzzy  -lopencv_hdf  -lopencv_hfs  -lopencv_img_hash  -lopencv_intensity_transform  -lopencv_line_descriptor  -lopencv_mcc  -lopencv_quality  -lopencv_rapid  -lopencv_reg  -lopencv_rgbd  -lopencv_saliency  -lopencv_shape  -lopencv_stereo  -lopencv_structured_light  -lopencv_phase_unwrapping  -lopencv_superres  -lopencv_optflow  -lopencv_surface_matching  -lopencv_tracking  -lopencv_highgui  -lopencv_datasets  -lopencv_text  -lopencv_plot  -lopencv_ml  -lopencv_videostab  -lopencv_videoio  -lopencv_viz  -lopencv_wechat_qrcode  -lopencv_ximgproc  -lopencv_video  -lopencv_xobjdetect  -lopencv_objdetect  -lopencv_calib3d  -lopencv_imgcodecs  -lopencv_features2d  -lopencv_dnn  -lopencv_flann  -lopencv_xphoto  -lopencv_photo  -lopencv_imgproc  -lopencv_core  -laxstreamer && :
/usr/bin/ld: axinferencenet/CMakeFiles/axinferencenet_tensor.dir/axinferencenet_tensor.cpp.o: in function `main':
axinferencenet_tensor.cpp:(.text.startup+0x3d0): undefined reference to `Ax::create_inference_net(Ax::InferenceNetProperties const&, Ax::Logger&, std::function<void (Ax::CompletedFrame&)>)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
make[1]: *** [Makefile:21: gst_ops_install] Error 1
make[1]: Leaving directory '/mnt/microsd/axelera/voyager-sdk-release-v1.5/examples'
make: *** [Makefile:89: examples] Error 2


Forum|alt.badge.img
  • Axelera Team
  • December 18, 2025

Hi ​@Giodst 

AFAIK, this was fixed in v1.5.2.
Please let us know if this is still an issue. 

Thanks!


Forum|alt.badge.img+1
  • Author
  • Lieutenant Commander
  • December 18, 2025

Hi ​@Habib,

It's been solved, thank you very much.