First snow in 2020. Actually, it is ALSO the FIRST snow for the winter from 2019 to 2020.
First Snow 1 | First Snow 2 | First Snow 3 |
---|---|---|
![]() |
![]() |
![]() |
Both my son and the Chinese New Year are coming. Let’s start the mode of celebrating. Today, I’m going to do the hotpot.
Hotpot 1 | Hotpot 2 | Hotpot 3 |
---|---|---|
![]() |
![]() |
![]() |
It looks in 1-day time, everybody is doing the edge computing. Today, we’re going to have some fun of Google Coral.
1. Google Coral USB Accelerator
Image cited from Coral official website.
To try out Google Coral USB Accelerator is comparitively simple. The ONLY thing to do is just to follow Google Doc - Get started with the USB Accelerator. Anyway, let’s test it out with the following commands.
Make sure we are able to list the device.
1 | ➜ classification git:(master) ✗ lsusb |
We then checkout Google Coral Edgue TPU and test the example classify_image.py.
1 | ➜ edgetpu git:(master) pwd |
BTW, I’m going to discuss
- Google Coral TPU
- Intel Movidius VPU
- Cambricon NPU which has been adopted in HuaWei Hikey 970 and Rockchip 3399 Pro
sooner or later. Just keep an eye on my blog.
2. Google Coral Dev Board
In the following, we’re going to disscuss Google Coral Dev Board more. Image cited from Coral official website.
2.1 Mendel Installation
2.1.1 Mendel Linux Preparation
Google Corel Mendel Linux can be downloaded from https://coral.ai/software/. In our case, we are going to try Mendel Linux 4.0.
2.1.2 Connect Dev Board Via Micro-USB Serial Port
On the host, we should be able to see:
1 | ➜ mendel-enterprise-day-13 lsusb |
Now what you see is a black screen. After having connected the Type C power cable, you should be able to see:
1 | ...... |
That is shown on the screen monitor of Google Coral Dev Board. We now need to input fastboot 0
on u-boot=>
prompt. After having connected the Type C OTG cable, we should be able to see on the host:
1 | ➜ mendel-enterprise-day-13 fastboot devices |
2.1.3 Flash Corel Dev Board
1 | ➜ mendel-enterprise-day-13 ls |
2.1.4 Boot Mendel
After a while, you’ll see:
Now, login with
- username: mendel
- password: mendel
1 | ➜ ~ mdt devices |
You will be able to see Google Coral Dev Board is NOW connected. If you don’t see the EXPECTED output mocha-shrimp (192.168.101.2), just plug out and plug in the Type C power cable again.
Unfortunately, mdt tool does NOT work properly.
1 | ➜ mendel-enterprise-day-13 mdt shell |
This bug has been clarified on StackOverflow. By modifying file vim $HOME/.local/lib/python3.6/site-packages/mdt/sshclient.py line 86, from if not self.address.startswith('192.168.100'):
to if not self.address.startswith('192.168.10'):
, problem solved.
1 | ➜ mendel-enterprise-day-13 mdt shell |
After activate the Internet by nmtui, we can NOW clearly see the wlan0 IP is automatically allocated.
1 | mendel@mocha-shrimp:~$ ip -c address |
Of course, we can setup a static IP for this particular Google Coral Dev Board afterwards.
2.1.5 SSH into Mendel
In order to SSH into Mendel and connect remotely, we need to do Connect to a board’s shell on the host computer. You MUST pushkey before you can ssh into the board via the Internet IP instead of the virtual IP via USB, say 192.168.100.2 or 192.168.101.2.
1 | ➜ ~ ssh -i ~/.ssh/id_rsa_mendel.pub mendel@192.168.1.97 |
However, for now, I’ve got NO idea why ssh NETVER works for Google Coral Dev Board any more.
From now on, a huge modification.
2.2 Flash from U-Boot on an SD card
If you get unlucky and you can't even boot your board into U-Boot, then you can recover the system by booting into U-Boot from an image on the SD card and then reflash the board from your Linux
(cited from Google Coral Dev Board’s Official Doc). Now, fastboot devices
from host is NOW back.
1 | ➜ mendel-enterprise-day-13 fastboot devices |
The, we reflash Google Coral Dev Board.
1 | ➜ mendel-enterprise-day-13 bash flash.sh |
Now we are able to run mdt shell
successfully.
1 | ➜ mendel-enterprise-day-13 mdt shell |
Run ssh-keygen
and pushkey
consequently:
1 | ➜ .ssh ssh-keygen |
Then, with mdt shell
, run command nmtui
to activate wlan0
.
Let’s briefly summarize:
2.3 Demonstration
2.3.1 edgetpu_demo –device & edgetpu_demo –stream
Let’s ignore edgetpu_demo –device for I ALMOST NEVER work with a GUI mode. The demo video is on my youtube channel, please refer to:
On console, it just displays as:
1 | mendel@deft-orange:~$ edgetpu_demo --stream |
2.3.2 Classification
Refer to Install the TensorFlow Lite library.
1 | mendel@green-snail:~/.local$ pip3 install https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37-cp37m-linux_aarch64.whl |
1 | mendel@green-snail:~/Downloads/tflite/python/examples/classification$ python3 classify_image.py --model models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels models/inat_bird_labels.txt --input images/parrot.jpg |
2.3.3 Camera
2.3.3.1 Google Coral camera
The Google Coral camera can be detected as a video device:
1 | mendel@mocha-shrimp:~$ v4l2-ctl --list-formats-ext --device /dev/video0 |
2.3.3.2 Face Detection Using Google TPU
My youtube real-time face detection video clearly shows Google TPU is seriously powerful.
On console, it displays:
1 | mendel@deft-orange:~$ edgetpu_detect_server \ |
2.3.4 Bugs
1 | mendel@green-snail:~$ edgetpu_demo --stream |
1 | mendel@green-snail:~/Downloads/edgetpu/test_data$ edgetpu_detect_server --model ./mobilenet_ssd_v2_face_quant_postprocess_edgetpu.tflite |
To solve this problem, run the following command:
1 | mendel@green-snail:~$ sudo systemctl restart weston |