MobileNetV2 deployment workflow

You will use the same initial workflow pattern as Module 1:

  1. Prepare the model, labels, image, and preprocessing settings.
  2. Export MobileNetV2 from PyTorch.
  3. Lower the FP32 model to ExecuTorch with XNNPACK.
  4. Inspect the delegation summary.
  5. Copy the artifacts to the Raspberry Pi.
  6. Benchmark PyTorch eager and FP32 ExecuTorch with XNNPACK.

You will then add quantization:

  1. Calibrate and quantize the exported model to INT8.
  2. Lower the quantized model and delegate to XNNPACK
  3. Benchmark INT8 ExecuTorch with XNNPACK.
  4. Compare artifact size, latency, delegation, and top-5 output.
  5. Run the image-classifier demo.

As you work, pay attention to the engineering trade-offs: latency, .pte artifact size, quantization accuracy shift, application behavior, and production validation still needed.

By the end of the workflow, you should have three benchmark results, two .pte artifact sizes, one delegation comparison, INT8 top-5 output, and at least one application-demo observation.

Note

If you have not set up your development machine, follow the Module 1 development machine setup through creating and activating .cpu_aot_venv, then return here.

If you have not done so already, clone the repository and enter the directory:

    

        
        
git clone https://github.com/ArmDeveloperEcosystem/arm-courses-code-executorch.git ~/executorch_on_arm
cd ~/executorch_on_arm

    

Script layout

Module 2 follows the script workflow used in Module 1:

    

        
        
aot                        prepare/export/quantize/lower models on the development machine
pi/                        compare PyTorch and ExecuTorch on the Raspberry Pi
pi/core                    load `.pte` artifacts and turn model outputs into app behavior
_support                   shared setup, plotting, result writing, and HTML rendering

    

You will prepare and lower the model on the development machine, copy the deployable .pte files to the Raspberry Pi, and measure them on the target. The model family changes from transformers to CNNs, and this module introduces the new quantization step, but the split between ahead-of-time preparation and target-side execution remains the same.

Development and target environments

EnvironmentResponsibilityMain outputs
Development machinePrepare MobileNetV2, export, lower, calibrate, quantize.pte artifacts, metadata, calibration images
Raspberry PiBenchmark PyTorch, FP32 XNNPACK, INT8 XNNPACK, run demoJSON/CSV results, plots, top-5 output, app observations
Previous page Complete and continue