Note

This Python sample is available only with our Professional plan.

Export Trained PyTorch to PyTorch Jit Model

This Python script allows you to export trained PyTorch model To PyTorch Jit model that can be easily deployed in various runtime environment, with an optimized latency and throughput.

Expected Output

Compiled PyTorch Jit Model that can be easily deployed during runtime.

Specifically, it will output:

  1. model.ptjit (the model)

  2. info_ssd_jit.json (the hyperparameters used during training)

Setup & requirements

You will need to provide the following input:

  • path to the checkpoint. You can use red_event_cube_all_classes.ckpt from our pre-trained models

  • path to the output directory

How to start

To run the script with red_event_cube_all_classes.ckpt:

Linux

python3 export_detector.py red_event_cube_all_classes.ckpt /path/to/output

Windows

python export_detector.py red_event_cube_all_classes.ckpt /path/to/output

You can also verify the performance of the trained checkpoint directly by testing it on an event-based recording. For example, to use driving_sample.raw as a verification sequence:

Linux

python3 export_detector.py red_event_cube_all_classes.ckpt /path/to/output --verification_sequence driving_sample.raw

Windows

python export_detector.py red_event_cube_all_classes.ckpt /path/to/output --verification_sequence driving_sample.raw

To find the full list of options, run:

Linux

python3 export_detector.py -h

Windows

python export_detector.py -h