This document has instructions for running MaskRCNN training using Intel Extension for PyTorch.
Docker image based on CentOS Stream8
docker pull intel/object-detection:centos-pytorch-cpu-maskrcnn-training
Docker image based on Ubuntu 22.04
docker pull intel/object-detection:ubuntu-pytorch-cpu-maskrcnn-training
Script name | Description |
---|---|
training.sh |
Runs training for the specified precision (fp32, avx-fp32,bf16, or bf32). |
Note: The avx-fp32
precision runs the same scripts as fp32
, except that the DNNL_MAX_CPU_ISA
environment variable is unset. The environment variable is otherwise set to DNNL_MAX_CPU_ISA=AVX512_CORE_AMX
.
Download and extract the 2017 training/validation images and annotations from the COCO dataset website to a coco
folder and unzip the files. After extracting the zip files, your dataset directory structure should look something like this:
coco
├── annotations
│ ├── captions_train2017.json
│ ├── captions_val2017.json
│ ├── instances_train2017.json
│ ├── instances_val2017.json
│ ├── person_keypoints_train2017.json
│ └── person_keypoints_val2017.json
├── train2017
│ ├── 000000454854.jpg
│ ├── 000000137045.jpg
│ ├── 000000129582.jpg
│ └── ...
└── val2017
├── 000000000139.jpg
├── 000000000285.jpg
├── 000000000632.jpg
└── ...
(Optional) Export related proxy into docker environment.
export DOCKER_RUN_ENVS="-e ftp_proxy=${ftp_proxy} \
-e FTP_PROXY=${FTP_PROXY} -e http_proxy=${http_proxy} \
-e HTTP_PROXY=${HTTP_PROXY} -e https_proxy=${https_proxy} \
-e HTTPS_PROXY=${HTTPS_PROXY} -e no_proxy=${no_proxy} \
-e NO_PROXY=${NO_PROXY} -e socks_proxy=${socks_proxy} \
-e SOCKS_PROXY=${SOCKS_PROXY}"
To run MaskRCNN training, set environment variables to specify the dataset directory, precision to run, and an output directory.
# Set the required environment vars
export OS=<provide either centos or ubuntu>
export DATASET_DIR=<path to the dataset>
export OUTPUT_DIR=<directory where log files will be written>
export PRECISION=<specify the precision to run>
export SCRIPT=quickstart/training.sh
export BATCH_SIZE=<set batch size(default is 112)>
DOCKER_ARGS="--privileged --init -it"
WORKDIR=/workspace/pytorch-maskrcnn-training
IMAGE_NAME=intel/object-detection:${OS}-pytorch-cpu-maskrcnn-training
docker run --rm \
--env BATCH_SIZE=${BATCH_SIZE} \
--env OUTPUT_DIR=${OUTPUT_DIR} \
--env DATASET_DIR=${DATASET_DIR} \
--env http_proxy=${http_proxy} \
--env https_proxy=${https_proxy} \
--env no_proxy=${no_proxy} \
--volume ${DATASET_DIR}:${DATASET_DIR} \
--volume ${OUTPUT_DIR}:${OUTPUT_DIR} \
${DOCKER_RUN_ENVS} \
--shm-size 8G \
-w ${WORKDIR} \
${DOCKER_ARGS} \
$IMAGE_NAME \
/bin/bash $SCRIPT $PRECISION
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.