Apply Exported Models

Applying an exported model can be achieved with the ApplyDNNRecos I3TraySegment. As an example, the models example_model1 and example_model2 can be applied via:

from dnn_reco.ic3.segments import ApplyDNNRecos

tray.AddSegment(
    ApplyDNNRecos,
    'ApplyDNNRecos',
    pulse_key='InIceDSTPulses',
    dom_exclusions=['SaturationWindows', 'BadDomsList','CalibrationErrata'],
    partial_exclusion=True,
    model_names=['example_model1', 'example_model2'],
)

Models which use the same input settings may be grouped in a single tray segment via the model_names parameter which accepts a list of model names. These models will then share the same input pipeline. As a result, the preprocessing only needs to be performed once. On a GPU, this is the most time consuming step. If run on a CPU, the number of CPUs to run the model on may be passed via num_cpus. Especially if on a GPU, it is advisable to run the DNN reco on batches of events at a time. This can be controlled via batch_size which defines the number of events to reconstruct simulateneously. The best settings depend on the hardware setup. A good staring point could be 32 or 64.