Skip to content

Latest commit

 

History

History
103 lines (88 loc) · 4.44 KB

File metadata and controls

103 lines (88 loc) · 4.44 KB

3D-UNet Inference

3D-UNet Inference best known configurations with Intel® Extension for PyTorch.

Model Information

Use Case Framework Model Repo Branch/Commit/Tag Optional Patch
Inference Pytorch https://github.com/mlcommons/inference/tree/master/vision/medical_imaging/3d-unet-brats19 - -

Pre-Requisite

Prepare Dataset

  • Please download BraTS 2019 separately and unzip the dataset.

Prepare data file

Inference

  1. git clone https://github.com/IntelAI/models.git
  2. cd models/models_v2/pytorch/3d_unet/inference/gpu
  3. Create virtual environment venv and activate it:
    python3 -m venv venv
    . ./venv/bin/activate
    
  4. Run setup.sh
    ./setup.sh
    
  5. Install the latest GPU versions of torch, torchvision and intel_extension_for_pytorch:
    python -m pip install torch==<torch_version> torchvision==<torchvision_version> intel-extension-for-pytorch==<ipex_version> --extra-index-url https://pytorch-extension.intel.com/release-whl-aitools/
    
  6. Set environment variables for Intel® oneAPI Base Toolkit: Default installation location {ONEAPI_ROOT} is /opt/intel/oneapi for root account, ${HOME}/intel/oneapi for other accounts
    source {ONEAPI_ROOT}/compiler/latest/env/vars.sh
    source {ONEAPI_ROOT}/mkl/latest/env/vars.sh
    source {ONEAPI_ROOT}/tbb/latest/env/vars.sh
    source {ONEAPI_ROOT}/mpi/latest/env/vars.sh
    source {ONEAPI_ROOT}/ccl/latest/env/vars.sh
  7. Setup required environment paramaters
Parameter export command
MULTI_TILE export MULTI_TILE=True (True or False)
PLATFORM export PLATFORM=Max (Max)
DATASET_DIR export DATASET_DIR=
PRECISION (optional) export PRECISION=FP16 (FP16, INT8 and FP32 for Max)
OUTPUT_DIR (optional) export OUTPUT_DIR=$PWD
  1. Run run_model.sh

Output

Single-tile output will typically looks like:

3dunet_inf throughput:  12.63259639639566  sample/s
3dunet_inf latency:  0.07916029045979182  s
Done!
Destroying SUT...
Destroying QSL...

Multi-tile output will typically looks like:

3dunet_inf throughput:  12.63259639639566  sample/s
3dunet_inf latency:  0.07916029045979182  s
Done!
Destroying SUT...
Destroying QSL...
3dunet_inf throughput:  12.638104577393317  sample/s
3dunet_inf latency:  0.07912578930457433  s
Done!
Destroying SUT...
Destroying QSL...

Final results of the inference run can be found in results.yaml file.

results:
 - key: throughput
   value: 25.2707
   unit: sample/s
 - key: latency
   value: 0.079143
   unit: s
 - key: accuracy
   value: None
   unit: mean