A convolution-based neural network for the task of object detection.
To train your model using mixed or TF32 precision with Tensor Cores or using FP32, perform the following steps using the default parameters of the EfficientDet on the COCO 2017 dataset. For the specifics concerning training and inference, refer to the Advanced section.
1. Clone the repository.
git clone https://github.com/NVIDIA/DeepLearningExamples.git
cd DeepLearningExamples/PyTorch/Detection/EfficientDet
2. Download and preprocess the dataset.
This repository provides scripts to download and extract the COCO 2017 dataset. Data will be downloaded to the current working directory on the host and extracted to a user-defined directory
To download, verify, and extract the COCO dataset, use the following scripts:
./download_dataset.sh <data/dir>
By default, the data is organized into the following structure:
<data/dir>
annotations/
instances_train2017.json
instances_val2017.json
train2017/
COCO_train2017_*.jpg
val2017/
COCO_val2017_*.jpg
3. Build the EfficientDet PyTorch NGC container.
bash scripts/docker/build.sh
4. Start an interactive session in the NGC container to run training/inference.
After you build the container image, you can start an interactive CLI session with
bash scripts/docker/launch.sh
The launch.sh script requires that the location on the dataset is specified in the script.
5. Start training.
bash ./scripts/D0/train_{AMP, FP32, TF32}_8x{V100-32G, A100-80G}.sh
The training scripts train an EfficientDet-D0 model and performs evaluation on the COCO 2017 dataset. By default, the training script run training on standard configuration (DGX A100/DGX-1 V100, AMP/FP32/TF32, 300 epochs). Run one of the scripts in ./scripts/D0 directory using bash ./scripts/D0/train_{AMP, FP32, TF32}_8x{V100-32G, A100-80G}.sh. Ensure COCO-2017 is mounted in /workspace/object_detection/datasets/coco and EfficientNet-B0 backbone weights are mounted in /backbone_checkpoints. The backbone checkpoint can be downloaded from this location.
6. Start validation/evaluation.
To run validation/evaluation for a standard configuration (DGX A100/DGX-1 V100, AMP/TF32/FP32, EfficientDet-D0),
run one of the scripts in the ./scripts/D0 directory using bash ./scripts/D0/validation_{AMP, FP32, TF32}_8x{A100-80G, V100-16G, V100-32G}.sh.
Ensure COCO-2017 is mounted in /workspace/object_detection/datasets/coco.
(Optional) Mount the checkpoint in the /checkpoints location to evaluate on a checkpoint and in the script add the path to the checkpoint as --checkpoint /checkpoints/<NAME OF CHECKPOINT>.
7. Start inference/predictions.
Model predictions can be obtained on a test dataset and a model checkpoint by running the scripts/D0/inference_{AMP, FP32, TF32}_{A100-80G, V100-32G}.sh script. The script requires:
- the location of the checkpoint folder and dataset to be specified and present within/mounted to the container.
- number of GPUs to run inference on.
For example:
NUM_PROC=<number_of_processes> CKPT_PATH=<checkpoint_path> BATCH_SIZE=<batch_size> bash scripts/inference_{AMP, FP32, TF32}_{A100-80G, V100-32G}.sh
Model prediction files get saved in the --results path if provided; otherwise, they will be saved in the current working directory.
To perform just inference and skip computation of mAP scores, use the --inference flag.