Open-Source

Deep learning
for spectral science

SpectrAI is a open-source framework bringing state-of-the-art AI to spectroscopy and spectral imaging from denoising to hyperspectral segmentation.

spectrai_denoising_demo.py
1580 1350
400 cm⁻¹ ← Raman Shift → 1800 cm⁻¹
SpectrAI pipeline diagram

Built for spectral science, open to all

Spectroscopy and spectral imaging underpin discoveries across biomedical research, environmental monitoring, and materials science. SpectrAI provides a unified framework that brings deep learning directly to the spectroscopist's workbench.

We welcome contributions, from new augmentation strategies and architectures to benchmark datasets and documentation improvements.

  • Comprehensive framework End-to-end tools for spectral data ingestion, pre-processing, model training, and evaluation, all in one package.
  • Pre-processing & augmentation A library of spectral-specific augmentation methods to maximise model robustness with limited data.
  • Specialised neural networks ResUNet, RCAN, UNet, and more, architectures purpose-built for spectral denoising, classification, segmentation, and super-resolution.
  • Open source & community-driven Hosted on GitHub, and developed collaboratively by researchers at King's College London and beyond.

Open data access

SpectrAI was built on the conviction that open science accelerates discovery. Every model, dataset link, and training recipe is freely available so that any researcher regardless of institution or resource can reproduce, validate, and build upon our work.

MIT Licence PyTorch 2.x Compatible

 Contribute to SpectrAI

Fork the repository, submit a pull request, or open an issue. All skill levels are welcome — from fixing typos to contributing new architectures.

# Install via pip
pip install spectrai

# Clone the repository
git clone https://github.com/conor-horgan/spectrai

Getting started

Four end-to-end examples covering the core deep learning tasks in spectroscopy and spectral imaging.

Spectral denoising result
Raman

Spectral denoising & reconstruction

Using a ResUNet model trained on 172K paired low/high-SNR Raman spectra from MDA-MB-231 breast cancer cells, SpectrAI dramatically enhances signal quality, enabling shorter acquisition times without sacrificing data fidelity.

Hyperspectral super-resolution
Hyperspectral

Spectral image super-resolution

Applied to intraoperative hyperspectral brain images, a residual channel attention network (RCAN) model simultaneously preserves spatial resolution and spectral fidelity, opening new avenues for real-time intraoperative guidance.

Hyperspectral segmentation
Segmentation

Spectral semantic segmentation

A UNet model trained on the AeroRIT hyperspectral aerial dataset demonstrates how SpectrAI handles large spatial-spectral datasets for scene understanding, relevant to remote sensing, cell biology, and clinical imaging alike.

Transfer learning
Transfer Learning

Transfer learning for spectral denoising

Training deep neural networks from scratch demands large datasets and compute. SpectrAI's transfer learning workflows let you adapt a pre-trained model to new spectral domains in a fraction of the time — lowering the barrier to entry for all labs.

Publicly available datasets

All benchmark datasets used to validate SpectrAI are openly shared. Use them to train your own models.

Raman Spectroscopy

MDA-MB-231 low/high SNR Raman spectra

Application: Spectral denoising
Source: github.com/conor-horgan/DeepeR

172,312 paired low-SNR (0.1 s) and high-SNR (1 s) Raman spectra from 11 MDA-MB-231 human breast cancer cells, acquired on a confocal Raman microscope.

Download Dataset
Raman Imaging

MDA-MB-231 hyperspectral Raman images

Application: Super-resolution
Source: github.com/conor-horgan/DeepeR

169 hyperspectral Raman images of MDA-MB-231 cells, acquired using 532 nm excitation on a confocal Raman microscope. Ideal for spectral image enhancement studies.

Download Dataset
Hyperspectral Aerial

AeroRIT

Application: Semantic segmentation
Source: github.com/aneesh3108/AeroRIT

Hyperspectral aerial scene over Rochester Institute of Technology. Rangnekar et al., IEEE TGRS 58(11), 2020. Reference benchmark for spectral segmentation algorithms.

Access Dataset
Hyperspectral Medical

HSI Human Brain Database

Application: Super-resolution
Source: hsibraindatabase.iuma.ulpgc.es

36 intraoperative hyperspectral brain images from 22 patients, averaging 439 × 400 px with 826 spectral bands (400–1000 nm). Fabelo et al., IEEE Access 7, 2019.

Access Dataset

Publications

If SpectrAI contributes to your research, please cite the following paper.

2021 Analytical Chemistry

High-throughput molecular imaging via deep learning enabled Raman spectroscopy

Conor C. Horgan, Magnus Jensen, Anika Nagelkerke, Jean-Phillipe St-Pierre, Tom Vercauteren, Molly M. Stevens, and Mads S. Bergholt

Analytical Chemistry, 93(48), 15850–15860

DOI

About Us

SpectrAI was developed by Dr Conor Horgan and Dr Mads Bergholt at the Label-free Bioimaging Laboratory, King's College London, back in 2021 to build an open community around AI-enabled spectroscopy.

Our goal is to lower the barrier to applying deep learning to spectral data, making reproducible AI-assisted spectroscopy accessible to every researcher regardless of their computational background.

See the Publications section for full citations and one-click BibTeX.

 Contact

Institution
King's College London
Label-free Bioimaging Laboratory
Address
Floor 17, Tower Wing
Great Maze Pond, London SE1 9RT