Skip to content

Repository files navigation

Open Neural Network eXchange (ONNX) Model Zoo

Generic badge

The ONNX Model Zoo is a collection of pre-trained models for state-of-the-art models in deep learning, available in the ONNX format. Accompanying each model are Jupyter notebooks for model training and running inference with the trained model. The notebooks are written in Python and include links to the training dataset as well as references to the original paper that describes the model architecture. The notebooks can also be exported and run as Python (.py) files.

What is ONNX?

The Open Neural Network eXchange (ONNX) is an open format to represent deep learning models. With ONNX, developers can move models between state-of-the-art tools and choose the combination that is best for them. ONNX is developed and supported by a community of partners.

Models

Read the Usage section below for more details on the file formats in the ONNX Model Zoo (.onnx, .pb, .npz) and starter Python code for validating your ONNX model using test data.

Image Classification

This collection of models take images as input, then classifies the major objects in the images into a set of predefined classes.

Model ClassReferenceDescription
MobileNetSandler et al.Computationally efficient CNN model for mobile and embedded vision applications.
Top-5 error from paper - ~10%
ResNetHe et al., He et al.Very deep state-of-the-art CNN model (up to 152 layers), won the ImageNet Challenge in 2015.
Top-5 error from paper - ~3.6%
SqueezeNetIandola et al.A light-weight CNN providing Alexnet level accuracy with 50X fewer parameters.
Top-5 error from paper - ~20%
VGGSimonyan et al.Deep CNN model (up to 19 layers) which won the ImageNet Challenge in 2014.
Top-5 error from paper - ~8%
Bvlc_AlexNetKrizhevsky et al.Deep CNN model for Image Classification (up to 8 layers), won the ImageNet Challenge in 2012.
Top-5 error from paper - ~15%
Bvlc_GoogleNetSzegedy et al.Deep CNN model (up to 22 layers) implemented in Caffe and won at the ImageNet Challenge in 2014.
Top-5 error from paper - ~6.7%
Bvlc_reference_CaffeNetKrizhevsky et al.Deep CNN variation of AlexNet for Image Classification in Caffe where the max pooling precedes the local response normalization (LRN) so that the LRN takes less compute and memory.
Bvlc_reference_RCNN_ILSVRC13Girshick et al.Pure Caffe implementation of R-CNN for image classification as presented at CVPR in 2014.
DenseNet121Huang et al.Deep CNN model for Image Classification, connecting every layer to every other layer.
Inception_v1Szegedy et al.Deep CNN model (up to 22 layers) for Image Classification - same as GoogLeNet, implemented through Caffe2.
Top-5 error from paper - ~6.7%
Inception_v2Szegedy et al.Deep CNN model for Image Classification as an adaptation to Inception v1 with batch normalization
Top-5 error from paper ~4.82%
ShuffleNetZhang et al.Computationally efficient deep CNN model for Image Classification, providing a ~13x speedup over AlexNet on ARM-based mobile devices
Top-1 error from paper - ~7.8%
ZFNet512Zeiler et al.Deep CNN model (up to 8 layers) for Image Classification that tuned the hyperparameters of AlexNet and won the ImageNet Challenge in 2013.
Top-5 error from paper - ~14.3%

Domain-based Image Classification

This subset of models classify images for specific domains and datasets.

Model ClassReferenceDescription
MNIST- Handwritten Digit RecognitionConvolutional Neural Network with MNISTDeep CNN model for handwritten digit identification

Object Detection & Image Segmentation

Object detection models detect the presence of multiple objects in an image and segment out areas of the image where the objects are detected. Semantic segmentation models partition an input image by labeling each pixel into a set of pre-defined categories.

Model ClassReferenceDescription
Tiny_YOLOv2Redmon et al.Deep CNN model for Object Detection
SSDLiu et al.Deep CNN model for Object Detection
Faster-RCNNRen et al.contribute
Mask-RCNNHe et al.contribute
YOLO v2Redmon et al.contribute
YOLO v3Redmon et al.Deep CNN model for Real-Time Object Detection (mAP = 55.3% in COCO)
DUCWang et al.Deep CNN based semantic segmentation model with >80% mIOU (mean Intersection Over Union), trained on urban street images
FCNLong et al.contribute

Body, Face & Gesture Analysis

Face detection models identify and/or recognize human faces in images. Some more popular models are used for detection of celebrity faces, gender, age, and emotions.

Model ClassReferenceDescription
ArcFaceDeng et al.ArcFace is a CNN based model for face recognition which learns discriminative features of faces and produces embeddings for input face images.
CNN CascadeLi et al.contribute
Emotion FerPlusBarsoum et al.Deep CNN for emotion recognition trained on images of faces.
Age and Gender Classification using Convolutional Neural NetworksLevi et al.contribute

Image Manipulation

Image manipulation models use neural networks to transform input images to modified output images. Some popular models in this category involve style transfer or enhancing images by increasing resolution.

Model ClassReferenceDescription
Unpaired Image to Image Translation using Cycle consistent Adversarial NetworkZhu et al.contribute
Image Super resolution using deep convolutional networksDong et al.contribute

Speech & Audio Processing

This class of models uses audio data to train models that can identify voice, generate music, or even read text out loud.

Model ClassReferenceDescription
Speech recognition with deep recurrent neural networksGraves et al.contribute
Deep voice: Real time neural text to speechArik et al.contribute
Sound Generative modelsWaveNet: A Generative Model for Raw Audio contribute

Machine Translation

This class of natural language processing models learns how to translate input text to another language.

Model ClassReferenceDescription
Neural Machine Translation by jointly learning to align and translateBahdanau et al.contribute
Google's Neural Machine Translation SystemWu et al.contribute

Language Modelling

This subset of natural language processing models learns representations of language from large corpuses of text.

Model ClassReferenceDescription
Deep Neural Network Language ModelsArisoy et al.contribute

Visual Question Answering & Dialog

This subset of natural language processing models uses input images to answer questions about those images.

Model ClassReferenceDescription
VQA: Visual Question AnsweringAgrawal et al.contribute
Yin and Yang: Balancing and Answering Binary Visual QuestionsZhang et al.contribute
Making the V in VQA MatterGoyal et al.contribute
Visual DialogDas et al.contribute

Other interesting models

There are many interesting deep learning models that do not fit into the categories described above. The ONNX team would like to highly encourage users and researchers to contribute their models to the growing model zoo.

Model ClassReferenceDescription
Text to ImageGenerative Adversarial Text to image Synthesis contribute
Time Series ForecastingModeling Long- and Short-Term Temporal Patterns with Deep Neural Networks contribute
Recommender systemsDropoutNet: Addressing Cold Start in Recommender Systemscontribute
Collaborative filteringNeural Collaborative Filteringcontribute
AutoencodersA Hierarchical Neural Autoencoder for Paragraphs and Documentscontribute

Usage

Every ONNX backend should support running the models out of the box. After downloading and extracting the tarball of each model, you will find:

  • A protobuf file model.onnx that represents the serialized ONNX model.
  • Test data (in the form of serialized protobuf TensorProto files or serialized NumPy archives).

The test data files can be used to validate ONNX models from the Model Zoo. We have provided the following interface examples for you to get started. Please replace onnx_backend in your code with the appropriate framework of your choice that provides ONNX inferencing support, and likewise replace backend.run_model with the framework's model evaluation logic.

There are two different formats for the test data files:

  • Serialized protobuf TensorProtos (.pb), stored in folders with the naming convention test_data_set_*.
importnumpyasnpimportonnximportosimportglobimportonnx_backendasbackendfromonnximportnumpy_helpermodel=onnx.load('model.onnx')
test_data_dir='test_data_set_0'# Load inputsinputs= []
inputs_num=len(glob.glob(os.path.join(test_data_dir, 'input_*.pb')))
foriinrange(inputs_num):
input_file=os.path.join(test_data_dir, 'input_{}.pb'.format(i))
tensor=onnx.TensorProto()
withopen(input_file, 'rb') asf:
tensor.ParseFromString(f.read())
inputs.append(numpy_helper.to_array(tensor))
# Load reference outputsref_outputs= []
ref_outputs_num=len(glob.glob(os.path.join(test_data_dir, 'output_*.pb')))
foriinrange(ref_outputs_num):
output_file=os.path.join(test_data_dir, 'output_{}.pb'.format(i))
tensor=onnx.TensorProto()
withopen(output_file, 'rb') asf:
tensor.ParseFromString(f.read())
ref_outputs.append(numpy_helper.to_array(tensor))
# Run the model on the backendoutputs=list(backend.run_model(model, inputs))
# Compare the results with reference outputs.forref_o, oinzip(ref_outputs, outputs):
np.testing.assert_almost_equal(ref_o, o)
  • Serialized Numpy archives, stored in files with the naming convention test_data_*.npz. Each file contains one set of test inputs and outputs.
importnumpyasnpimportonnximportonnx_backendasbackend# Load the model and sample inputs and outputsmodel=onnx.load(model_pb_path)
sample=np.load(npz_path, encoding='bytes')
inputs=list(sample['inputs'])
outputs=list(sample['outputs'])
# Run the model with an onnx backend and verify the resultsnp.testing.assert_almost_equal(outputs, backend.run_model(model, inputs))

Model Visualization

You can see visualizations of each model's network architecture by using Netron.

Contributions

Do you want to contribute a model? To get started, pick any model presented above with the contribute link under the Description column. The links point to a page containing guidelines for making a contribution.

License

MIT License

About

A collection of pre-trained, state-of-the-art models in the ONNX format

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages