Thundercomm TurboX C8550/Intelligent SDK/TFLite SDK: Difference between revisions
(Created page with "<noinclude> {{Thundercomm TurboX C8550/Head|previous=Intelligent SDK|next=Intelligent SDK/TFLite SDK|description=}} </noinclude> {{DISPLAYTITLE:Thundercomm TurboX C8550 - QIM SDK|noerror}} This section will help you to build, install and test the QIM SDK. The QIM (Qualcomm Intelligent Multimedia) SDK is a GStreamer-based SDK that provides a set of multimedia, CV (Computer Vision), and AI (Artificial Intelligence) plug-ins to facilitate application developers in develop...") |
mNo edit summary |
||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
{{Thundercomm TurboX C8550/Head|previous=Intelligent SDK|next= | {{Thundercomm TurboX C8550/Head|previous=Intelligent SDK/QIM SDK|next=GStreamer_pipelines|metakeywords=thundercomm}} | ||
</noinclude> | </noinclude> | ||
{{DISPLAYTITLE:Thundercomm TurboX C8550 - | {{DISPLAYTITLE:Thundercomm TurboX C8550 - TFLite SDK|noerror}} | ||
This section will help you to build, install and test the | This section will help you to build, install and test the TFLite SDK. TFLite (TensorFlow) SDK is a library for deploying models on mobile devices, microcontrollers and other edge devices. <ref name="intelligentsdk">TurboX C8550 Linux Embedded Standalone SDK Addon User Manual. Retrieved August 6, 2024, from [https://docs.thundercomm.com/turbox_doc/data/turbox-c8550/d_c8550_2/tc-p-23112-_turbox_c8550_linux_embedded_standalone-sdk-addon_user_manual_v1-2.pdf]</ref>. For this section it's required to have built the base SDK first. If not, please follow first the instructions on the [[Thundercomm TurboX C8550/Software_Support/SDK/Building_Images_from_Source|Building Images from Source]] section. | ||
Please follow the next steps in order to configure it properly. | Please follow the next steps in order to configure it properly. | ||
== Download the | == Download the TFLite SDK Code == | ||
1. Execute the SDK Manager container: | 1. Execute the SDK Manager container: | ||
Line 17: | Line 17: | ||
</pre> | </pre> | ||
2. Download the | 2. Download the TFLite SDK code: | ||
<pre lang=bash> | <pre lang=bash> | ||
Line 27: | Line 27: | ||
2.2. On the SDK branch selection, choose '''SDK.Turbox-QCS8550.LE.1.0.Standalone.sdk.addon'''. | 2.2. On the SDK branch selection, choose '''SDK.Turbox-QCS8550.LE.1.0.Standalone.sdk.addon'''. | ||
2.3. For version options, choose '''turbox- | 2.3. For version options, choose '''turbox-tflite-sdk-1.0-dev.release.r000002'''. | ||
2.4. Press '''Enter''' to download the SDK code in the default path, and the confirm typing '''Yes'''. | 2.4. Press '''Enter''' to download the SDK code in the default path, and the confirm typing '''Yes'''. | ||
The code will be located at ''workspace/sourcecode/turbox- | The code will be located at '' workspace/sourcecode/turbox-tflite-sdk-1.0-dev.release.r000002/''. | ||
== Build the TFLite SDK == | |||
== Build the | |||
1. Create the output directory for the SDK build: | 1. Create the output directory for the SDK build: | ||
Line 56: | Line 39: | ||
<pre lang=bash> | <pre lang=bash> | ||
cd ~ | cd ~ | ||
mkdir -p | mkdir -p workspace/intelligent-sdk/tflite-sdk | ||
</pre> | </pre> | ||
2. Go to the | 2. Go to the TFLite SDK source code directory: | ||
<pre lang=bash> | <pre lang=bash> | ||
cd workspace/sourcecode/turbox- | cd workspace/sourcecode/turbox-tflite-sdk-1.0-dev.release.r000002/tflite-tools | ||
</pre> | </pre> | ||
3. Build the | 3. Build the TFLite SDK: | ||
<pre lang=bash> | <pre lang=bash> | ||
source ./scripts/host/host_env_setup.sh | source ./scripts/host/host_env_setup.sh | ||
tflite-tools-setup targets/le-tflite-tools-builder.json | |||
</pre> | </pre> | ||
{{Colored box|background-title-color=#6586B9|title-color=#FFFFFF|title='''Note'''|icon= | {{Colored box|background-title-color=#6586B9|title-color=#FFFFFF|title='''Note'''|icon= | ||
|style=overflow:hidden; | |style=overflow:hidden; | ||
|content=This step might take some time | |content=This step might take some time, in our case it took around 20 minutes. | ||
}} | }} | ||
4. Generate the | 4. Generate the TFLite SDK artifacts: | ||
<pre lang=bash> | <pre lang=bash> | ||
source ./scripts/host/host_env_setup.sh | |||
tflite-tools-host-get-rel-package targets/le-tflite-tools-builder.json | |||
tflite-tools-host-get-dev-package targets/le-tflite-tools-builder.json | |||
tflite-tools-host-get-dev-tar-package targets/le-tflite-tools-builder.json | |||
</pre> | </pre> | ||
== Install the | == Install the TFLite SDK == | ||
1. Connect to the board via [[Thundercomm TurboX C8550/Development in the Board/Getting_into_the_Board/Using_adb|ADB]]. | 1. Connect to the board via [[Thundercomm TurboX C8550/Development in the Board/Getting_into_the_Board/Using_adb|ADB]]. | ||
Line 97: | Line 82: | ||
</pre> | </pre> | ||
3. Push the | 3. Push the TFLite packages to the device: | ||
<pre lang=bash> | <pre lang=bash> | ||
adb push /home/turbox/workspace/intelligent-sdk/tflite-sdk/tflite-kalama-toolchain-/tflite-2.11.1-le/tflite_pkg/*.ipk /tmp | |||
</pre> | </pre> | ||
4. | 4. Install the packages inside the device: | ||
<pre lang=bash> | <pre lang=bash> | ||
adb shell " | adb shell "opkg --force-depends --force-reinstall --force-overwrite install /tmp/*.ipk" | ||
</pre> | </pre> | ||
==Test the TFLite SDK== | |||
1. Create the following directories for data: | |||
<pre lang=bash> | <pre lang=bash> | ||
adb shell | mkdir -p ./data/Models | ||
mkdir -p ./data/Labels | |||
</pre> | |||
2. Download the model file: | |||
<pre lang=bash> | |||
curl https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_02_22/mobilenet_v1_1.0_224.tgz | tar xzv -C ./data | |||
mv ./data/mobilenet_v1_1.0_224.tflite ./data/Models | |||
</pre> | |||
3. Download the label file: | |||
<pre lang=bash> | |||
curl https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_1.0_224_frozen.tgz | tar xzv -C ./data | |||
mv ./data/mobilenet_v1_1.0_224/labels.txt ./data/Labels/ | |||
</pre> | |||
4. Push the files to the device: | |||
<pre lang=bash> | |||
adb root | |||
adb remount | |||
adb shell mount -o remount,rw / | |||
adb push ./data/Labels /data | |||
adb push ./data/Models /data | |||
adb push /home/turbox/workspace/intelligent-sdk/tflite-sdk/tflite-kalama-toolchain-/tflite-2.11.1-le/src/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp /data/Labels/ | |||
</pre> | |||
5. Label the image in the device: | |||
<pre lang=bash> | |||
adb root | |||
adb shell "label_image -l /data/Labels/labels.txt -i /data/Labels/grace_hopper.bmp -m /data/Models/mobilenet_v1_1.0_224.tflite -c 10 -j 1 -p 1" | |||
</pre> | </pre> | ||
You should get an output like this: | |||
<pre lang=text> | |||
INFO: 0.860174: 653 653:military uniform | |||
INFO: 0.0481019: 907 907:Windsor tie | |||
INFO: 0.007867: 466 466:bulletproof vest | |||
INFO: 0.00644933: 514 514:cornet, horn, trumpet, trump | |||
INFO: 0.00608029: 543 543:drumstick | |||
</pre> | |||
== References == | == References == | ||
Line 128: | Line 149: | ||
<noinclude> | <noinclude> | ||
{{Thundercomm TurboX C8550/Foot | {{Thundercomm TurboX C8550/Foot|Intelligent SDK/QIM SDK|GStreamer_pipelines}} | ||
</noinclude> | </noinclude> |
Latest revision as of 18:48, 10 December 2024
This section will help you to build, install and test the TFLite SDK. TFLite (TensorFlow) SDK is a library for deploying models on mobile devices, microcontrollers and other edge devices. [1]. For this section it's required to have built the base SDK first. If not, please follow first the instructions on the Building Images from Source section.
Please follow the next steps in order to configure it properly.
Download the TFLite SDK Code
1. Execute the SDK Manager container:
turbox-sdkmanager-setup.sh --os-version 18.04 -u
2. Download the TFLite SDK code:
sdkmanager --sdk_download
2.1. When asked for the product to use, select Turbox_C8550.
2.2. On the SDK branch selection, choose SDK.Turbox-QCS8550.LE.1.0.Standalone.sdk.addon.
2.3. For version options, choose turbox-tflite-sdk-1.0-dev.release.r000002.
2.4. Press Enter to download the SDK code in the default path, and the confirm typing Yes.
The code will be located at workspace/sourcecode/turbox-tflite-sdk-1.0-dev.release.r000002/.
Build the TFLite SDK
1. Create the output directory for the SDK build:
cd ~
mkdir -p workspace/intelligent-sdk/tflite-sdk
2. Go to the TFLite SDK source code directory:
cd workspace/sourcecode/turbox-tflite-sdk-1.0-dev.release.r000002/tflite-tools
3. Build the TFLite SDK:
source ./scripts/host/host_env_setup.sh
tflite-tools-setup targets/le-tflite-tools-builder.json
4. Generate the TFLite SDK artifacts:
source ./scripts/host/host_env_setup.sh
tflite-tools-host-get-rel-package targets/le-tflite-tools-builder.json
tflite-tools-host-get-dev-package targets/le-tflite-tools-builder.json
tflite-tools-host-get-dev-tar-package targets/le-tflite-tools-builder.json
Install the TFLite SDK
1. Connect to the board via ADB.
2. Remount the filesystem:
adb root
adb remount
adb shell mount -o remount,rw /
adb shell "mkdir -p /tmp"
3. Push the TFLite packages to the device:
adb push /home/turbox/workspace/intelligent-sdk/tflite-sdk/tflite-kalama-toolchain-/tflite-2.11.1-le/tflite_pkg/*.ipk /tmp
4. Install the packages inside the device:
adb shell "opkg --force-depends --force-reinstall --force-overwrite install /tmp/*.ipk"
Test the TFLite SDK
1. Create the following directories for data:
mkdir -p ./data/Models
mkdir -p ./data/Labels
2. Download the model file:
curl https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_2018_02_22/mobilenet_v1_1.0_224.tgz | tar xzv -C ./data
mv ./data/mobilenet_v1_1.0_224.tflite ./data/Models
3. Download the label file:
curl https://storage.googleapis.com/download.tensorflow.org/models/mobilenet_v1_1.0_224_frozen.tgz | tar xzv -C ./data
mv ./data/mobilenet_v1_1.0_224/labels.txt ./data/Labels/
4. Push the files to the device:
adb root
adb remount
adb shell mount -o remount,rw /
adb push ./data/Labels /data
adb push ./data/Models /data
adb push /home/turbox/workspace/intelligent-sdk/tflite-sdk/tflite-kalama-toolchain-/tflite-2.11.1-le/src/tensorflow/lite/examples/label_image/testdata/grace_hopper.bmp /data/Labels/
5. Label the image in the device:
adb root
adb shell "label_image -l /data/Labels/labels.txt -i /data/Labels/grace_hopper.bmp -m /data/Models/mobilenet_v1_1.0_224.tflite -c 10 -j 1 -p 1"
You should get an output like this:
INFO: 0.860174: 653 653:military uniform
INFO: 0.0481019: 907 907:Windsor tie
INFO: 0.007867: 466 466:bulletproof vest
INFO: 0.00644933: 514 514:cornet, horn, trumpet, trump
INFO: 0.00608029: 543 543:drumstick
References