-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #309 from RidgeRun/dev-0.10
Dev 0.10
- Loading branch information
Showing
38 changed files
with
1,237 additions
and
402 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if get_option('enable-gtk-doc') | ||
subdir('plugins') | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
subdir('opencv') | ||
subdir('r2inference') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
subdir('r2inference') | ||
subdir('opencv') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.