DEV Community

Cover image for How to setup the Nvidia TAO Toolkit on Kaggle Notebook
Karan Bhardwaj
Karan Bhardwaj

Posted on

How to setup the Nvidia TAO Toolkit on Kaggle Notebook

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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.

NGC Catalog website

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

Generate API Key

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
Enter fullscreen mode Exit fullscreen mode
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'
Enter fullscreen mode Exit fullscreen mode
# 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
Enter fullscreen mode Exit fullscreen mode

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

Configuration Success

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

!ngc-cli/ngc registry model list
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

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!🤗🤗

Top comments (0)