Skip to content

Commit d746c6d

Browse files
authored
Merge pull request #309 from RidgeRun/dev-0.10
Dev 0.10
2 parents 3007fee + 071f712 commit d746c6d

38 files changed

+1237
-402
lines changed

.github/workflows/main.yml

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: gst-inference CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- dev-*
8+
pull_request:
9+
branches:
10+
- dev-*
11+
12+
jobs:
13+
build_autotools:
14+
runs-on: ubuntu-18.04
15+
strategy:
16+
matrix:
17+
container: ["ridgerun/r2inference-ubuntu-18.04:v0.1.5", "ridgerun/r2inference-ubuntu-16.04:v0.3.1"]
18+
container:
19+
image: ${{ matrix.container }}
20+
env:
21+
PREFIX: /usr/lib/x86_64-linux-gnu/
22+
CFLAGS: -Werror
23+
CXXFLAGS: -Werror
24+
steps:
25+
- uses: actions/checkout@v2
26+
- name: Build backend
27+
run: |
28+
tar -C /usr/local -xzf /root/r2inference/backends/tensorflow/v1.15.0/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz
29+
ldconfig
30+
- name: Checkout r2i repo
31+
uses: actions/checkout@master
32+
with:
33+
repository: RidgeRun/r2inference
34+
- name: Build r2i
35+
run: |
36+
NOCONFIGURE=1 ./autogen.sh
37+
./configure --disable-docs --enable-tensorflow
38+
make
39+
make install
40+
- name: Checkout gst-inference repo
41+
uses: actions/checkout@v2
42+
with:
43+
submodules: true
44+
- name: Build gst-inference
45+
run: |
46+
CFLAGS="${{ env.CFLAGS }}"
47+
CXXFLAGS="${{ env.CXXFLAGS }}"
48+
NOCONFIGURE=1 ./autogen.sh
49+
./configure --disable-docs --prefix $PREFIX --libdir $PREFIX
50+
make
51+
- name: Check gst-inference
52+
env:
53+
LD_LIBRARY_PATH: /usr/local/lib/
54+
run: make check VERBOSE=1
55+
- name: Install gst-inference
56+
run: |
57+
make install
58+
- name: Check gst-inference install
59+
env:
60+
LD_LIBRARY_PATH: /usr/local/lib/
61+
run: gst-inspect-1.0 inference
62+
- name: Run GStreamer pipeline
63+
env:
64+
ROOT: /root/r2inference/resources/InceptionV1_TensorFlow
65+
LD_LIBRARY_PATH: /usr/local/lib/
66+
run: |
67+
GST_DEBUG=2,inferencebin:6 gst-launch-1.0 filesrc location=$ROOT/Egyptian_cat.jpg ! jpegparse ! jpegdec ! \
68+
inferencebin arch='inceptionv1' model-location=$ROOT/graph_inceptionv1_tensorflow.pb \
69+
backend='tensorflow' input-layer='input' output-layer='InceptionV1/Logits/Predictions/Reshape_1' \
70+
labels=$ROOT/imagenet_labels.txt crop=false overlay=true filter=-1 ! \
71+
fakesink silent=false sync=false async=false -v
72+
build_meson:
73+
runs-on: ubuntu-18.04
74+
strategy:
75+
matrix:
76+
container: ["ridgerun/r2inference-ubuntu-18.04:v0.1.5", "ridgerun/r2inference-ubuntu-16.04:v0.3.1"]
77+
container:
78+
image: ${{ matrix.container }}
79+
env:
80+
PREFIX: /usr
81+
CFLAGS: -Werror
82+
CXXFLAGS: -Werror
83+
steps:
84+
- uses: actions/checkout@v2
85+
- name: Build backend
86+
run: |
87+
tar -C /usr/local -xzf /root/r2inference/backends/tensorflow/v1.15.0/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz
88+
ldconfig
89+
- name: Checkout r2i repo
90+
uses: actions/checkout@master
91+
with:
92+
repository: RidgeRun/r2inference
93+
- name: Build r2i
94+
run: |
95+
CFLAGS="${{ env.CFLAGS }}"
96+
CXXFLAGS="${{ env.CXXFLAGS }}"
97+
NOCONFIGURE=1 ./autogen.sh
98+
./configure --disable-docs --enable-tensorflow
99+
make
100+
make install
101+
- name: Checkout gst-inference repo
102+
uses: actions/checkout@v2
103+
with:
104+
submodules: true
105+
- name: Build gst-inference
106+
env:
107+
LD_LIBRARY_PATH: /usr/local/lib/
108+
run: |
109+
meson build --prefix $PREFIX -Denable-gtk-doc=false
110+
ninja -C build
111+
- name: Check gst-inference
112+
env:
113+
LD_LIBRARY_PATH: /usr/local/lib/
114+
run: ninja -C build test -v
115+
- name: Install gst-inference
116+
run: |
117+
ninja -C build install
118+
- name: Check gst-inference install
119+
env:
120+
LD_LIBRARY_PATH: /usr/local/lib/
121+
run: gst-inspect-1.0 inference
122+
- name: Run GStreamer pipeline
123+
env:
124+
ROOT: /root/r2inference/resources/InceptionV1_TensorFlow
125+
LD_LIBRARY_PATH: /usr/local/lib/
126+
run: |
127+
GST_DEBUG=2,inferencebin:6 gst-launch-1.0 filesrc location=$ROOT/Egyptian_cat.jpg ! jpegparse ! jpegdec ! \
128+
inferencebin arch='inceptionv1' model-location=$ROOT/graph_inceptionv1_tensorflow.pb \
129+
backend='tensorflow' input-layer='input' output-layer='InceptionV1/Logits/Predictions/Reshape_1' \
130+
labels=$ROOT/imagenet_labels.txt crop=false overlay=true filter=-1 ! \
131+
fakesink silent=false sync=false async=false -v

configure.ac

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dnl please read gstreamer/docs/random/autotools before changing this file
55
dnl initialize autoconf
66
dnl releases only do -Wall, git and prerelease does -Werror too
77
dnl use a three digit version number for releases, and four for git/pre
8-
AC_INIT([GStreamer Inference],[0.9.1.1],[https://github.com/RidgeRun/gst-inference/issues],[gst-inference])
8+
AC_INIT([GStreamer Inference],[0.10.0.1],[https://github.com/RidgeRun/gst-inference/issues],[gst-inference])
99

1010
AG_GST_INIT
1111

@@ -316,7 +316,7 @@ if test "$USE_OPENCV" = "yes"; then
316316
fi
317317

318318
dnl *** r2inference ***
319-
R2INFERENCE_REQ=0.5.2
319+
R2INFERENCE_REQ=0.8.0
320320
AG_GST_CHECK_FEATURE(R2INFERENCE, [RidgeRun\'s Inference Framework], r2inference, [
321321
AG_GST_PKG_CHECK_MODULES(R2INFERENCE, r2inference-0.0 >= $R2INFERENCE_REQ)
322322
],[],[],[

docker/Dockerfile-Ubuntu-16.04

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM ubuntu:16.04
2+
3+
# Install all needed packages
4+
RUN apt-get update && apt-get install -y \
5+
build-essential \
6+
apt-utils software-properties-common \
7+
python3-pip python3-dev \
8+
libgstreamer1.0-0 gstreamer1.0-plugins-base \
9+
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
10+
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
11+
gstreamer1.0-plugins-ugly gstreamer1.0-libav \
12+
gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x \
13+
cmake cpputest automake libtool pkg-config \
14+
unzip doxygen libgtk2.0-dev \
15+
wget vim \
16+
libcv2.4 libopencv-contrib-dev libopencv-contrib2.4v5 \
17+
libopencv-core-dev libopencv-core2.4v5 libopencv-dev \
18+
libopencv-highgui-dev libopencv-highgui2.4v5 \
19+
libopencv-imgproc-dev libopencv-imgproc2.4v5 \
20+
libopencv-legacy-dev libopencv-legacy2.4v5 \
21+
libopencv-video-dev libopencv-video2.4v5
22+
23+
RUN rm -rf /var/lib/apt/lists/* \
24+
&& pip3 install meson ninja numpy
25+
26+
# Install latest git version
27+
RUN apt-add-repository ppa:git-core/ppa \
28+
&& apt-get update \
29+
&& apt-get install -y git
30+
31+
# Copy tar package with tensorflow and tensorflow lite dependencies
32+
COPY r2inference-dependencies-linux-x86_64-v0.1.0.tar.gz /root
33+
34+
RUN tar -C /root -xzf /root/r2inference-dependencies-linux-x86_64-v0.1.0.tar.gz \
35+
&& rm /root/r2inference-dependencies-linux-x86_64-v0.1.0.tar.gz
36+
37+
CMD ["/bin/bash"]

docker/README.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## Prerequisites
2+
* Docker engine. You can find a very detailed installation guide here
3+
https://docs.docker.com/engine/install/ubuntu/
4+
5+
* Download dependencies tarball (needed by Dockerfile)
6+
https://drive.google.com/file/d/1vi_oqMxt_4fQzRE1nnv5abSDIP4Cpv82/view?usp=sharing
7+
8+
The tarball should be placed in the same path as the Dockerfile.
9+
10+
The tarball contains precompiled TensorFlow and TensorFlow Lite libraries
11+
aswell as some resources needed to run a GStreamer pipeline.
12+
It should have the following structure:
13+
14+
```
15+
r2inference
16+
├── backends
17+
│   ├── tensorflow
18+
│   │   └── v1.15.0
19+
│   │   └── libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz
20+
│   └── tflite
21+
│   └── v2.0.1
22+
│   ├── binaries
23+
│   │   └── libtensorflow-lite.a
24+
│   └── include
25+
│   └── tensorflow
26+
│   └── tensorflow
27+
│   ├── core
28+
│   └── lite
29+
└── resources
30+
└── InceptionV1_TensorFlow
31+
├── Egyptian_cat.jpg
32+
├── graph_inceptionv1_tensorflow.pb
33+
└── imagenet_labels.txt
34+
35+
```
36+
37+
## Build instructions
38+
`sudo docker build -t r2inference-ubuntu-16.04 -f Dockerfile-Ubuntu-16.04 .`
39+
40+
## Run a container from the image
41+
`sudo docker run -ti -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix r2inference-ubuntu-16.04`
42+
43+
## Building GstInference
44+
For instructions on how to build and test the pluging you can refer to:
45+
* The file .github/workflows/main.yml in this repository
46+
* https://developer.ridgerun.com/wiki/index.php?title=GstInference/Getting_started/Building_the_plugin
47+
* https://developer.ridgerun.com/wiki/index.php?title=R2Inference/Getting_started/Building_the_library
48+
49+
## Notes
50+
* This Dockerfile creates an image that has been succesfully tested to
51+
build r2inference with TensorFlow backend only.

docs/meson.build

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if get_option('enable-gtk-doc')
2+
subdir('plugins')
3+
endif

docs/plugins/meson.build

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copy the file provided in input: to a file in the build directory with
2+
# the name output: in the current directory.
3+
4+
types = configure_file(input : 'gst-inference-plugin.types',
5+
output : 'gst-inference-plugin.types',
6+
copy : true)
7+
8+
version_conf = configuration_data()
9+
version_conf.set('PACKAGE_VERSION', meson.project_version())
10+
version_conf.set('GST_API_VERSION', api_version)
11+
version_conf.set('PACKAGE_NAME', 'GstInference')
12+
version_conf.set('PACKAGE_URL', plugin_url)
13+
14+
# Compiles and installs gtkdoc documentation into prefix/share/gtk-doc/html.
15+
gnome.gtkdoc('gst-inference-plugin-1.0',
16+
main_sgml : '@0@/gst-inference-plugin-docs.sgml'.format(meson.current_build_dir()),
17+
src_dir : ['@0@/ext/'.format(meson.source_root()), meson.current_build_dir()],
18+
gobject_typesfile : types,
19+
#content_files : [version_entities],
20+
dependencies : [plugin_deps],
21+
install : true)

ext/meson.build

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
subdir('opencv')
2+
subdir('r2inference')

ext/opencv/meson.build

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
gstinference_sources = [
2+
'gstplugin.cc',
3+
'gstclassificationoverlay.cc',
4+
'gstinferenceoverlay.cc',
5+
'gstdetectionoverlay.cc',
6+
'gstembeddingoverlay.cc'
7+
]
8+
9+
if opencv_dep.found()
10+
opencv_all_dependencies = [gst_base_dep, gst_video_dep, opencv_dep, inferencebaseoverlay_dep, gstinference_dep]
11+
12+
gstinferenceoverlay = library('gstinferenceoverlayplugin',
13+
gstinference_sources,
14+
cpp_args : cpp_args,
15+
include_directories : [configinc, inference_inc_dir],
16+
dependencies : opencv_all_dependencies,
17+
install : true,
18+
install_dir : plugins_install_dir,
19+
)
20+
21+
plugins += [gstinferenceoverlay]
22+
else
23+
warning('OpenCV not found in this system. Overlay plug-ins will not be built.')
24+
endif

ext/r2inference/meson.build

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
gstinference_sources = [
2+
'gstfacenetv1.c',
3+
'gstinceptionv1.c',
4+
'gstinceptionv2.c',
5+
'gstinceptionv3.c',
6+
'gstinceptionv4.c',
7+
'gstinference.c',
8+
'gstmobilenetv2.c',
9+
'gstresnet50v1.c',
10+
'gsttinyyolov2.c',
11+
'gsttinyyolov3.c'
12+
]
13+
14+
gstinference = library('gstinference',
15+
gstinference_sources,
16+
c_args : c_args,
17+
include_directories : [configinc, inference_inc_dir],
18+
dependencies : [gst_base_dep, gst_video_dep, gstinference_dep],
19+
install : true,
20+
install_dir : plugins_install_dir,
21+
)
22+
plugins += [gstinference]

gst-libs/gst/meson.build

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
subdir('r2inference')
2+
subdir('opencv')

gst-libs/gst/opencv/meson.build

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
opencv_sources = [
2+
'gstinferencebaseoverlay.cc'
3+
]
4+
5+
opencv_headers = [
6+
'gstinferencebaseoverlay.h'
7+
]
8+
9+
if opencv_dep.found()
10+
opencv_all_dependencies = [gst_base_dep, gst_video_dep, opencv_dep]
11+
12+
inferencebaseoverlay = library('gstinferencebaseoverlay-@0@'.format(api_version),
13+
opencv_sources,
14+
c_args : c_args + ['-DBUILDING_GST_INFERENCE'],
15+
cpp_args: cpp_args + ['-DBUILDING_GST_INFERENCE'],
16+
include_directories : [configinc, inference_inc_dir],
17+
version : version_arr[0],
18+
install : true,
19+
dependencies : opencv_all_dependencies,
20+
)
21+
22+
inferencebaseoverlay_dep = declare_dependency(link_with: inferencebaseoverlay,
23+
include_directories : [inference_inc_dir],
24+
dependencies : opencv_all_dependencies)
25+
26+
install_headers(opencv_headers, subdir : 'gstreamer-1.0/gst/opencv')
27+
else
28+
warning('OpenCV was not found in this system. Base overlay utils will not be built.')
29+
endif

gst-libs/gst/r2inference/Makefile.am

+5-10
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ libgstinference_@GST_API_VERSION@_la_SOURCES= \
66
gstchildinspector.c \
77
gstinferencemeta.c \
88
gstinferencebackends.cc \
9-
gstbackend.cc \
10-
gstncsdk.cc \
11-
gsttensorflow.cc \
12-
gsttflite.cc \
9+
gstbasebackend.cc \
1310
gstinferencepreprocess.c \
1411
gstinferencepostprocess.c \
1512
gstinferencedebug.c \
1613
gstinferenceprediction.c \
17-
gstinferenceclassification.c
14+
gstinferenceclassification.c \
15+
gstinferencebackend.cc
1816

1917
libgstinference_@GST_API_VERSION@_la_CXXFLAGS= \
2018
$(GST_CXXFLAGS) \
@@ -42,11 +40,8 @@ gstinferenceinclude_HEADERS= \
4240
gstvideoinference.h \
4341
gstchildinspector.h \
4442
gstinferencebackends.h \
45-
gstbackend.h \
46-
gstbackendsubclass.h \
47-
gstncsdk.h \
48-
gsttensorflow.h \
49-
gsttflite.h \
43+
gstbasebackend.h \
44+
gstbasebackendsubclass.h \
5045
gstinferencepreprocess.h \
5146
gstinferencepostprocess.h \
5247
gstinferencedebug.h \

0 commit comments

Comments
 (0)