Android SDK Getting Started Guide

Preparation

The following devices are required in this article:

  • Firefly development board (recommend ROC-RK3399-PC).
  • TF card (if there is no emmc on the board)
    • It is recommended to use 8GB and bigger capacity
  • Display (interface should refer to the development board)
  • Keyboard and mouse
  • Power
  • Neural network computing card
    • Temporarily only support USB Dongle module.
  • Web-enabled computer
    • It can be Windows or Linux system, configured with Android Studio 3.x development environment.

Burn Android system

The Android SDK of neural network computing card (only USB Dongle) supports any Android version released by Firefly. Please burn Android system based on the used development board. Please move to specific development board wiki to view burning tutorials from wiki website. The tutorials of ROC-RK3399-PC click here and enter.

Android environment settings

SDK decompression

Copy and decompress SDK GTI2801_ADK.tar.gz from an AI data U disk. If you use Linux system, please copy the SDK to your home directory, and then execute the following step to decompress the file to your home directory:

ubunut16.04:~$ tar zxvf ~/GTI2801_ADK.tar.gz

Installation of necessary files

  • Check whether V1.2/Data/Models/gti2801/gnet1/cnn/userinput.txt under SDK directory and USB device node in V1.2/Data/Models/gti2801/gnet18/cnn/userinput.txt are /dev/sg0, if not, please modify them to /dev/sg0 (USB Dongle device node is /dev/sg0 in general, if not, you should modify it according to actual conditions).

  • Files and models required for demo should be installed according to the following command.

    • Specific substeps are as follows:

      adb push ./Data/Image_demo /sdcard/gti/Image_mp4
      

      GNet1 model:

      adb push ./Data/Models/gti2801/gnet1 /sdcard/gti/Models/gti2801/gnet1
      

      GNet18 model:

      adb push ./Data/Models/gti2801/gnet18 /sdcard/gti/Models/gti2801/gnet18
      
    • You can also install them uniformly according to the following command:

      adb push ./Data /sdcard/gti
      
    • You can also directly copy Data directory to the development board and rename it as gti through MTP.

Device node settings

Insert USB Dongle into the development board, and recommend you to use USB 3.0 interface.

  • Modify the permission of USB Dongle node. Use adb to connect to Android shell, and then execute the following step:

    ROC_RK3399_PC:/ $ su
    ROC_RK3399_PC:/ # chmod 777 /dev/sg*
    
  • Modify the properties of max_sectors. Execute the following step on the basis of the previous step:

    ROC_RK3399_PC:/ # find /sys/devices/ -name max_sectors -exec sh -c 'echo 2048 > "$1"' _ {} \;
    

    Set the value of max_sectors to 2048.

  • note: each time the device is rebooted or USB Dongle is pulled out and inserted, the aforesaid two steps should be executed again.

Demo compiling and testing

Use Android Studio to open V1.2/Samples/Android/gtiVideoDemo_gnet1/ or V1.2/Samples/Android/gtiVideoDemo_gnet18/ from the computer side. After finishing the installation of dependent components, you just click the running button of Android Studio and then the demo can be run. After APP is booted, you would see two images, click the helicopter and then video classification demo can be run.