Difference between revisions of "EBC Exercise 39 Setting Up tidl on X15"

From eLinux.org
Jump to: navigation, search
m (Run Examples)
m (classification)
Line 64: Line 64:
  
 
  root@x15$ '''cd classification'''
 
  root@x15$ '''cd classification'''
stream_config_inceptionnet.txt seems to have file missing
+
root@x15$ '''ls'''
 +
avg_fps_window.h  imagenet1001.txt  Makefile                        stream_config_mobilenet.txt
 +
classlist.txt    imagenet.txt      readme.md                      tidl_classification
 +
clips            images            stream_config_inceptionnet.txt tidl-sw-stack-small.png
 +
findclasses.cpp  main.cpp          stream_config_j11_v2.txt
  
stream_config_j11_v2.txt runs but gets the error "Corrupt JPEG data: 2 extraneous bytes before marker 0xd4"
+
<code>stream_config_inceptionnet.txt</code> seems to have a file missing.
 +
 
 +
<code>stream_config_j11_v2.txt</code>  runs but gets the error "Corrupt JPEG data: 2 extraneous bytes before marker 0xd4".
 
So I send stderr to /dev/null
 
So I send stderr to /dev/null
  
stream_config_mobilenet.txt runs but it looks like the color channels are switched
+
<code>stream_config_mobilenet.txt</code>  runs but it looks like the color channels are switched
  
The following takes live video from a camera and displays it on the host.  It also displays a list of objects
+
The following takes live video from a camera (/dev/video0) and displays it on the host.  It also displays a list of objects
 
it is looking for and highlights the last object it found.  See '''readme.md''' for more details.
 
it is looking for and highlights the last object it found.  See '''readme.md''' for more details.
  
 
  root@x15$ '''./tidl_classification -g 1 -d 2 -e 2 -l ./imagenet.txt -s ./classlist.txt -i 0 -c ./stream_config_j11_v2.txt 2> /dev/null'''
 
  root@x15$ '''./tidl_classification -g 1 -d 2 -e 2 -l ./imagenet.txt -s ./classlist.txt -i 0 -c ./stream_config_j11_v2.txt 2> /dev/null'''
 +
[[File:Water bottle.png|right|Water Bottle]]
 +
[[File:Items.png|center|Objects to recognize]]
  
 
This will play a video and classify it.  Note:  The ''readme.md'' referenced '''test50.mp4''',
 
This will play a video and classify it.  Note:  The ''readme.md'' referenced '''test50.mp4''',
 
but I couldn't find it so I'm using '''test10.mp4'''.
 
but I couldn't find it so I'm using '''test10.mp4'''.
  
 +
root@x15$ '''ls clips'''
 +
test10.mp4  test1.mp4  test2.mp4
 
  root@x15$ '''./tidl_classification -g 1 -d 2 -e 2 -l ./imagenet.txt -s ./classlist.txt -i ./clips/test10.mp4 -c ./stream_config_j11_v2.txt'''
 
  root@x15$ '''./tidl_classification -g 1 -d 2 -e 2 -l ./imagenet.txt -s ./classlist.txt -i ./clips/test10.mp4 -c ./stream_config_j11_v2.txt'''
 
See '''readme.md''' for more examples
 
See '''readme.md''' for more examples
  
'''main.cpp''', line 55, uncomment to have two Regions of Interest. (#define TWO_ROIs)
+
'''main.cpp''', line 55, uncomment to have two Regions of Interest. (<code>#define TWO_ROIs</code>)
  
Look in '''imagenet.txt''' to see what can be recognized and add them to '''classlist.txt'''.  
+
Look in '''imagenet.txt''' to see what can be recognized and add them to '''classlist.txt'''.
  
 
=== imagenet ===
 
=== imagenet ===

Revision as of 15:58, 9 January 2019

thumb‎ Embedded Linux Class by Mark A. Yoder


Here are instructions on how to run TI's Deep Learning (tidl) examples on a BeagleBone X15.

Install

Get Robert's tidl repo

x15$ git clone https://github.com/rcn-ee/tidl-api

Now follow the instructions in the readme.md file.

x15$ sudo apt update
x15$ sudo apt install ti-opencl libboost-dev libopencv-core-dev libopencv-imgproc-dev libopencv-highgui-dev libjson-c-dev

Most were already installed and up to date. Install time 38s.

Checkout the most current branch and compile. Use -j2 since we have 2 cores.

x15$ cd tidl-api/
x15$ git checkout origin/v01.02.02-bb.org -b v01.02.02-bb.org
x15$ make -j2 build-api      # 1m31s

The next build puts things in /usr/share/ti/tidl so create it and assume give user 1000 (should be debian) permission to read/write it.

x15$ sudo mkdir -p /usr/share/ti/tidl
x15$ sudo chown -R 1000:1000 /usr/share/ti/tidl/

x15$ make -j2 build-examples   # 2m28s

Extras to install

Here are a few other handy extras to install.

If you get a cmemk error:

x15$ cd /opt/scripts/tools/ ; git pull ; sudo ./update_kernel.sh ; sudo apt upgrade

Fix a path error with

x15$ cd /usr/share/ti/tidl
x15$ sudo ln -s <path to tidl>/tidl-api/examples .

The x15 runs a bit hot. A fan is suggested. You can check the CPU temp with

x15$ cat /sys/class/thermal/*/temp

A fan will drop the temp some 20 Deg C.

If you get Gtk-Message: Failed to load module "canberra-gtk-module", run

x15$ sudo apt install libcanberra-gtk-module libcanberra-gtk3-module

Install the image viewer "eye of gnome" for viewing images on the x15.

x15$ sudo apt install eog

Run Examples

Here's how to run some of the examples. From the host computer you need to ssh with the -XC flags so the x15 can access the host's X-windows to display things. You need to ssh as root for the X-Windows authentication to work. Here are instructions for setting a root password, etc.

host$ ssh -XC root@x15

classification

The imagenet demo is looking for one object out of a list of 1000 things. The classification demo is looking for one (or two if you set TWO_ROIs) object out of a small list of 12 or so things. You need to login to the x15 as root for the X-Windows authentication to work.

root@x15$ cd classification
root@x15$ ls
avg_fps_window.h  imagenet1001.txt  Makefile                        stream_config_mobilenet.txt
classlist.txt     imagenet.txt      readme.md                       tidl_classification
clips             images            stream_config_inceptionnet.txt  tidl-sw-stack-small.png
findclasses.cpp   main.cpp          stream_config_j11_v2.txt

stream_config_inceptionnet.txt seems to have a file missing.

stream_config_j11_v2.txt runs but gets the error "Corrupt JPEG data: 2 extraneous bytes before marker 0xd4". So I send stderr to /dev/null

stream_config_mobilenet.txt runs but it looks like the color channels are switched

The following takes live video from a camera (/dev/video0) and displays it on the host. It also displays a list of objects it is looking for and highlights the last object it found. See readme.md for more details.

root@x15$ ./tidl_classification -g 1 -d 2 -e 2 -l ./imagenet.txt -s ./classlist.txt -i 0 -c ./stream_config_j11_v2.txt 2> /dev/null
Water Bottle
Objects to recognize

This will play a video and classify it. Note: The readme.md referenced test50.mp4, but I couldn't find it so I'm using test10.mp4.

root@x15$ ls clips
test10.mp4  test1.mp4  test2.mp4
root@x15$ ./tidl_classification -g 1 -d 2 -e 2 -l ./imagenet.txt -s ./classlist.txt -i ./clips/test10.mp4 -c ./stream_config_j11_v2.txt

See readme.md for more examples

main.cpp, line 55, uncomment to have two Regions of Interest. (#define TWO_ROIs)

Look in imagenet.txt to see what can be recognized and add them to classlist.txt.

imagenet

Run the imagenet demo to recognize any of the 1000 images.

root@x15$ cd imagenet

sudo ./imagenet -d 2 -e2 -i IMG_3806.jpg ./imagenet -i camera0 2> /dev/null # Redirect the errors to ignore a message

  1. layer_ouput and mcbench look like handy tools.

cd segmentation ./segmentation -d 2 -e 2 camera0 -w 1200 2> /dev/null

cd ssd_multibox ./ssd_multibox -d 2 -e 2 camera0 -w 1200 2> /dev/null




thumb‎ Embedded Linux Class by Mark A. Yoder