

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 設定您的 裝置
<a name="neo-getting-started-edge-step2"></a>

您將需要在邊緣裝置上安裝套件，以便裝置進行推論。您還需要安裝 [AWS IoT Greengrass](https://docs.aws.amazon.com/greengrass/latest/developerguide/what-is-gg.html) 核心或[深度學習執行期 (DLR)](https://github.com/neo-ai/neo-ai-dlr)。在此範例中，您將安裝用於對 `coco_ssd_mobilenet` 物件偵測演算法進行推論所需的套件，並使用 DLR。

1. **安裝其他套件**

   除了 Boto3 之外，您還必須在邊緣裝置上安裝某些程式庫。您安裝的程式庫會依使用案例而定。

   例如，對於您之前下載的 `coco_ssd_mobilenet` 物件偵測演算法，您需要安裝 [NumPy](https://numpy.org/) 以進行資料處理和統計資料、[PIL](https://pillow.readthedocs.io/en/stable/) 來載入影像，以及安裝 [Matplotlib](https://matplotlib.org/) 來產生繪圖。如果您想評估使用 Neo 編譯與基準線的影響，還需要 TensorFlow 副本。

   ```
   !pip3 install numpy pillow tensorflow matplotlib 
   ```

1. **在您的裝置上安裝推論引擎**

   若要執行 Neo 編譯的模型，請在裝置上安裝[深度學習執行期 (DLR)](https://github.com/neo-ai/neo-ai-dlr)。DLR 是適用於深度學習模型和決策樹模型的常見緊湊執行期。在執行 Linux 的 x86\$164 CPU 目標上，您可以使用下列 `pip` 命令來安裝最新版本的 DLR 套件：

   ```
   !pip install dlr
   ```

   如需在 GPU 目標或非 x86 Edge 裝置上安裝 DLR，請參閱預先建置二進位的[版本](https://github.com/neo-ai/neo-ai-dlr/releases)，或參閱[安裝適用於從來源建置 DLR 的 DLR](https://neo-ai-dlr.readthedocs.io/en/latest/install.html)。例如，若要安裝適用於 Raspberry Pi 3 的 DLR，您可以使用：

   ```
   !pip install https://neo-ai-dlr-release.s3-us-west-2.amazonaws.com/v1.3.0/pi-armv7l-raspbian4.14.71-glibc2_24-libstdcpp3_4/dlr-1.3.0-py3-none-any.whl
   ```