Skip to content

Commit

Permalink
Merge pull request #309 from RidgeRun/dev-0.10
Browse files Browse the repository at this point in the history
Dev 0.10
  • Loading branch information
jafet-chaves authored Jul 2, 2020
2 parents 3007fee + 071f712 commit d746c6d
Show file tree
Hide file tree
Showing 38 changed files with 1,237 additions and 402 deletions.
131 changes: 131 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: gst-inference CI

on:
push:
branches:
- master
- dev-*
pull_request:
branches:
- dev-*

jobs:
build_autotools:
runs-on: ubuntu-18.04
strategy:
matrix:
container: ["ridgerun/r2inference-ubuntu-18.04:v0.1.5", "ridgerun/r2inference-ubuntu-16.04:v0.3.1"]
container:
image: ${{ matrix.container }}
env:
PREFIX: /usr/lib/x86_64-linux-gnu/
CFLAGS: -Werror
CXXFLAGS: -Werror
steps:
- uses: actions/checkout@v2
- name: Build backend
run: |
tar -C /usr/local -xzf /root/r2inference/backends/tensorflow/v1.15.0/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz
ldconfig
- name: Checkout r2i repo
uses: actions/checkout@master
with:
repository: RidgeRun/r2inference
- name: Build r2i
run: |
NOCONFIGURE=1 ./autogen.sh
./configure --disable-docs --enable-tensorflow
make
make install
- name: Checkout gst-inference repo
uses: actions/checkout@v2
with:
submodules: true
- name: Build gst-inference
run: |
CFLAGS="${{ env.CFLAGS }}"
CXXFLAGS="${{ env.CXXFLAGS }}"
NOCONFIGURE=1 ./autogen.sh
./configure --disable-docs --prefix $PREFIX --libdir $PREFIX
make
- name: Check gst-inference
env:
LD_LIBRARY_PATH: /usr/local/lib/
run: make check VERBOSE=1
- name: Install gst-inference
run: |
make install
- name: Check gst-inference install
env:
LD_LIBRARY_PATH: /usr/local/lib/
run: gst-inspect-1.0 inference
- name: Run GStreamer pipeline
env:
ROOT: /root/r2inference/resources/InceptionV1_TensorFlow
LD_LIBRARY_PATH: /usr/local/lib/
run: |
GST_DEBUG=2,inferencebin:6 gst-launch-1.0 filesrc location=$ROOT/Egyptian_cat.jpg ! jpegparse ! jpegdec ! \
inferencebin arch='inceptionv1' model-location=$ROOT/graph_inceptionv1_tensorflow.pb \
backend='tensorflow' input-layer='input' output-layer='InceptionV1/Logits/Predictions/Reshape_1' \
labels=$ROOT/imagenet_labels.txt crop=false overlay=true filter=-1 ! \
fakesink silent=false sync=false async=false -v
build_meson:
runs-on: ubuntu-18.04
strategy:
matrix:
container: ["ridgerun/r2inference-ubuntu-18.04:v0.1.5", "ridgerun/r2inference-ubuntu-16.04:v0.3.1"]
container:
image: ${{ matrix.container }}
env:
PREFIX: /usr
CFLAGS: -Werror
CXXFLAGS: -Werror
steps:
- uses: actions/checkout@v2
- name: Build backend
run: |
tar -C /usr/local -xzf /root/r2inference/backends/tensorflow/v1.15.0/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz
ldconfig
- name: Checkout r2i repo
uses: actions/checkout@master
with:
repository: RidgeRun/r2inference
- name: Build r2i
run: |
CFLAGS="${{ env.CFLAGS }}"
CXXFLAGS="${{ env.CXXFLAGS }}"
NOCONFIGURE=1 ./autogen.sh
./configure --disable-docs --enable-tensorflow
make
make install
- name: Checkout gst-inference repo
uses: actions/checkout@v2
with:
submodules: true
- name: Build gst-inference
env:
LD_LIBRARY_PATH: /usr/local/lib/
run: |
meson build --prefix $PREFIX -Denable-gtk-doc=false
ninja -C build
- name: Check gst-inference
env:
LD_LIBRARY_PATH: /usr/local/lib/
run: ninja -C build test -v
- name: Install gst-inference
run: |
ninja -C build install
- name: Check gst-inference install
env:
LD_LIBRARY_PATH: /usr/local/lib/
run: gst-inspect-1.0 inference
- name: Run GStreamer pipeline
env:
ROOT: /root/r2inference/resources/InceptionV1_TensorFlow
LD_LIBRARY_PATH: /usr/local/lib/
run: |
GST_DEBUG=2,inferencebin:6 gst-launch-1.0 filesrc location=$ROOT/Egyptian_cat.jpg ! jpegparse ! jpegdec ! \
inferencebin arch='inceptionv1' model-location=$ROOT/graph_inceptionv1_tensorflow.pb \
backend='tensorflow' input-layer='input' output-layer='InceptionV1/Logits/Predictions/Reshape_1' \
labels=$ROOT/imagenet_labels.txt crop=false overlay=true filter=-1 ! \
fakesink silent=false sync=false async=false -v
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dnl please read gstreamer/docs/random/autotools before changing this file
dnl initialize autoconf
dnl releases only do -Wall, git and prerelease does -Werror too
dnl use a three digit version number for releases, and four for git/pre
AC_INIT([GStreamer Inference],[0.9.1.1],[https://github.com/RidgeRun/gst-inference/issues],[gst-inference])
AC_INIT([GStreamer Inference],[0.10.0.1],[https://github.com/RidgeRun/gst-inference/issues],[gst-inference])

AG_GST_INIT

Expand Down Expand Up @@ -316,7 +316,7 @@ if test "$USE_OPENCV" = "yes"; then
fi

dnl *** r2inference ***
R2INFERENCE_REQ=0.5.2
R2INFERENCE_REQ=0.8.0
AG_GST_CHECK_FEATURE(R2INFERENCE, [RidgeRun\'s Inference Framework], r2inference, [
AG_GST_PKG_CHECK_MODULES(R2INFERENCE, r2inference-0.0 >= $R2INFERENCE_REQ)
],[],[],[
Expand Down
37 changes: 37 additions & 0 deletions docker/Dockerfile-Ubuntu-16.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM ubuntu:16.04

# Install all needed packages
RUN apt-get update && apt-get install -y \
build-essential \
apt-utils software-properties-common \
python3-pip python3-dev \
libgstreamer1.0-0 gstreamer1.0-plugins-base \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly gstreamer1.0-libav \
gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x \
cmake cpputest automake libtool pkg-config \
unzip doxygen libgtk2.0-dev \
wget vim \
libcv2.4 libopencv-contrib-dev libopencv-contrib2.4v5 \
libopencv-core-dev libopencv-core2.4v5 libopencv-dev \
libopencv-highgui-dev libopencv-highgui2.4v5 \
libopencv-imgproc-dev libopencv-imgproc2.4v5 \
libopencv-legacy-dev libopencv-legacy2.4v5 \
libopencv-video-dev libopencv-video2.4v5

RUN rm -rf /var/lib/apt/lists/* \
&& pip3 install meson ninja numpy

# Install latest git version
RUN apt-add-repository ppa:git-core/ppa \
&& apt-get update \
&& apt-get install -y git

# Copy tar package with tensorflow and tensorflow lite dependencies
COPY r2inference-dependencies-linux-x86_64-v0.1.0.tar.gz /root

RUN tar -C /root -xzf /root/r2inference-dependencies-linux-x86_64-v0.1.0.tar.gz \
&& rm /root/r2inference-dependencies-linux-x86_64-v0.1.0.tar.gz

CMD ["/bin/bash"]
51 changes: 51 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## Prerequisites
* Docker engine. You can find a very detailed installation guide here
https://docs.docker.com/engine/install/ubuntu/

* Download dependencies tarball (needed by Dockerfile)
https://drive.google.com/file/d/1vi_oqMxt_4fQzRE1nnv5abSDIP4Cpv82/view?usp=sharing

The tarball should be placed in the same path as the Dockerfile.

The tarball contains precompiled TensorFlow and TensorFlow Lite libraries
aswell as some resources needed to run a GStreamer pipeline.
It should have the following structure:

```
r2inference
├── backends
│   ├── tensorflow
│   │   └── v1.15.0
│   │   └── libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz
│   └── tflite
│   └── v2.0.1
│   ├── binaries
│   │   └── libtensorflow-lite.a
│   └── include
│   └── tensorflow
│   └── tensorflow
│   ├── core
│   └── lite
└── resources
└── InceptionV1_TensorFlow
├── Egyptian_cat.jpg
├── graph_inceptionv1_tensorflow.pb
└── imagenet_labels.txt
```

## Build instructions
`sudo docker build -t r2inference-ubuntu-16.04 -f Dockerfile-Ubuntu-16.04 .`

## Run a container from the image
`sudo docker run -ti -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix r2inference-ubuntu-16.04`

## Building GstInference
For instructions on how to build and test the pluging you can refer to:
* The file .github/workflows/main.yml in this repository
* https://developer.ridgerun.com/wiki/index.php?title=GstInference/Getting_started/Building_the_plugin
* https://developer.ridgerun.com/wiki/index.php?title=R2Inference/Getting_started/Building_the_library

## Notes
* This Dockerfile creates an image that has been succesfully tested to
build r2inference with TensorFlow backend only.
3 changes: 3 additions & 0 deletions docs/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if get_option('enable-gtk-doc')
subdir('plugins')
endif
21 changes: 21 additions & 0 deletions docs/plugins/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copy the file provided in input: to a file in the build directory with
# the name output: in the current directory.

types = configure_file(input : 'gst-inference-plugin.types',
output : 'gst-inference-plugin.types',
copy : true)

version_conf = configuration_data()
version_conf.set('PACKAGE_VERSION', meson.project_version())
version_conf.set('GST_API_VERSION', api_version)
version_conf.set('PACKAGE_NAME', 'GstInference')
version_conf.set('PACKAGE_URL', plugin_url)

# Compiles and installs gtkdoc documentation into prefix/share/gtk-doc/html.
gnome.gtkdoc('gst-inference-plugin-1.0',
main_sgml : '@0@/gst-inference-plugin-docs.sgml'.format(meson.current_build_dir()),
src_dir : ['@0@/ext/'.format(meson.source_root()), meson.current_build_dir()],
gobject_typesfile : types,
#content_files : [version_entities],
dependencies : [plugin_deps],
install : true)
2 changes: 2 additions & 0 deletions ext/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
subdir('opencv')
subdir('r2inference')
24 changes: 24 additions & 0 deletions ext/opencv/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
gstinference_sources = [
'gstplugin.cc',
'gstclassificationoverlay.cc',
'gstinferenceoverlay.cc',
'gstdetectionoverlay.cc',
'gstembeddingoverlay.cc'
]

if opencv_dep.found()
opencv_all_dependencies = [gst_base_dep, gst_video_dep, opencv_dep, inferencebaseoverlay_dep, gstinference_dep]

gstinferenceoverlay = library('gstinferenceoverlayplugin',
gstinference_sources,
cpp_args : cpp_args,
include_directories : [configinc, inference_inc_dir],
dependencies : opencv_all_dependencies,
install : true,
install_dir : plugins_install_dir,
)

plugins += [gstinferenceoverlay]
else
warning('OpenCV not found in this system. Overlay plug-ins will not be built.')
endif
22 changes: 22 additions & 0 deletions ext/r2inference/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
gstinference_sources = [
'gstfacenetv1.c',
'gstinceptionv1.c',
'gstinceptionv2.c',
'gstinceptionv3.c',
'gstinceptionv4.c',
'gstinference.c',
'gstmobilenetv2.c',
'gstresnet50v1.c',
'gsttinyyolov2.c',
'gsttinyyolov3.c'
]

gstinference = library('gstinference',
gstinference_sources,
c_args : c_args,
include_directories : [configinc, inference_inc_dir],
dependencies : [gst_base_dep, gst_video_dep, gstinference_dep],
install : true,
install_dir : plugins_install_dir,
)
plugins += [gstinference]
2 changes: 2 additions & 0 deletions gst-libs/gst/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
subdir('r2inference')
subdir('opencv')
29 changes: 29 additions & 0 deletions gst-libs/gst/opencv/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
opencv_sources = [
'gstinferencebaseoverlay.cc'
]

opencv_headers = [
'gstinferencebaseoverlay.h'
]

if opencv_dep.found()
opencv_all_dependencies = [gst_base_dep, gst_video_dep, opencv_dep]

inferencebaseoverlay = library('gstinferencebaseoverlay-@0@'.format(api_version),
opencv_sources,
c_args : c_args + ['-DBUILDING_GST_INFERENCE'],
cpp_args: cpp_args + ['-DBUILDING_GST_INFERENCE'],
include_directories : [configinc, inference_inc_dir],
version : version_arr[0],
install : true,
dependencies : opencv_all_dependencies,
)

inferencebaseoverlay_dep = declare_dependency(link_with: inferencebaseoverlay,
include_directories : [inference_inc_dir],
dependencies : opencv_all_dependencies)

install_headers(opencv_headers, subdir : 'gstreamer-1.0/gst/opencv')
else
warning('OpenCV was not found in this system. Base overlay utils will not be built.')
endif
15 changes: 5 additions & 10 deletions gst-libs/gst/r2inference/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ libgstinference_@GST_API_VERSION@_la_SOURCES= \
gstchildinspector.c \
gstinferencemeta.c \
gstinferencebackends.cc \
gstbackend.cc \
gstncsdk.cc \
gsttensorflow.cc \
gsttflite.cc \
gstbasebackend.cc \
gstinferencepreprocess.c \
gstinferencepostprocess.c \
gstinferencedebug.c \
gstinferenceprediction.c \
gstinferenceclassification.c
gstinferenceclassification.c \
gstinferencebackend.cc

libgstinference_@GST_API_VERSION@_la_CXXFLAGS= \
$(GST_CXXFLAGS) \
Expand Down Expand Up @@ -42,11 +40,8 @@ gstinferenceinclude_HEADERS= \
gstvideoinference.h \
gstchildinspector.h \
gstinferencebackends.h \
gstbackend.h \
gstbackendsubclass.h \
gstncsdk.h \
gsttensorflow.h \
gsttflite.h \
gstbasebackend.h \
gstbasebackendsubclass.h \
gstinferencepreprocess.h \
gstinferencepostprocess.h \
gstinferencedebug.h \
Expand Down
Loading

0 comments on commit d746c6d

Please sign in to comment.