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

ID 679305
Updated 6/15/2022
Version Latest



Pull Command

docker pull intel/image-segmentation:tf-latest-maskrcnn-fp32-inference


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

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


The model container includes the scripts and libraries needed to run Mask R-CNN FP32 inference. To run one of the quick start scripts using this container, you'll need to provide volume mounts for the dataset and an output directory.

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

docker run \
  --env http_proxy=${http_proxy} \
  --env https_proxy=${https_proxy} \
  --volume ${DATASET_DIR}:${DATASET_DIR} \
  --volume ${OUTPUT_DIR}:${OUTPUT_DIR} \
  --volume ${MODEL_SRC_DIR}:${MODEL_SRC_DIR} \
  --privileged --init -t \
  intel/image-segmentation:tf-latest-maskrcnn-fp32-inference \
  /bin/bash quickstart/fp32_inference.sh

Documentation and Sources

Get Started​
Docker* Repository
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.

View All Containers and Solutions 🡢