Skip to content

Pre-Processing Script

This step is intended for adding a pre-processing script designed to transform uploaded files with the model’s input shape requirements, ensuring input compatibility. The pre-processing script step is mandatory when using the Bring Your Own Model (BYOM) feature.

Important

If using a model from ADI's Model Zoo, this step will not appear in the build setup process.

To learn how to create custom data processing scripts, see the Data Processing page.

Script editor environment

The script editor operates within a Jupyter-like Python environment, and these three imports are mandatory for postprocessing script files:

  • argparse
  • numpy
  • pathlib

These are the only supported libraries in the runtime environment:

  • torch (2.1.2+cpu)
  • torchvision (0.16.2+cpu)
  • tensorflow-cpu (2.15.0)
  • requests (2.32.5)
  • pyyaml (6.0.3)
  • pandas (2.3.3)
  • scipy (1.15.3)
  • matplotlib (3.10.8)
  • opencv-python (4.11.0.86)

It is recommended to develop your script outside EdgeBench. This environment allows users to test custom post-processing logic directly within the platform.

Adding a pre-processing script

  1. Use the provided Python template in the editor to transform input data to match your model’s expected format. Customize the logic as needed.

  2. Click the Copy Script icon to save the current script to your dashboard for future reference and easy sharing.

    Copy Script

  3. Click Run Test to validate the script against sample data.

    Run Test

    If the test compilation detects any errors or warnings:

    • Review the Logs Pane for detailed messages.
    • Resolve errors or debug warnings before re-running the test.

    Note

    Users can iteratively update and re-run the script until the pre-processing completes successfully.

  4. Once the test compilation passes successfully, click the Download Script icon to store your script.

    Save Script

  5. Click Next to proceed to the next step.

    Note

    The Next button will remain disabled until the test compilation completes successfully and the script is saved.

Logs pane

The Logs Pane, located at the bottom of the interface, displays detailed logs summarizing background activities, errors, and warnings encountered during compilation. This pane can be collapsed or expanded and is a valuable tool for troubleshooting and understanding compilation behavior.