Skip to content

Add ML-based element identification tab - #106

Open
susmitab wants to merge 1 commit into
ISISMuon:mainfrom
susmitab:add-ml-element-identification
Open

susmitab wants to merge 1 commit into
ISISMuon:mainfrom
susmitab:add-ml-element-identification

Conversation

@susmitab

Copy link
Copy Markdown

Adds an “Element Identification” tab to the Elemental Analysis window. It runs trained machine learning (ML) models that classify which elements are present in a whole muonic X-ray spectrum and lists the result per plotted detector. Models are discovered from core/ml_identification/models//. Each folder holds model.pt and elements_library.npz, plus an optional settings.json for models trained on a different energy grid. The tab refuses to run unless Display Plot is a spectrum mode.

Questions for maintainers:

  1. torch dependency

This change adds torch as a required dependency in pyproject.toml, because the ML models need it to run. It makes the install larger, adds to the size of the PyInstaller build, and torch takes a while to import when EVA starts. Would you prefer to keep it as a required dependency, or make it optional (for example pip install eva[ml]), so that the Element Identification tab only appears when torch is installed? I’m happy to make that change if you’d prefer it.

  1. Model files in the repository

The three trained models (model.pt and elements_library.npz for each) are committed under src/EVA/core/ml_identification/models/. They’re about 1.5 MB each, so I didn’t use Git LFS. Is it acceptable to keep them in the repository like this, or would you prefer them stored elsewhere?

  1. requirements.txt

I’ve added torch to pyproject.toml only, because the CI workflow installs from there (pip install -e .). I haven’t changed requirements.txt. Please let me know if torch should be listed there as well, and I’ll add it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant