mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-08 18:39:54 +00:00
f71eb29497
This MR provides a transform element that leverage ONNX runtime to run AI inference on a broad range of neural network toolkits, running on either CPU or GPU. ONNX supports 16 different providers at the moment, so with ONNX we immediately get support for Nvidia, AMD, Xilinx and many others. For the first release, this plugin adds a gstonnxobjectdetector element to detect objects in video frames. Meta data generated by the model is attached to the video buffer as a custom GstObjectDetectorMeta meta. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1997>
32 lines
1 KiB
Meson
32 lines
1 KiB
Meson
if get_option('onnx').disabled()
|
|
subdir_done()
|
|
endif
|
|
|
|
|
|
onnxrt_dep = dependency('libonnxruntime',required : get_option('onnx'))
|
|
|
|
if onnxrt_dep.found()
|
|
onnxrt_include_root = onnxrt_dep.get_pkgconfig_variable('includedir')
|
|
onnxrt_includes = [onnxrt_include_root / 'core/session', onnxrt_include_root / 'core']
|
|
onnxrt_dep_args = []
|
|
|
|
compiler = meson.get_compiler('cpp')
|
|
if compiler.has_header(onnxrt_include_root / 'core/providers/cuda/cuda_provider_factory.h')
|
|
onnxrt_dep_args = ['-DGST_ML_ONNX_RUNTIME_HAVE_CUDA']
|
|
endif
|
|
gstonnx = library('gstonnx',
|
|
'gstonnx.c',
|
|
'gstonnxelement.c',
|
|
'gstonnxobjectdetector.cpp',
|
|
'gstonnxclient.cpp',
|
|
c_args : gst_plugins_bad_args,
|
|
cpp_args: onnxrt_dep_args,
|
|
link_args : noseh_link_args,
|
|
include_directories : [configinc, libsinc, onnxrt_includes],
|
|
dependencies : [gstbase_dep, gstvideo_dep, onnxrt_dep, libm],
|
|
install : true,
|
|
install_dir : plugins_install_dir,
|
|
)
|
|
pkgconfig.generate(gstonnx, install_dir : plugins_pkgconfig_install_dir)
|
|
plugins += [gstonnx]
|
|
endif
|