技術工具
- 工具首頁\
- Darknet/CV-VSC-GPU
### 容器說明
Darknet 是 YOLO 作者開發的 AI 框架。本容器內含 *AlexeyAB* 所維護的[Darknet](https://github.com/AlexeyAB/darknet),以及已經訓練好的 YOLO v4 預訓練權重 (Pretrain weights)。
我們在安裝Darknet的時候,有開啟張量核心 (Tensor Core)支持,方便使用者可以利用單半混精核心去加速模型的訓練/預測。
本容器亦整合了 ```cdr/code-server```,它是網頁版本的 Visual Studio Code,使用者登入後,便可使用此位於雲端的 IDE 介面來做程式開發。
本容器建置於 2020 年 6 月。
### 環境限制
使用本容器之前,請先行於本機安裝 NVIDIA 驅動 418.39(或以上)的版本。
本容器為了使用 Tensor Core 加速,只支持以下具有 Tensor Core 的卡片: Quadro RTX 系列; Titan RTX; Geforce RTX 2080 系列; Tesla T4; Tesla V100。
### 下載方式
請於終端機執行以下指令:
```bash
docker pull moeaidb/aigo:cu10.1-dnn7.6-gpu-darknet-vsc-20.06
```
### 使用方式
#### 使用範例 1: 使用 code server 服務
掛載當前位置目錄 (```$PWD```) 至容器內部的 ```/workspace``` 資料夾,並且讓code server服務監聽本機的port ```9999```:
```bash
# 決定 code server 該監聽本機的哪一個port。
host_port=9999
# 啟動容器並取得容器 ID。
container_id=$(nvidia-docker run -d --rm -p ${host_port}:8080 \
-v $PWD:/workspace \
moeaidb/aigo:cu10.1-dnn7.6-gpu-darknet-vsc-20.06) # 休息一會,靜待容器服務啟動。
# 等待服務啟動。
sleep 3.
# 顯示密碼於螢幕。
docker exec -it ${container_id} cat /root/.config/code-server/config.yaml | grep password:
```
輸入以上指令於終端機後,應該會顯示登入 code server 的密碼:
```bash
password: 909655d9e1902d6a01a35b26
```
這代表我們已經在容器內啟動了 code server 服務。接著,請開啟瀏覽器至本機網址(http://[your_ip]:9999/),即可進入 code server 頁面。
進入 code server 頁面,輸入先前取得的密碼,然後按下 submit 登入 code server。
![](https://i.imgur.com/cGxZIOF.png)
登入 code server 後,將看到如下畫面:
![](https://i.imgur.com/qN0EW9V.png)
#### 使用範例 2: 運行 Darknet YOLOv4 範例
於 code server 瀏覽器頁面,按下 ```Open folder```。
![](https://i.imgur.com/G7sAfI7.png)
輸入 ```/opt/darknet``` 後,按 ok,則可進入 ```/opt/darknet``` 資料夾。
![](https://i.imgur.com/a3TBvJ9.png)
按左上角的 ≡ 按鈕,選擇 ```Terminal → New Terminal```,以便開啟終端機。
![](https://i.imgur.com/8o21lF7.png)
在終端機內輸入以下指令後按下 ```enter```,來針對一張包含一隻狗的圖片做預測:
```bash
./darknet detect cfg/yolov4.cfg yolov4.weights data/dog.jpg # 使用YOLOv4來預測範例圖片 (dog.jpg)
```
若終端機出現以下訊息,表示預測成功:
![](https://i.imgur.com/oiZXw7D.png)
可從左側找尋 ```predictions.jpg```,此為 darknet 產生的預測結果,按兩下可將其打開,顯示於 web 編輯介面內:
![](https://i.imgur.com/UfX72Ab.jpg)
### 套件資訊
| 套件/軟體/函式庫名稱 | 版本 | 套件說明 |
|:---------|:---------:|:---------|
| [NVIDIA CUDA](https://developer.nvidia.com/cuda-toolkit) | 10.1.243-1 | The NVIDIA® CUDA® Toolkit provides a development environment for creating high performance GPU-accelerated applications. </br>CUDA為NVIDIA為其GPU所提供的開發框架。所有AI開發框架皆會呼叫其所提供的API。
| [NVIDIA cuDNN](https://developer.nvidia.com/cudnn) | 7.6.5.32-1+cuda10.1 | The NVIDIA CUDA® Deep Neural Network library (cuDNN) is a GPU-accelerated library of primitives for deep neural networks. </br>cuDNN是NVIDIA專門為深度神經網路開發所提供的函示庫。 |
| [NVIDIA TensorRT](https://developer.nvidia.com/tensorrt) | 6.0.1-1+cuda10.1 | NVIDIA TensorRT® is a platform for high-performance deep learning inference. </br>於模型部署階段,可利用NVIDIA TensorRT將模型優化,或將單精度模型以合適的方式轉換成半精度模型,使模型推理能夠以高速運行。 |
| [NVIDIA Collectives Communication Library (NCCL)](https://developer.nvidia.com/nccl) | v2.4.8-1+cuda10.1 | The NVIDIA Collective Communications Library (NCCL) implements multi-GPU and multi-node collective communication primitives that are performance optimized for NVIDIA GPUs. </br>使用多GPU訓練時,TensorFlow可利用NVIDIA NCCL做多GPU加速。
| [OpenCV](https://opencv.org) (Intel-MKL-acclerated) | 4.3.0 | OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. </br> 用於影像處理,以及建立影像相關的機器學習模型。 |
| [Darknet](https://github.com/AlexeyAB/darknet) | 320e6fd | Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation. </br> YOLO作者所創立的框架。基於C語言,所以相當快速簡便。 |
| [code server](https://github.com/cdr/code-server) | 3.4.1 | VS Code in the browser </br> 雲端版本的Visual Studio Code。 |
| 套件/軟體/函式庫名稱 | 版本 | 套件說明 |
|:---------|:---------:|:---------|
| [NVIDIA CUDA](https://developer.nvidia.com/cuda-toolkit) | 10.1.243-1 | The NVIDIA® CUDA® Toolkit provides a development environment for creating high performance GPU-accelerated applications. CUDA為NVIDIA為其GPU所提供的開發框架。所有AI開發框架皆會呼叫其所提供的API。
| [NVIDIA cuDNN](https://developer.nvidia.com/cudnn) | 7.6.5.32-1+cuda10.1 | The NVIDIA CUDA® Deep Neural Network library (cuDNN) is a GPU-accelerated library of primitives for deep neural networks. cuDNN是NVIDIA專門為深度神經網路開發所提供的函示庫。 |
| [NVIDIA TensorRT](https://developer.nvidia.com/tensorrt) | 6.0.1-1+cuda10.1 | NVIDIA TensorRT® is a platform for high-performance deep learning inference. 於模型部署階段,可利用NVIDIA TensorRT將模型優化,或將單精度模型以合適的方式轉換成半精度模型,使模型推理能夠以高速運行。 |
| [NVIDIA Collectives Communication Library (NCCL)](https://developer.nvidia.com/nccl) | v2.4.8-1+cuda10.1 | The NVIDIA Collective Communications Library (NCCL) implements multi-GPU and multi-node collective communication primitives that are performance optimized for NVIDIA GPUs. 使用多GPU訓練時,TensorFlow可利用NVIDIA NCCL做多GPU加速。
| [OpenCV](https://opencv.org) (Intel-MKL-acclerated) | 4.3.0 | OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. 用於影像處理,以及建立影像相關的機器學習模型。 |
| [Darknet](https://github.com/AlexeyAB/darknet) | 320e6fd | Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation. YOLO作者所創立的框架。基於C語言,所以相當快速簡便。 |
| [code server](https://github.com/cdr/code-server) | 3.4.1 | VS Code in the browser 雲端版本的Visual Studio Code。 |
請先登入後輸入您的回覆