Skip to content

Latest commit

 

History

History
106 lines (89 loc) · 4.86 KB

File metadata and controls

106 lines (89 loc) · 4.86 KB

ResNet50 v1.5 FP32 inference

This document has instructions for running ResNet50 v1.5 FP32 inference using Intel-optimized TensorFlow.

Datasets

Download and preprocess the ImageNet dataset using the instructions here. After running the conversion script you should have a directory with the ImageNet dataset in the TF records format.

Set the DATASET_DIR to point to the TF records directory when running ResNet50 v1.5.

Quick Start Scripts

Script name Description
fp32_online_inference.sh Runs online inference (batch_size=1).
fp32_batch_inference.sh Runs batch inference (batch_size=128).
fp32_accuracy.sh Measures the model accuracy (batch_size=100).
multi_instance_batch_inference.sh Uses numactl to run batch inference (batch_size=128) with one instance per socket for 1500 steps and 50 warmup steps. If no DATASET_DIR is set, synthetic data is used. Waits for all instances to complete, then prints a summarized throughput value.
multi_instance_online_inference.sh Uses numactl to run online inference (batch_size=1) using four cores per instance for 1500 steps and 50 warmup steps. If no DATASET_DIR is set, synthetic data is used. Waits for all instances to complete, then prints a summarized throughput value.

Run the model

Setup your environment using the instructions below, depending on if you are using AI Kit:

Setup using AI Kit Setup without AI Kit

To run using AI Kit you will need:

  • numactl
  • wget
  • openmpi-bin (only required for multi-instance)
  • openmpi-common (only required for multi-instance)
  • openssh-client (only required for multi-instance)
  • openssh-server (only required for multi-instance)
  • libopenmpi-dev (only required for multi-instance)
  • horovod==0.21.0 (only required for multi-instance)
  • Activate the tensorflow conda environment
    conda activate tensorflow

To run without AI Kit you will need:

  • Python 3
  • [intel-tensorflow>=2.5.0](https://pypi.org/project/intel-tensorflow/)
  • git
  • numactl
  • wget
  • openmpi-bin (only required for multi-instance)
  • openmpi-common (only required for multi-instance)
  • openssh-client (only required for multi-instance)
  • openssh-server (only required for multi-instance)
  • libopenmpi-dev (only required for multi-instance)
  • horovod==0.21.0 (only required for multi-instance)
  • A clone of the Model Zoo repo
    git clone https://github.com/IntelAI/models.git

After finishing the setup above, download the pretrained model and set the PRETRAINED_MODEL environment var to the path to the frozen graph:

wget https://zenodo.org/record/2535873/files/resnet50_v1.pb
export PRETRAINED_MODEL=$(pwd)/resnet50_v1.pb

Set environment variables for the path to your DATASET_DIR for ImageNet and an OUTPUT_DIR where log files will be written. Navigate to your model zoo directory and then run a quickstart script.

# cd to your model zoo directory
cd models

export PRETRAINED_MODEL=<path to the frozen graph downloaded above>
export DATASET_DIR=<path to the ImageNet TF records>
export OUTPUT_DIR=<directory where log files and checkpoints will be written>

./quickstart/image_recognition/tensorflow/resnet50v1_5/inference/cpu/fp32/<script name>.sh

Additional Resources