Sudan Red detection via Raman spectroscopy using SE-ResNet deep learning
# 2026raman — Sudan Red Detection via Raman Spectroscopy
Deep learning system for detecting Sudan Red dyes (banned food colorants) in spectroscopic samples using Squeeze-and-Excitation Residual Networks (SE-ResNet).
## Overview
Classifies Raman spectra into 4 independent binary tasks — Sudan Red 1, 2, 3, 4 — plus a hierarchical presence detector. The project documents a full 13-version evolution from baseline to production-ready architecture.
## Best Results (v11_arch — SEResNetLite)
| Class | Accuracy | Recall | F1 |
|-------|----------|--------|-----|
| Sudan Red 1 | 83.3% | 78.6% | 73.3% |
| Sudan Red 2 | 93.8% | 80.0% | 84.2% |
| Sudan Red 3 | 95.8% | 81.8% | 90.0% |
| Sudan Red 4 | 97.9% | 92.3% | 96.0% |
| **All-or-None** | **81.3%** | — | — |
| **Exclusive Top-1** | **87.5%** | — | — |
## Architecture
**SEResNetLite** (v11_arch):
- Conv1d(1→32) → 4 residual blocks with SE attention (32→64→128→256)
- Dual pooling: adaptive avg-pool + max-pool → 512-dim
- Dropout (0.2) → FC(512→1) per class
- He initialization, BCEWithLogitsLoss, AdamW (lr=1e-3, wd=1e-5)
**Hierarchical Pipeline** (v13):
- Stage 1: Sudan presence detector (positive vs. negative)
- Stage 2: 4 independent classifiers on Sudan-positive samples only
- Independent data splitting to prevent label bias
## Preprocessing Pipeline
1. **Baseline correction** — Zhang fit (2 passes)
2. **Smoothing** — Savitzky-Golay (window=15, polyorder=3)
3. **Interpolation** — 400–2000 cm⁻¹ → 4096 points
4. **Normalization** — min-max / SNV / area normalization
## Project Structure
```
2026raman/
├── SE_ResNet_4model.py # Original baseline (v1)
├── SE_ResNet_4model_v2.py ~ v13.py # Version evolution
├── SE_ResNet_4model_v11_arch.py # Best architecture
├── SE_ResNet_4model_v13.py # Latest: hierarchical pipeline
├── requirements.txt
├── PROJECT_STRUCTURE.md
├── model_versions/ # Trained model manifests
│ ├── v8/ensemble_manifest.json
│ ├── v9/hybrid_manifest.json
│ └── v10/tta_m …