首頁  >  文章  >  後端開發  >  如何在 Kaggle 筆記本上設定 Nvidia TAO 工具包

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

Patricia Arquette
Patricia Arquette原創
2024-10-17 14:23:00476瀏覽

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中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn