CNN PR [3/4]: Add CNN training example#896
Draft
sevmag wants to merge 5 commits into
Draft
Conversation
Introduce a new `data_representation/images/` module that lets detectors be represented as multi-channel 3D image tensors rather than graphs, as required by CNN backbones. Components: - `ImageRepresentation` base class — analogue of `GraphDefinition` for image-shaped inputs. Builds per-channel image tensors from raw pulse data using a `GridDefinition` that maps each DOM to a voxel. - `GridDefinition` — abstract mapping from DOM string/dom indices to a 3D grid. `IC86GridDefinition` covers the IceCube IC86 array (main array + upper/lower DeepCore), `ExamplePrometheusGridDefinition` covers the Prometheus example geometry. Mapping tables live in `cnn_mapping_tables.py` as Python literals (no parquet files). - `IC86Image` and `ExamplePrometheusImage` — concrete image representations bundling a detector and its grid definition. Also adds: - `TEST_IMAGE_DIR` and the three `TEST_IC86*_IMAGE` constants in `graphnet.constants` for the new test fixtures. - `.npy` test fixtures for the IC86 main array and the two DeepCore sub-arrays. - Unit tests for `GridDefinition` and `ImageRepresentation`. No model code yet — that lands in follow-up PRs (`IceCubeDNN`, `LCSC`). Split from graphnet-team#813.
Introduce `graphnet.models.cnn`, the convolutional-network counterpart to the existing GNN backbones, intended to consume the image data representation added in the image-representation PR. - `CNN` — abstract base class (analogue of `GNN`) defining the interface for convolutional backbones operating on image-shaped `Data` objects. - `IceCubeDNN` — configurable CNN backbone following the IceCube DNN reconstruction architecture. `cnn/__init__.py` exports `CNN` and `IceCubeDNN`; the `LCSC` model lands in a follow-up PR. Split from graphnet-team#813.
Add the LCSC convolutional backbone, building on the `CNN` base class. Registered in `cnn/__init__.py` alongside `CNN` and `IceCubeDNN`. Stacked on the CNN-base PR. Split from graphnet-team#813.
Add `examples/04_training/09_train_cnn.py`, an end-to-end training example for the CNN models: it builds an image data representation (`ExamplePrometheusImage`), feeds it to an `LCSC` backbone inside a `StandardModel`, and trains an `EnergyReconstruction` task on the bundled example data. Depends on the image data representation and CNN model PRs. Split from graphnet-team#813.
Draft
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.
Summary
Fifth and final PR carved out of #813 (see the split tracking comment). Adds an end-to-end training example for the CNN models.
What's new
examples/04_training/09_train_cnn.py— builds an image data representation (ExamplePrometheusImage), feeds it to anLCSCbackbone inside aStandardModel, and trains anEnergyReconstructiontask on the bundled example data.This example imports from all three earlier split PRs:
ExamplePrometheusImagefrom the image data representation (CNN PR [1/4]: Add image data representation for CNN backbones #892)LCSCfrom the CNN models (CNN PR [2/4]: Add CNN base class and IceCubeDNN model #894 base + CNN PR [3/4]: Add LCSC CNN model #895)Because those base branches only exist in the fork, this PR targets
maindirectly, so its current diff includes the files from #892/#894/#895 in addition to the net-new example. Once those merge intomain, GitHub will narrow this diff to justexamples/04_training/09_train_cnn.py.Review/merge order: merge #892, #894, then #895 first; this PR is kept as a draft until then, after which it'll be rebased onto
mainand marked ready.Test plan
blackreformatted, then all hooks pass)python -m py_compilesucceedspython examples/04_training/09_train_cnn.pyon the bundled example dataSplit from #813.
🤖 Generated with Claude Code