Onnxruntime for TrkPID#5
Draft
sophiemiddleton wants to merge 2 commits intoMu2e:mainfrom
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds ONNX Runtime support for neural network inference to the
TrackPIDandTrackQualitymodules, enabling them to run models exported to ONNX format in addition to the existing TMVA/SOFIE-based evaluation. It also introduces a new script for converting.datweight files to ONNX models and updates the build system to link against ONNX Runtime. The changes allow for direct comparison of outputs from the traditional and ONNX-based inference within the same event loop.The most important changes are:
ONNX Runtime Integration in C++ Modules:
TrackPIDandTrackQualitymodules, including model loading, input/output tensor preparation, and inference execution. The code now runs both the TMVA/SOFIE and ONNX models in parallel for each event, and prints both outputs for debugging. (TrkDiag/src/TrackPID_module.cc,TrkDiag/src/TrackQuality_module.cc) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Build System Updates:
TrkDiag/src/SConscript) [1] [2]ONNX Model Conversion Script:
convert_trackpid_to_onnx.py, which parses.datneural network weight files and exports them as ONNX models. The script supports both TensorFlow/Keras-based and pure ONNX export paths, handling the architecture and weight reshaping to match the expected input/output of the C++ modules. (TrkDiag/scripts/convert_trackpid_to_onnx.py)Development