NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
EfficientNet V1 For Tensorflow2
Resource
NVIDIA Deep Learning Examples
NVIDIA Deep Learning Examples
EfficientNet V1 For Tensorflow2

EfficientNets are a family of image classification models, which achieve state-of-the-art accuracy, being an order-of-magnitude smaller and faster.

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 EfficientNet model on the ImageNet 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/TensorFlow2/Classification/ConvNets/efficientnet
    
  2. Download and prepare the dataset. Runner.py supports ImageNet with TensorFlow Datasets (TFDS). Refer to the TFDS ImageNet readme for manual download instructions.

  3. Build EfficientNet on top of the NGC container. bash ./scripts/docker/build.sh YOUR_DESIRED_CONTAINER_NAME

  4. Start an interactive session in the NGC container to run training/inference. Ensure that launch.sh has the correct path to ImageNet on your machine and that this path is mounted onto the /data directory because this is where training and evaluation scripts search for data.

        `bash ./scripts/docker/launch.sh YOUR_DESIRED_CONTAINER_NAME`
    
  5. Start training.

    To run training for a standard configuration, under the container default entry point /workspace, run one of the scripts in the ./efficinetnet_v1/{B0,B4}/training/{AMP,TF32,FP32}/convergence_8x{A100-80G, V100-32G}.sh. For example:

    bash ./efficinetnet_v1/B0/training/AMP/convergence_8xA100-80G.sh

  6. Start validation/evaluation.

    To run validation/evaluation for a standard configuration, under the container default entry point /workspace, run one of the scripts in the ./efficinetnet_v1/{B0,B4}/evaluation/evaluation_{AMP,FP32,TF32}_8x{A100-80G, V100-32G}.sh. The evaluation script is configured to use the checkpoint specified in checkpoint for evaluation. The specified checkpoint will be read from the location passed by `--model_dir'.For example:

    bash ./efficinetnet_v1/B0/evaluation/evaluation_AMP_A100-80G.sh

  7. Start inference/predictions.

    To run inference for a standard configuration, under the container default entry point /workspace, run one of the scripts in the ./efficinetnet_v1/{B0,B4}/inference/inference_{AMP,FP32,TF32}.sh. Ensure your JPEG images used to run inference on are mounted in the /infer_data directory with this folder structure :

    infer_data
    |   |-- images
    |   |   |-- image1.JPEG
    |   |   |-- image2.JPEG
    

    For example: bash ./efficinetnet_v1/B0/inference/inference_AMP.sh

Now that you have your model trained and evaluated, you can choose to compare your training results with our Training accuracy results. You can also choose to benchmark your performance to Training performance benchmark or Inference performance benchmark. Following the steps in these sections will ensure that you achieve the same accuracy and performance results as stated in the Results section.