如何在 Kaggle 筆記本上設定 Nvidia TAO 工具包

Patricia Arquette
發布: 2024-10-17 14:23:00
原創
475 人瀏覽過

Introduction

Action recognition plays a crucial role in enabling applications like video surveillance, sports analytics, and gesture recognition. Leveraging pre-trained models with NVIDIA’s TAO Toolkit makes it easier to train high-performance action recognition models efficiently.

TAO Toolkit can be set up using docker or NGC CLI. Since we will be working on the Kaggle Notebook, we will use the NGC CLI, as the Kaggle Notebook environment does not support docker.

Note: Kaggle Notebooks don't support Docker due to security concerns, resource management, and the provision of pre-configured environments for simplified workflows.

Installation Steps:

1. Install dependencies

First, install nvidia-pyindex, a repository manager for NVIDIA’s Python-based tools that simplifies the installation process for the TAO Toolkit and related components.

!pip install nvidia-pyindex
登入後複製

2. Install the Nvidia TAO Toolkit and NGC-CLI

The Nvidia TAO Toolkit contains a collection of pre-trained models for various tasks such as object detection, classification, segmentation and action recognition.

!pip install nvidia-tao
登入後複製

Next, install the NGC-CLI (NVIDIA GPU Cloud Command Line Interface), which interacts with NVIDIA's NGC catalog to manage pre-trained models.

!wget -O ngccli_linux.zip https://ngc.nvidia.com/downloads/ngccli_linux.zip
!unzip ngccli_linux.zip
登入後複製

3. Create an NGC account

Register for an account on the Nvidia NGC catalog to access the TAO toolkit models. Once registered, you can authenticate via the NGC CLI using your API key to download the desired models.

First, go to https://catalog.ngc.nvidia.com/ and sign up for a free account from the right menu.

How to setup the Nvidia TAO Toolkit on Kaggle Notebook

Once signed in, go to the Setup section from the right drop-down menu and click on Generate Personal Key.

How to setup the Nvidia TAO Toolkit on Kaggle Notebook

4. Configure the NGC CLI

Set up your environment to authenticate with NGC using the following commands. Keep your API key secure.

!chmod u+x ngc-cli/ngc
登入後複製
import os

# Declaring the input arguments as environment variables. 
# This way we can directly pass the arguments during cell runtime to any command request in the Kaggle notebook.

os.environ['API_KEY'] = 'your_api_key'
os.environ['TYPE'] = 'ascii'
os.environ['ORG'] = '0514167173176982'
os.environ['TEAM'] = 'no-team'
os.environ['ACE'] = 'no-ace'
登入後複製
# Passing the input arguments to the config command
!echo -e "$API_KEY\n$TYPE\n$ORG\n$TEAM\n$ACE" | ngc-cli/ngc config set
登入後複製

If you see the output below, your setup is complete. Hurray!!??

How to setup the Nvidia TAO Toolkit on Kaggle Notebook

Now that the NGC CLI is configured, you can list the available models:

!ngc-cli/ngc registry model list
登入後複製

If you want to download any specific model, you can do so by running the following command

!ngc-cli/ngc registry model download-version "nvidia/tao/actionrecognitionnet:deployable_onnx_v2.0"
登入後複製

Here I have downloaded the ActionRecognitionNet model. The model will be downloaded in the .onnx format.

By following the steps above, you’ve set up the TAO Toolkit on Kaggle Notebook. Now you can start exploring the world of high-performance computer vision with ease.

Happy Coding!??

以上是如何在 Kaggle 筆記本上設定 Nvidia TAO 工具包的詳細內容。更多資訊請關注PHP中文網其他相關文章!

來源:dev.to
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
作者最新文章
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!