# Setup Upsqure
## 1. 製作 Ubuntu 開機隨身碟
- 下載 ubuntu 18.04.03 ISO image
- [ubuntu 18.04.03](http://old-releases.ubuntu.com/releases/18.04.3/ubuntu-18.04-desktop-amd64.iso)
- 下載 balenaEtcher ,以用來製作開機隨身碟
- [balenaEtcher](https://www.balena.io/etcher)
- 將 balena-etcherxxxx.zip 解壓縮後並開啟,開啟畫面如下

- 點選 `Select image` 並選擇一開始下載好的 `ubuntu-18.04-desktop-amd64.iso`,選好會跳到第二步驟

- 將要製作成開機隨身碟的 usb 插入主機畫面會變成下面的樣子 (隨身碟要先清空,最好可以先格式化)

- 按下 `flash` 開始製作開機隨身碟,完成後隨身碟的內容會如下面的圖片

## 2. 在 Upsqure 上安裝 Ubuntu 作業系統
- 將 upsqure 接上螢幕、鍵盤、滑鼠、開機隨身碟之後,再將電源接上
- 開機後選擇 `Install Ubuntu`

- 選擇語言

- 依照個人需求選擇 `Normal installation` 或者 `Minimal installation`

- 選擇 `Erase disk and install Ubuntu`


- 選擇時區

- 設定 `username` 以及 `password`

- 等待安裝完成後,系統會要求重新啟動,並停留在下面的畫面

- 此時依照指示將 usb 卸除,並按 `Enter` 鍵即可重新開機
## 3. Install Ubuntu kernel 4.15.0 for UP from PPA on Ubuntu 18.04
- 將網路線插上 upsqure
- 開啟終端機
- 新增 repository
`$ sudo add-apt-repository ppa:ubilinux/up`
- 更新 repository list
`$ sudo apt update`
- 移除原有的 kernel
`$ sudo apt-get autoremove --purge 'linux-.*generic'`
- 系統會詢問是否要 `Abort kernel removal` ,選擇 **No**

- 安裝 UpWiki 提供的另一個 kernal
`$ sudo apt-get install linux-image-generic-hwe-18.04-upboard`
- 安裝 updates
`$ sudo apt dist-upgrade -y`
- 重新開機
`$ sudo reboot`
- 確認是否安裝成功
```
$ uname -a
Linux upsquared-UP-APL01 4.15.0-37-generic #40~upboard04-Ubuntu SMP
Thu Feb 14 13:49:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
```
>參考資料
>[Upwiki](https://wiki.up-community.org/Ubuntu)
>
## 4. 安裝 OpenVino tookit
參考 [Install Intel® Distribution of OpenVINO™ toolkit for Linux*](https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_linux.html#install-openvino)步驟
- 進去網頁後點選右邊的 `Install the Intel® Distribution of OpenVINO™ Toolkit Core Components`

- 按照官方安裝流程操作,做完後依照官方文件指示驗證是否安裝成功

## 5. Myriad 驗證
- 先將 Upsqure 關機
- 將加速器插上板子並鎖上螺絲

- 開機並添加環境變數 (若沒有將環境變數寫在 `bash.rc` 才需要做此動作)
- `source /opt/intel/openvino/bin/setupvars.sh`
- 使用 OpenVINO 並選擇 Myriad 做 inference device target
- `$ cd /opt/intel/openvino/deployment_tools/demo`
- `$ sudo ./demo_benchmark_app.sh -d MYRIAD`
- 若出現 `Full device name: Intel Movidius Myriad X VPU` 字樣表示有成功使用到 Myriad

- 可以自行比較有加參數 `-d MYRIAD` 和沒有加參數跑出來的 Throughput
## 6. Run a sample by yourself
之前文件中的驗證方式都是直接跑官方寫好的腳本,試著自己選擇 input file 和 model 做 inference
- 參考 [Install Intel® Distribution of OpenVINO™ toolkit for Linux*](https://docs.openvinotoolkit.org/latest/_docs_install_guides_installing_openvino_linux.html#run-a-sample),並點選右下角的 `Run a Sample Application`
