Optimize a Mask R-CNN FP32 Inference Model with TensorFlow*

Published: 10/23/2020  

Last Updated: 06/15/2022

Download Command

wget https://storage.googleapis.com/intel-optimized-tensorflow/models/v2_3_0/maskrcnn-fp32-inference.tar.gz


This document has instructions for running Mask R-CNN FP32 inference using Intel® Optimization for TensorFlow*.

Datasets and a Pretrained Model

Download the MS COCO 2014 dataset. Set the DATASET_DIR to point to this directory when running Mask R-CNN.

# Create a new directory, to be set as DATASET_DIR

# Download and extract MS COCO 2014 dataset
wget http://images.cocodataset.org/zips/val2014.zip
unzip val2014.zip

wget http://images.cocodataset.org/annotations/annotations_trainval2014.zip
unzip annotations_trainval2014.zip
cp annotations/instances_val2014.json annotations/instances_minival2014.json


Running Mask R-CNN also requires a clone and particular SHA of the Mask R-CNN model repository. Set the MODEL_SRC_DIR env var to the path of your clone.

git clone https://github.com/matterport/Mask_RCNN.git
cd Mask_RCNN
git checkout 3deaec5d902d16e1daf56b62d5971d428dc920bc
export MODEL_SRC_DIR=$(pwd)

Download pre-trained COCO weights mask_rcnn_coco.h5 from the Mask R-CNN repository release page, and place it in the MaskRCNN directory.

wget -q https://github.com/matterport/Mask_RCNN/releases/download/v2.0/mask_rcnn_coco.h5
cd ..

Quick Start Scripts

Script name Description
fp32_inference Runs inference with batch size 1 using Coco dataset and pretrained model

Bare Metal

To run on bare metal, the following prerequisites must be installed in your environment:

  • Python* 3.6 or 3.7
  • Intel Optimization for TensorFlow 1.15.2
  • Numactl
  • Git
  • Wget
  • Pycocotools
  • NumPy 1.16.3
  • SciPy 1.2.0
  • Pillow 8.1.2
  • Cython
  • Matplotlib
  • Scikit-image
  • Keras* 2.0.8
  • OpenCV-Python
  • H5py 2.10.0
  • Imgaug
  • iPython* (all)

After installing the prerequisites, download and untar the model package. Set environment variables for the path to your DATASET_DIRMODEL_SRC_DIR and an OUTPUT_DIR where log files will be written, then run a quick start script.

export DATASET_DIR=<path to the dataset>
export OUTPUT_DIR=<directory where log files will be written>
export MODEL_SRC_DIR=<path to the Mask RCNN models repo>

wget https://storage.googleapis.com/intel-optimized-tensorflow/models/v2_3_0/maskrcnn-fp32-inference.tar.gz
tar -xzf maskrcnn-fp32-inference.tar.gz
cd maskrcnn-fp32-inference


Documentation and Sources

Get Started​
Main GitHub*
Release Notes
Get Started Guide

Code Sources
Report Issue

License Agreement

LEGAL NOTICE: By accessing, downloading or using this software and any required dependent software (the “Software Package”), you agree to the terms and conditions of the software license agreements for the Software Package, which may also include notices, disclaimers, or license terms for third party software included with the Software Package. Please refer to the license file for additional details.

Related Containers and Solutions

Mask R-CNN FP32 Inference TensorFlow* Container

View All Containers and Solutions 🡢

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.