# 影像檢測系統安裝手冊 Last update: 2021/12/21 ## 首次安裝 安裝操作系統時,請預先安裝好 Ubuntu desktop,並在安裝時選擇英文語系以減少語系問題。 #### 系統需求 - Ubuntu 16.04, 18.04 amd64 desktop - Nvidia CUDA 11.0 以下(請依顯卡驅動選用合適的 cuda 版本) - CUDA 10.2 - cuDNN 8.3 > ★★★ 因為外觀機部分算法需要 cuda 及 cuDNN 函式庫,因此請依下述步驟安裝 cuda & cuDNN。 > ```bash > # download install files from server > scp -P 2200 zhenhai@192.168.20.200:./Downloads/cuda_10.2.89_440.33.01_linux.run ./ > scp -P 2200 zhenhai@192.168.20.200:./Downloads/cuda_10.2.1_linux.run ./ > scp -P 2200 zhenhai@192.168.20.200:./Downloads/cuda_10.2.2_linux.run ./ > scp -P 2200 zhenhai@192.168.20.200:./Downloads/cudnn-10.2-linux-x64-v8.3.0.98.tgz ./ > > # install files > chmod +x ./*.run > sudo ./cuda_10.2.89_440.33.01_linux.run # you may skip drivers > sudo ./cuda_10.2.1_linux.run # select "upgrade" > sudo ./cuda_10.2.2_linux.run # select "upgrade" > sudo cp cudnn-10.2-linux-x64-v8.3.0.98.tgz /usr/local/ > cd /usr/local && sudo tar xzvf cudnn-10.2-linux-x64-v8.3.0.98.tgz > ``` 本檢測系統共含四個組件,請依順序安裝: zhap_manager -> zhap_skin -> zhap_core -> zhap_ota 1. `zhap_manage`: setup_manager_yymmdd.sh 2. `zhap_skin`: setup_skin_xxxx_yymmdd.sh 3. `zhap_core`: setup_core_yymmdd_ubuntu16.04_amd64.sh 4. `zhap_ota`: setup_ota_yymmdd.sh (選配功能) > 安裝檔可先拷貝到機台對應資料夾底下 (ex:/home/zhenhai/Downloads) > 安裝過程請留意每一安裝包安裝完畢均會出現底下訊息,確保安裝成功。 ![](https://upload.cc/i1/2021/07/12/j8Ikf3.png) ### 安裝 zhap_manager 套件 輸入命令後依照提示完成安裝。 ``` $ cd /home/zhenhai/Downloads $ bash ./setup_manager_yymmdd.sh ``` 安裝過程可能會需要輸入 DB 的密碼,請依照提示進行全部安裝,在 step4 時,有時需等待較久的時間 ![](https://upload.cc/i1/2021/07/13/UkfXIM.png) 當提示需要輸入路徑時,直接套用預設值。 **若想要重新安裝 manager,請勿直接使用安裝檔重裝,請先使用我們提供的 `uninstall_manager.sh` 反安裝後再重新安裝。** ### 安裝 zhap_skin 套件 輸入命令 ``` $ bash ./setup_skin_general_yymmdd.sh ``` > 接下來請依照提示進行全部安裝 ### 安裝 zhap_core 套件 輸入命令後依照提示完成安裝。 ``` $ bash setup_zhap_core_ubuntu16.04_amd64_yymmdd.sh ``` ### 安裝 OTA 套件 (選配功能) 輸入命令: ``` $ bash ./setup_ota_yymmdd.sh ``` > 更新前請與相關人員確認對應的帳號/密碼 OTA Server 直接回撤套用缺省值(如下圖) ![](https://upload.cc/i1/2021/07/13/E7qoxD.png) `Git User/Git User's Password:` 請輸入對應的帳號與密碼,接下來請依照提示進行全部安裝,每次開機時,便會自動執行該 service 「一次」,來進行下載更新的動作,如果要在機器運作時進行更新,請手動執行: ``` $ sudo service zhap_ota restart ``` > 關於更多資訊請參閱手冊 [使用 OTA 進行全廠更新](https://hackmd.io/@N9HOZg00SCiz2Gy_GfiZxw/SJCLT3UnO) ### 系統調校 (Optional) #### 手動修改環境設定檔 zhap_launcher.service 修改`zhap_launcher.service` ```bash $ sudo vim /etc/systemd/system/zhap_launcher.service ``` 參數修改方式請依實際需要調整,格式參考如下所示 ```bash [Service] ... Environment=LOGGING_LEVEL=debug ... # 註解不用在前面加 # # Environment=BLINKA_FT232H=1 ... ``` 修改完畢後重新載入修改的服務組態及重啟服務 ```bash # Reload service configuration $ sudo systemctl daemon-reload # Restart service $ sudo service zhap_launcher restart ``` ## 軟體更新 ### 更新 zhap_core 套件 當更新 `zhap_core` 時,振海會提供更新檔`zhap_core_xxxxx-1.0.200527-cp36-cp36m-linux_x86_64.whl`,請依照底下命令進行更新。 ```bash # 反安裝舊版本 $ sudo python3.6 -m pip list --format=freeze | grep zhap-core | cut -d = -f 1 | xargs -n1 sudo pip3 uninstall -y # 安裝新版本 $ sudo python3.6 -m pip install zhap_core_yyyy.mm.dd-cp36-cp36m-linux_x86_64.whl # 或是... $ sudo python3.6 -m pip install zhap_core_yyyy.mm.dd-cp36-cp36m-linux_x86_64.whl --upgrade ``` 完成後重啟電腦或重啟服務套用更新: ``` $ sudo service zhap_launcher restart ``` ### 更新 zhap_skin 套件 當更新 `zhap_skin` 時,振海會提供更新檔 `setup_zhap_skin_yymmdd.sh`,請依照底下命令進行更新。 ``` $ bash ./setup_skin_yymmdd.sh --update ``` 完成後刷新瀏覽器頁面即可。 ### 更新 zhap_manager 套件 當更新`manager`軟件時,振海會提供更新檔`setup_zhap_manager_yymmdd.sh`,請依照底下命令進行更新。`(註1.)` ``` $ bash ./setup_manager_xxxx_yymmdd.sh -u *********************************** * Zhap Manager (Taicon) Installer * *********************************** ******************************** Use sudo for install: Enter login password: -----Update mode----- You will install to: /opt/zhenhai/zhap_manager/ Start: Uncompress Files manager_server db.sql rec_expiry -----Done----- ``` 待完成後,重啟服務即可。 ``` $ sudo service zhap_manager restart ``` 另外也可確認版本是否已更新: ``` $ cd /opt/zhenhai/zhap_manager $ ./manager_server --version ``` ![](https://upload.cc/i1/2021/07/13/1FtRUi.png) **註1.** 當更新`manager`軟件時,系統會詢問`Input DB NAME`和`Input DB password`需輸入該機台設定所對應的值,可在`/opt/zhenhai/zhap_manager/config.json`查詢. 另外系統會額外訊問`Re-build camera_history table?`第一次執行時請選`y`,之後就不需重複做,當重建表格時會需要等待一段時間.以上只有做更新時才會遇到. ## 疑難排解 1. 當安裝zhap_core安裝包遇到套件安裝失敗如下圖時,可以嘗試底下兩個解決方式: ![](https://upload.cc/i1/2022/03/07/1jI7bN.png) 以*torch*套件為例: ```bash $ pip install -i https://pypi.tuna.tsinghua.edu.cn/simple torch==1.7.1 或者 $ pip install --extra-index-url http://192.168.20.200:8080 torch==1.7.1 ``` 上述的第二種方法,因相關套件均以事先下載至東莞內部的服務器上,因此只限於東莞內部安裝執行.