Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:NVIDIA DALI ImageNet Synsets

From Leeroopedia


Knowledge Sources
Domains Vision, Training
Last Updated 2026-02-08 16:00 GMT

Overview

Provides a Python dictionary mapping ImageNet class indices (0-999) to their human-readable synset labels.

Description

The synsets.py module defines a single dictionary, imagenet_synsets, that maps integer class indices from 0 to 999 to their corresponding ImageNet class names and synonyms. Each entry maps a numeric key to a comma-separated string of class name variations and Latin/scientific names where applicable. For example, index 0 maps to "tench, Tinca tinca" and index 1 maps to "goldfish, Carassius auratus".

This file is used across multiple DALI documentation examples to convert model prediction indices back to human-readable class labels. The dictionary covers all 1000 ImageNet Large Scale Visual Recognition Challenge (ILSVRC) categories, spanning a wide variety of objects, animals, vehicles, and everyday items.

This identical file exists in three locations within the DALI repository, each serving the specific example notebooks in its parent directory. All three copies are byte-identical and contain exactly 1003 lines (the dictionary declaration plus all 1000 entries).

File Locations

  • docs/examples/image_processing/augmentation_gallery/synsets.py
  • docs/examples/image_processing/synsets.py
  • docs/examples/image_processing/warp/synsets.py

Usage

Use this module whenever you need to translate an integer prediction output from an ImageNet-trained model into a human-readable class label within DALI image processing example notebooks. Import the dictionary and index it with the predicted class index.

Code Reference

Source Location

Signature

imagenet_synsets = {
    0: "tench, Tinca tinca",
    1: "goldfish, Carassius auratus",
    ...
    999: "toilet tissue, toilet paper, bathroom tissue"
}

Import

from synsets import imagenet_synsets

I/O Contract

Inputs

Name Type Required Description
class_index int Yes An integer in the range [0, 999] representing an ImageNet class prediction.

Outputs

Name Type Description
label str Comma-separated string of human-readable class names and synonyms for the given index.

Usage Examples

Looking up a class label

from synsets import imagenet_synsets

# Suppose a model predicts class index 207
predicted_class = 207
label = imagenet_synsets[predicted_class]
print(f"Predicted: {label}")
# Output: "Predicted: golden retriever"

Annotating batch predictions

from synsets import imagenet_synsets
import numpy as np

# Simulated top-5 predictions from a model
top5_indices = [207, 208, 209, 210, 211]
for idx in top5_indices:
    print(f"  Class {idx}: {imagenet_synsets[idx]}")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment