I want to know where these imagenet_class_index.json files originate from, and how to generate them.  I find it frustrating that the ONNX model zoo does not publish these artifacts, and I find little documentation on how to create them myself from scratch.
I need to know how to generate them, because I wish to model serve, and I see currently 2 options/choices for this purpose. It appears in the first example it states it needs the index_to_name.json file and in the second the model definition file.  However, in the case of the second, it also requires a signature.json file input as well. This is all to convert an ONNX model from the model zoo to .MAR format for the model server.

PTH to MAR format using TorchServe

Pre-requisites to create a torch model archive (.mar) :
serialized-file (.pt) : This file represents the state_dict in case of eager mode model.
model-file (.py) : This file contains model class extended from torch nn.modules representing the model architecture. This parameter is mandatory for eager mode models. This file must contain only one class definition extended from torch.nn.modules
index_to_name.json : This file contains the mapping of predicted index to class. The default TorchServe handles returns the predicted index and probability. This file can be passed to model archiver using —extra-files parameter.
version : Model’s version.
handler : TorchServe default handler’s name or path to custom inference handler(.py)
PTH to MAR format (TorchServe)

  
      github.com
  
  
    pytorch/serve/blob/master/examples/README.md 6
# Contents of this Document
* [Creating mar file for an eager mode model](#creating-mar-file-for-eager-mode-model)
* [Creating mar file for torchscript mode model](#creating-mar-file-for-torchscript-mode-model)
* [Serving torchvision image classification models in TorchServe](#examples-torchvision-image-classification-models-in-torchserve)
* [Serving custom model with custom service handler](#example-to-serve-a-custom-model-with-custom-service-handler)
* [Serving text classification model](#example-to-serve-text-classification-model)
* [Serving object detection model](#example-to-serve-object-detection-model)
* [Serving image segmentation model](#example-to-serve-image-segmentation-model)

# TorchServe Examples

The following are examples on how to create and serve model archives with TorchServe.

## Creating mar file for eager mode model

Following are the steps to create a torch-model-archive (.mar) to execute an eager mode torch model in TorchServe :

* Pre-requisites to create a torch model archive (.mar) :
    * serialized-file (.pt) : This file represents the state_dict in case of eager mode model.
    * model-file (.py) : This file contains model class extended from torch nn.modules representing the model architecture. This parameter is mandatory for eager mode models. This file must contain only one class definition extended from torch.nn.modules


  This file has been truncated. show original

  
  
    
    
  
  


2.) ONNX to MAR using Multi-model-server
The downloaded model artifact files are:
Model Definition (json file) - contains the layers and overall structure of the neural network.
Model Params and Weights (params file) - contains the parameters and the weights.
Model Signature (json file) - defines the inputs and outputs that MMS is expecting to hand-off to the API.
assets (text files) - auxiliary files that support model inference such as vocabularies, labels, etc. These vary depending on the model.
ONNX to MAR format (Multi-Model-Server)

  
      github.com
  
  
    awslabs/multi-model-server/blob/master/model-archiver/docs/convert_from_onnx.md 3
# Converting an ONNX Model

## Install model-archiver with ONNX support
ONNX support is optional in `model-archiver` tool. It's not installed by default with `model-archiver`.

To install MMS with ONNX support, you will need to have the [protobuf compiler](https://github.com/onnx/onnx#installation) installed:

for Ubuntu run:

```bash
sudo apt-get install protobuf-compiler libprotoc-dev

pip install model-archiver[onnx]
```

Or for Mac run:

```bash
conda install -c conda-forge protobuf numpy



  This file has been truncated. show original