Project Positioning
This project explores how to turn mass spectra screenshots into structured peak information. It is not positioned as a finished chemical identification system; it is a prototype that connects traditional image parsing, lightweight rule explanation, and future trainable CNN / Transformer modules.
The public website is a browser-side rule-based demo. The Python side keeps a model-oriented structure for later experiments, but reliable chemical judgment still requires labeled spectra, trained weights, and standard library validation.
- Goal: extract peak candidates from spectrum images and present interpretable results.
- Current demo: static browser workflow for upload, peak list, and fragment-rule explanation.
- Model direction: CNN for visual robustness, Transformer for peak-sequence relationship modeling.
Week 1: Baseline Parsing And Peak Extraction
The first week focused on making the project runnable before adding model complexity. The core decision was to build a rule-based baseline first: locate the plotting area, detect vertical peak lines, estimate pixel-to-m/z mapping, and output a structured peak list.
This stage is important because it provides an interpretable baseline. Even if the future neural model improves robustness, the rule pipeline gives clear intermediate evidence and makes errors easier to inspect.
- Defined the input assumption: clean white-background mass spectrum screenshots.
- Implemented candidate peak extraction fields such as m/z, relative_intensity, x_px, and height_px.
- Separated fragment rules and compound-library style matching from the image parser.
- Added tests and examples to keep the baseline behavior reproducible.
Three Work Packages Inside The Prototype
Instead of presenting the work as several separate projects, it is clearer to describe it as one medium-sized prototype with three connected work packages. This keeps the story honest while still showing engineering structure and project planning.
The three parts correspond to what a reviewer can actually inspect: a rule-based extraction baseline, a static public demo, and a model-facing interface for future CNN / Transformer experiments.
- Work package 1: spectrum image parsing, axis localization, peak candidate extraction, and structured peak-list output.
- Work package 2: browser demo, upload interaction, result visualization, GitHub Pages publication, and presentation material.
- Work package 3: CNN / Transformer upgrade path, including visual feature learning, peak-sequence encoding, and future training requirements.
Week 2: Demo Packaging And Model Interface
The second week focused on turning the parsing pipeline into a presentable project artifact. The browser demo was designed for quick public access: users can upload a screenshot and inspect peak candidates locally without a server.
At the same time, the CNN + Transformer direction was organized as an upgrade path. CNN is responsible for learning local visual patterns such as peak lines, axes, text interference, and noise. Transformer treats the peak list as a sequence and models relationships among m/z positions, intensity ratios, and possible fragment patterns.
- Built a static public demo suitable for GitHub Pages presentation.
- Prepared GitHub documentation and a project website link for reviewers.
- Clarified the boundary between implemented rule demo and future trainable model modules.
- Created defense material explaining why the project is more than a simple web page.
What I Learned
The main learning outcome is the value of building a conservative baseline before claiming intelligence. In this project, the rule-based pipeline gives transparent outputs, while the CNN / Transformer structure points to a more robust future system.
For future work, the key challenge is data: a reliable model needs annotated peaks, spectrum labels, and comparison with standard spectral libraries. Without that, the system should be described as a prototype rather than a completed chemical identification model.
- Rule-based systems are useful when interpretability and debugging matter.
- CNN helps with image-level variation, but does not understand chemistry by itself.
- Transformer is useful for global peak-sequence patterns, not for directly reading raw images.
- Good project presentation should state both implemented results and honest limitations.