Difference between revisions of "Getting started with TI Jacinto 7 Edge AI/Demos/C++ Demos/Build the Docker container & apps"

From RidgeRun Developer Connection
Jump to: navigation, search
(Build the Docker container & apps)
m
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
<noinclude>
 +
{{Getting started with TI Jacinto 7 Edge AI/Head|next=Demos/C++ Demos/Classification|previous=Demos/C++ Demos/Getting the models|Getting the models|metakeywords=}}
 +
</noinclude>
 +
 
== Build the Docker container & apps ==
 
== Build the Docker container & apps ==
  
C++ Demos need to be run in a Docker image. This section shows the steps necessary to build the Docker container and demos.
+
The C++ Demos need to be run in a Docker image. This section shows the steps necessary to build the Docker container and demos.
  
 
=== Build the Docker container ===
 
=== Build the Docker container ===
  
* Login to your Jacinto 7 and navigate to the docker directory:
+
* Navigate to the docker directory:
  
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
Line 16: Line 20:
 
./docker_build.sh
 
./docker_build.sh
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
* The command line should display something like the following:
 +
 +
<pre>
 +
Sending build context to Docker daemon  24.06kB
 +
Step 1/13 : FROM arm64v8/ubuntu:20.04 as edgeaikit
 +
---> 6a98cbe39225
 +
Step 2/13 : ARG DEBIAN_FRONTEND=noninteractive
 +
---> 7099b799debf
 +
Step 3/13 : ARG NPROC=1
 +
---> a7a8c2e2e6a7
 +
Step 4/13 : ARG PROJECT_NAME=edge_ai_apps
 +
---> 9ead13dbe218
 +
Step 5/13 : ENV USE_PROXY=none
 +
---> 9d192f292557
 +
Step 6/13 : ADD entrypoint.sh setup_proxy.sh setup_ti_processor_sdk.sh /usr/bin/
 +
---> c29446d2018a
 +
Step 7/13 : RUN /usr/bin/setup_proxy.sh
 +
---> 69a09af4e3e4
 +
Step 8/13 : RUN apt-get update -y && apt-get dist-upgrade -y && apt-get install -y    glib-2.0-dev    ncurses-dev    libgtk-3-dev    libavcodec-dev    libavformat-dev    libswscale-dev    libv4l-dev    libxvidcore-dev    libx264-dev    libjpeg-dev    libpng-dev    libtiff-dev    libatlas-base-dev    libtbb2    libtbb-dev    libdc1394-22-dev    libgl-dev    libopencv-core-dev    libopencv-imgproc-dev    libglib2.0-0    libyaml-cpp-dev    libboost-all-dev
 +
---> f27f0998d648
 +
Step 9/13 : RUN apt-get install -y    build-essential    cmake    ninja-build    git    wget    unzip    pkg-config    gfortran    openexr
 +
---> 361b456bb40d
 +
Step 10/13 : RUN apt-get install -y    python3    python3-dev    python3-numpy    python3-opencv    python3-pip &&    pip3 install        jupyterlab        meson        PyYAML        Dlr &&    pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime
 +
---> 97b0a6b00425
 +
Step 11/13 : RUN apt-get install -y    vim    rsync    strace    gdb    net-tools    dialog    chrony    nfs-common
 +
---> 3291eeb37839
 +
Step 12/13 : RUN apt-get install -y    libgstreamer1.0-0    libgstreamer1.0-dev    libgstreamer-plugins-base1.0-dev    gstreamer1.0-plugins-base    gstreamer1.0-plugins-good    gstreamer1.0-plugins-bad    gstreamer1.0-libav    gstreamer1.0-tools &&    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 +
---> 79677fd988fd
 +
Step 13/13 : ENTRYPOINT ["/usr/bin/entrypoint.sh"]
 +
---> a27e6ab55a78
 +
Successfully built a27e6ab55a78
 +
Successfully tagged edge_ai_kit:latest
 +
tensorflow
 +
</pre>
  
 
* Run the Docker container:
 
* Run the Docker container:
Line 21: Line 60:
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
 
./docker_run.sh
 
./docker_run.sh
 +
</syntaxhighlight>
 +
 +
* After running the container, your session should display a [docker] label before the root username:
 +
 +
<syntaxhighlight lang=bash>
 +
[docker] root@j7-evm:/#
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
=== Build the C++ demos ===
 
=== Build the C++ demos ===
 +
To build the C++ demos, follow these steps:
 +
<br>
  
 
* Navigate to the C++ apps directory:
 
* Navigate to the C++ apps directory:
Line 31: Line 78:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
* Build the apps:
+
* Build the apps by running the following commands:
  
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
 
mkdir build
 
mkdir build
 +
</syntaxhighlight>
 +
<syntaxhighlight lang=bash>
 
cd build
 
cd build
 +
</syntaxhighlight>
 +
<syntaxhighlight lang=bash>
 
cmake ..
 
cmake ..
 +
</syntaxhighlight>
 +
<syntaxhighlight lang=bash>
 
make
 
make
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
* After running the build commands, the command line should display something like the following:
 +
 +
<pre>
 +
Scanning dependencies of target ti_dl_inferer
 +
[  5%] Building CXX object dl_inferer/CMakeFiles/ti_dl_inferer.dir/src/ti_dl_inferer.cpp.o
 +
[ 11%] Building CXX object dl_inferer/CMakeFiles/ti_dl_inferer.dir/src/ti_dlr_inferer.cpp.o
 +
[ 17%] Building CXX object dl_inferer/CMakeFiles/ti_dl_inferer.dir/src/ti_tflite_inferer.cpp.o
 +
[ 23%] Linking CXX static library ../../lib/Release/libti_dl_inferer.a
 +
[ 23%] Built target ti_dl_inferer
 +
Scanning dependencies of target utils
 +
[ 29%] Building CXX object utils/CMakeFiles/utils.dir/src/cmd_line_parse.cpp.o
 +
[ 35%] Building CXX object utils/CMakeFiles/utils.dir/src/classnames.cpp.o
 +
[ 41%] Building CXX object utils/CMakeFiles/utils.dir/src/ti_logger.cpp.o
 +
[ 47%] Building CXX object utils/CMakeFiles/utils.dir/src/utils.cpp.o
 +
[ 52%] Linking CXX static library ../../lib/Release/libutils.a
 +
[ 52%] Built target utils
 +
Scanning dependencies of target app_semantic_segmentation
 +
[ 58%] Building CXX object app_semantic_segmentation/CMakeFiles/app_semantic_segmentation.dir/src/app_semseg_main.cpp.o
 +
[ 64%] Linking CXX executable ../../bin/Release/app_semantic_segmentation
 +
[ 64%] Built target app_semantic_segmentation
 +
Scanning dependencies of target app_image_classification
 +
[ 70%] Building CXX object app_image_classification/CMakeFiles/app_image_classification.dir/src/app_image_classification_main.cpp.o
 +
[ 76%] Linking CXX executable ../../bin/Release/app_image_classification
 +
[ 76%] Built target app_image_classification
 +
Scanning dependencies of target app_object_detection
 +
[ 82%] Building CXX object app_object_detection/CMakeFiles/app_object_detection.dir/src/app_object_detection_main.cpp.o
 +
[ 88%] Linking CXX executable ../../bin/Release/app_object_detection
 +
[ 88%] Built target app_object_detection
 +
Scanning dependencies of target app_dump_model_info
 +
[ 94%] Building CXX object app_dump_model_info/CMakeFiles/app_dump_model_info.dir/src/app_dump_model_info_main.cpp.o
 +
[100%] Linking CXX executable ../../bin/Release/app_dump_model_info
 +
[100%] Built target app_dump_model_info
 +
</pre>
 +
 +
<noinclude>
 +
{{Getting started with TI Jacinto 7 Edge AI/Foot|Demos/C++ Demos/Getting the models|Demos/C++ Demos/Classification}}
 +
</noinclude>

Latest revision as of 13:27, 8 March 2023




Previous: Demos/C++ Demos/Getting the models Index Next: Demos/C++ Demos/Classification





Build the Docker container & apps

The C++ Demos need to be run in a Docker image. This section shows the steps necessary to build the Docker container and demos.

Build the Docker container

  • Navigate to the docker directory:
cd /opt/edge_ai_apps/docker/
  • Build the Docker container:
./docker_build.sh
  • The command line should display something like the following:
Sending build context to Docker daemon  24.06kB
Step 1/13 : FROM arm64v8/ubuntu:20.04 as edgeaikit
 ---> 6a98cbe39225
Step 2/13 : ARG DEBIAN_FRONTEND=noninteractive
 ---> 7099b799debf
Step 3/13 : ARG NPROC=1
 ---> a7a8c2e2e6a7
Step 4/13 : ARG PROJECT_NAME=edge_ai_apps
 ---> 9ead13dbe218
Step 5/13 : ENV USE_PROXY=none
 ---> 9d192f292557
Step 6/13 : ADD entrypoint.sh setup_proxy.sh setup_ti_processor_sdk.sh /usr/bin/
 ---> c29446d2018a
Step 7/13 : RUN /usr/bin/setup_proxy.sh
 ---> 69a09af4e3e4
Step 8/13 : RUN apt-get update -y && apt-get dist-upgrade -y && apt-get install -y     glib-2.0-dev     ncurses-dev     libgtk-3-dev     libavcodec-dev     libavformat-dev     libswscale-dev     libv4l-dev     libxvidcore-dev     libx264-dev     libjpeg-dev     libpng-dev     libtiff-dev     libatlas-base-dev     libtbb2     libtbb-dev     libdc1394-22-dev     libgl-dev     libopencv-core-dev     libopencv-imgproc-dev     libglib2.0-0     libyaml-cpp-dev     libboost-all-dev
 ---> f27f0998d648
Step 9/13 : RUN apt-get install -y     build-essential     cmake     ninja-build     git     wget     unzip     pkg-config     gfortran     openexr
 ---> 361b456bb40d
Step 10/13 : RUN apt-get install -y     python3     python3-dev     python3-numpy     python3-opencv     python3-pip &&     pip3 install         jupyterlab         meson         PyYAML         Dlr &&     pip3 install --extra-index-url https://google-coral.github.io/py-repo/ tflite_runtime
 ---> 97b0a6b00425
Step 11/13 : RUN apt-get install -y     vim     rsync     strace     gdb     net-tools     dialog     chrony     nfs-common
 ---> 3291eeb37839
Step 12/13 : RUN apt-get install -y     libgstreamer1.0-0     libgstreamer1.0-dev     libgstreamer-plugins-base1.0-dev     gstreamer1.0-plugins-base     gstreamer1.0-plugins-good     gstreamer1.0-plugins-bad     gstreamer1.0-libav     gstreamer1.0-tools &&     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 ---> 79677fd988fd
Step 13/13 : ENTRYPOINT ["/usr/bin/entrypoint.sh"]
 ---> a27e6ab55a78
Successfully built a27e6ab55a78
Successfully tagged edge_ai_kit:latest
tensorflow
  • Run the Docker container:
./docker_run.sh
  • After running the container, your session should display a [docker] label before the root username:
[docker] root@j7-evm:/#

Build the C++ demos

To build the C++ demos, follow these steps:

  • Navigate to the C++ apps directory:
cd /opt/edge_ai_apps/apps_cpp/
  • Build the apps by running the following commands:
mkdir build
cd build
cmake ..
make
  • After running the build commands, the command line should display something like the following:
Scanning dependencies of target ti_dl_inferer
[  5%] Building CXX object dl_inferer/CMakeFiles/ti_dl_inferer.dir/src/ti_dl_inferer.cpp.o
[ 11%] Building CXX object dl_inferer/CMakeFiles/ti_dl_inferer.dir/src/ti_dlr_inferer.cpp.o
[ 17%] Building CXX object dl_inferer/CMakeFiles/ti_dl_inferer.dir/src/ti_tflite_inferer.cpp.o
[ 23%] Linking CXX static library ../../lib/Release/libti_dl_inferer.a
[ 23%] Built target ti_dl_inferer
Scanning dependencies of target utils
[ 29%] Building CXX object utils/CMakeFiles/utils.dir/src/cmd_line_parse.cpp.o
[ 35%] Building CXX object utils/CMakeFiles/utils.dir/src/classnames.cpp.o
[ 41%] Building CXX object utils/CMakeFiles/utils.dir/src/ti_logger.cpp.o
[ 47%] Building CXX object utils/CMakeFiles/utils.dir/src/utils.cpp.o
[ 52%] Linking CXX static library ../../lib/Release/libutils.a
[ 52%] Built target utils
Scanning dependencies of target app_semantic_segmentation
[ 58%] Building CXX object app_semantic_segmentation/CMakeFiles/app_semantic_segmentation.dir/src/app_semseg_main.cpp.o
[ 64%] Linking CXX executable ../../bin/Release/app_semantic_segmentation
[ 64%] Built target app_semantic_segmentation
Scanning dependencies of target app_image_classification
[ 70%] Building CXX object app_image_classification/CMakeFiles/app_image_classification.dir/src/app_image_classification_main.cpp.o
[ 76%] Linking CXX executable ../../bin/Release/app_image_classification
[ 76%] Built target app_image_classification
Scanning dependencies of target app_object_detection
[ 82%] Building CXX object app_object_detection/CMakeFiles/app_object_detection.dir/src/app_object_detection_main.cpp.o
[ 88%] Linking CXX executable ../../bin/Release/app_object_detection
[ 88%] Built target app_object_detection
Scanning dependencies of target app_dump_model_info
[ 94%] Building CXX object app_dump_model_info/CMakeFiles/app_dump_model_info.dir/src/app_dump_model_info_main.cpp.o
[100%] Linking CXX executable ../../bin/Release/app_dump_model_info
[100%] Built target app_dump_model_info


Previous: Demos/C++ Demos/Getting the models Index Next: Demos/C++ Demos/Classification