ONNX Model Zoo

repository·main·Indexed 27 days ago

https://github.com/onnx/models

A curated collection of pre-trained, state-of-the-art machine learning models in the ONNX format. The zoo includes validated models for Computer Vision (Image Classification, Object Detection, Segmentation), Natural Language Processing (Machine Comprehension, Translation), Generative AI, Graph Machine Learning, and Speech/Audio processing. It provides guidance on model validation using TensorProtos and Numpy archives, as well as quantization using Intel® Neural Compressor.

Tokens
52.2K
Snippets
139
Records
248
Agent score
94%

What's inside ONNX Model Zoo

  1. Overview of ShuffleNet Models

    main

    ShuffleNet is a computationally efficient CNN architecture designed for mobile devices with limited computing power. It is used for image classification. The repository provides several versions:

    • ShuffleNet-v1: Available in multiple ONNX versions (1.1 to 1.4) and Opset versions (3 to 9).
    • ShuffleNet-v2: Includes standard FP32, quantized INT8, and QDQ versions.

    Quantized INT8 models offer significant performance improvements (e.g., ~1.62x) with minimal impact on accuracy (Top-1 error increase of ~0.59%).

  2. Overview of ArcFace for Face Recognition

    main
    ArcFace is a CNN-based model designed for face recognition and verification. It produces a fixed-length embedding vector for each face image. Vectors from images of the same person have higher similarity than those from different people, making it suitable for facial feature-based clustering and identity verification.
  3. Overview of ONNX Model Zoo

    main

    The ONNX Model Zoo is a curated collection of pre-trained, state-of-the-art models in the ONNX format. These models are exported from prominent open-source repositories (such as timm, torchvision, torch_hub, and transformers) using the TurnkeyML toolchain.

    Models are categorized into:

    • Computer Vision
    • Natural Language Processing (NLP)
    • Generative AI
    • Graph Machine Learning
  4. YOLOv4 Model Overview and Download

    main

    YOLOv4 is an object detection model optimized for speed and accuracy. It is designed to be faster than EfficientDet and improves upon YOLOv3 in both AP and FPS.

    Model Details:

    • ONNX version: 1.6
    • Opset version: 11
    • Accuracy: mAP of 0.5733 (on COCO 2017)
    • Source: Converted from Tensorflow YOLOv4 to ONNX YOLOv4.

    Downloads:

  5. Use Fully Convolutional Network (FCN) for Image Segmentation

    main
    FCNs are real-time neural networks for class-wise image segmentation. This specific implementation detects 20 different classes (plus background) and is pre-trained on the COCO train2017 dataset. The model is flexible in resolution because every weight layer is convolutional, allowing for dense pixel-wise predictions without significant postprocessing.
  6. Use the MNIST Handwritten Digit Recognition model

    main

    The MNIST model predicts handwritten digits using a convolutional neural network (CNN). It is trained on the MNIST dataset and supports several versions with different ONNX and Opset versions.

    Available Model Versions

    ModelONNX VersionOpset VersionTOP-1 Error
    MNIST1.011.1%
    MNIST1.271.1%
    MNIST1.381.1%
    MNIST-121.9121.1%
    MNIST-12-int81.9121.1%
  7. Download Tiny YOLOv2 ONNX models

    main

    Tiny YOLOv2 is available in two ONNX versions. Choose the version based on your required ONNX and Opset compatibility:

    • ONNX 1.2 (Opset 7): Use tinyyolov2-7.onnx.
    • ONNX 1.3 (Opset 8): Use tinyyolov2-8.onnx.

    Downloads for models with sample test data are available as .tar.gz archives.

    |Model|Download|Download (with sample test data)| ONNX version |Opset version|
    |-----|:-------|:-------------------------------|:-------------|:------------|
    |Tiny YOLOv2|[62 MB](model/tinyyolov2-7.onnx)|[59 MB](model/tinyyolov2-7.tar.gz) |1.2  |7 |
    |Tiny YOLOv2|[62 MB](model/tinyyolov2-8.onnx)|[59 MB](model/tinyyolov2-8.tar.gz) |1.3  |8 |
  8. Preprocess images for SSD inference

    main

    To use the SSD model, input images must be preprocessed as follows:

    1. Load image and resize to (1200, 1200) using bilinear interpolation.
    2. Convert to NCHW format with shape (1, 3, 1200, 1200).
    3. Scale pixel values to the range [0, 1].
    4. Normalize using mean = [0.485, 0.456, 0.406] and std = [0.229, 0.224, 0.225].

    Note: The transformation should preferably happen during the preprocessing stage.

    import numpy as np
    from PIL import Image
    
    def preprocess(img_path):
        input_shape = (1, 3, 1200, 1200)
        img = Image.open(img_path)
        img = img.resize((1200, 1200), Image.BILINEAR)
        img_data = np.array(img)
        img_data = np.transpose(img_data, [2, 0, 1])
        img_data = np.expand_dims(img_data, 0)
        mean_vec = np.array([0.485, 0.456, 0.406])
        stddev_vec = np.array([0.229, 0.224, 0.225])
        norm_img_data = np.zeros(img_data.shape).astype('float32')
        for i in range(img_data.shape[1]):
            norm_img_data[:,i,:,:] = (img_data[:,i,:,:]/255 - mean_vec[i]) / stddev_vec[i]
        return norm_img_data