Spaces:
Running
Running
devjas1
commited on
Commit
Β·
232a935
1
Parent(s):
a08022e
(DOCS)[README]: Update and enhance description to include FTIR support; refine current scope and usage instructions
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: AI Polymer Classification
|
| 3 |
emoji: π¬
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: yellow
|
|
@@ -8,19 +8,21 @@ app_file: app.py
|
|
| 8 |
pinned: false
|
| 9 |
license: apache-2.0
|
| 10 |
---
|
| 11 |
-
## AI-Driven Polymer Aging Prediction and Classification (v0.1)
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
---
|
| 18 |
|
| 19 |
## π§ͺ Current Scope
|
| 20 |
|
| 21 |
-
- π¬ **
|
| 22 |
-
-
|
|
|
|
| 23 |
- π **Task**: Binary classification β Stable vs Weathered polymers
|
|
|
|
| 24 |
- π οΈ **Architecture**: PyTorch + Streamlit
|
| 25 |
|
| 26 |
---
|
|
@@ -29,84 +31,76 @@ It was developed as part of the AIRE 2025 internship project at the Imageomics I
|
|
| 29 |
|
| 30 |
- [x] Inference from Raman `.txt` files
|
| 31 |
- [x] Model selection (Figure2CNN, ResNet1D)
|
|
|
|
|
|
|
|
|
|
| 32 |
- [ ] Add more trained CNNs for comparison
|
| 33 |
-
- [ ] FTIR support (modular integration planned)
|
| 34 |
- [ ] Image-based inference (future modality)
|
|
|
|
| 35 |
|
| 36 |
---
|
| 37 |
|
| 38 |
## π§ How to Use
|
| 39 |
|
| 40 |
-
|
| 41 |
-
2. Choose a model from the sidebar
|
| 42 |
-
3. Run analysis
|
| 43 |
-
4. View prediction, logits, and technical information
|
| 44 |
|
| 45 |
-
|
| 46 |
|
| 47 |
-
-
|
| 48 |
-
-
|
| 49 |
-
-
|
| 50 |
-
- Automatically resampled to 500 points
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
## Contributors
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
|
| 69 |
---
|
| 70 |
|
| 71 |
-
##
|
| 72 |
-
|
| 73 |
-
- π» **Live App**: [Hugging Face Space](https://huggingface.co/spaces/dev-jas/polymer-aging-ml)
|
| 74 |
-
- π **GitHub Repo**: [ml-polymer-recycling](https://github.com/KLab-AI3/ml-polymer-recycling)
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
## π― Strategic Expansion Objectives (Roadmap)
|
| 78 |
-
|
| 79 |
-
**The roadmap defines three major expansion paths designed to broaden the systemβs capabilities and impact:**
|
| 80 |
-
|
| 81 |
-
1. **Model Expansion: Multi-Model Dashboard**
|
| 82 |
-
|
| 83 |
-
> The dashboard will evolve into a hub for multiple model architectures rather than being tied to a single baseline. Planned work includes:
|
| 84 |
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
- **Reproducible Integration**: Maintaining modular scripts and pipelines so each modelβs results can be replicated without conflict.
|
| 89 |
|
| 90 |
-
|
| 91 |
|
| 92 |
-
|
| 93 |
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
-
|
| 97 |
-
- **Multi-Model Execution**: Selected models from the registry can be applied to all uploaded images simultaneously.
|
| 98 |
-
- **Batch Results**: Output will be returned in a structured, accessible way, showing both individual predictions and aggregate statistics.
|
| 99 |
-
- **Enhanced Feedback**: Outputs will include predicted class, model confidence, and potentially annotated image previews.
|
| 100 |
|
| 101 |
-
|
| 102 |
|
| 103 |
-
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
|
| 107 |
-
|
| 108 |
-
- **Architecture Compatibility**: Ensuring existing and retrained models can process FTIR data without mixing it with Raman workflows.
|
| 109 |
-
- **UI Integration**: Introducing FTIR as a separate option in the modality selector, keeping Raman, Image, and FTIR workflows clearly delineated.
|
| 110 |
-
- **Phased Development**: Implementation details to be refined during meetings to ensure scientific rigor.
|
| 111 |
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: AI Polymer Classification (Raman & FTIR)
|
| 3 |
emoji: π¬
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: yellow
|
|
|
|
| 8 |
pinned: false
|
| 9 |
license: apache-2.0
|
| 10 |
---
|
|
|
|
| 11 |
|
| 12 |
+
## AI-Driven Polymer Aging Prediction and Classification (v0.1)
|
| 13 |
|
| 14 |
+
This web application classifies the degradation state of polymers using **Raman and FTIR spectroscopy** and deep learning.
|
| 15 |
+
It is a prototype pipeline for evaluating multiple convolutional neural networks (CNNs) on spectral data.
|
| 16 |
|
| 17 |
---
|
| 18 |
|
| 19 |
## π§ͺ Current Scope
|
| 20 |
|
| 21 |
+
- π¬ **Modalities**: Raman & FTIR spectroscopy
|
| 22 |
+
- πΎ **Input Formats**: `.txt`, `.csv`, `.json` (with auto-detection)
|
| 23 |
+
- π§ **Models**: Figure2CNN (baseline), ResNet1D, ResNet18Vision
|
| 24 |
- π **Task**: Binary classification β Stable vs Weathered polymers
|
| 25 |
+
- π **Features**: Multi-model comparison, performance tracking dashboard
|
| 26 |
- π οΈ **Architecture**: PyTorch + Streamlit
|
| 27 |
|
| 28 |
---
|
|
|
|
| 31 |
|
| 32 |
- [x] Inference from Raman `.txt` files
|
| 33 |
- [x] Model selection (Figure2CNN, ResNet1D)
|
| 34 |
+
- [x] **FTIR support** (modular integration complete)
|
| 35 |
+
- [x] **Multi-model comparison dashboard**
|
| 36 |
+
- [x] **Performance tracking dashboard**
|
| 37 |
- [ ] Add more trained CNNs for comparison
|
|
|
|
| 38 |
- [ ] Image-based inference (future modality)
|
| 39 |
+
- [ ] RESTful API for programmatic access
|
| 40 |
|
| 41 |
---
|
| 42 |
|
| 43 |
## π§ How to Use
|
| 44 |
|
| 45 |
+
The application provides three main analysis modes in a tabbed interface:
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
1. **Standard Analysis**:
|
| 48 |
|
| 49 |
+
- Upload a single spectrum file (`.txt`, `.csv`, `.json`) or a batch of files.
|
| 50 |
+
- Choose a model from the sidebar.
|
| 51 |
+
- Run analysis and view the prediction, confidence, and technical details.
|
|
|
|
| 52 |
|
| 53 |
+
2. **Model Comparison**:
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
- Upload a single spectrum file.
|
| 56 |
+
- The app runs inference with all available models.
|
| 57 |
+
- View a side-by-side comparison of the models' predictions and performance.
|
| 58 |
|
| 59 |
+
3. **Performance Tracking**:
|
| 60 |
+
- Explore a dashboard with visualizations of historical performance data.
|
| 61 |
+
- Compare model performance across different metrics.
|
| 62 |
+
- Export performance data in CSV or JSON format.
|
| 63 |
|
| 64 |
+
### Supported Input
|
| 65 |
|
| 66 |
+
- Plaintext `.txt`, `.csv`, or `.json` files.
|
| 67 |
+
- Data can be space-, comma-, or tab-separated.
|
| 68 |
+
- Comment lines (`#`, `%`) are ignored.
|
| 69 |
+
- The app automatically detects the file format and resamples the data to a standard length.
|
| 70 |
|
| 71 |
---
|
| 72 |
|
| 73 |
+
## Contributors
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
+
Dr. Sanmukh Kuppannagari (Mentor)
|
| 76 |
+
Dr. Metin Karailyan (Mentor)
|
| 77 |
+
Jaser Hasan (Author/Developer)
|
|
|
|
| 78 |
|
| 79 |
+
## Model Credit
|
| 80 |
|
| 81 |
+
Baseline model inspired by:
|
| 82 |
|
| 83 |
+
Neo, E.R.K., Low, J.S.C., Goodship, V., Debattista, K. (2023).
|
| 84 |
+
_Deep learning for chemometric analysis of plastic spectral data from infrared and Raman databases._
|
| 85 |
+
_Resources, Conservation & Recycling_, **188**, 106718.
|
| 86 |
+
[https://doi.org/10.1016/j.resconrec.2022.106718](https://doi.org/10.1016/j.resconrec.2022.106718)
|
| 87 |
|
| 88 |
+
---
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
+
## π Links
|
| 91 |
|
| 92 |
+
- **Live App**: [Hugging Face Space](https://huggingface.co/spaces/dev-jas/polymer-aging-ml)
|
| 93 |
+
- **GitHub Repo**: [ml-polymer-recycling](https://github.com/KLab-AI3/ml-polymer-recycling)
|
| 94 |
|
| 95 |
+
## π Technical Architecture
|
| 96 |
|
| 97 |
+
**The system is built on a modular, production-ready architecture designed for scalability and maintainability.**
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
+
- **Frontend**: A Streamlit-based web application (`app.py`) provides an interactive, multi-tab user interface.
|
| 100 |
+
- **Backend**: PyTorch handles all deep learning operations, including model loading and inference.
|
| 101 |
+
- **Model Management**: A registry pattern (`models/registry.py`) allows for dynamic model loading and easy integration of new architectures.
|
| 102 |
+
- **Data Processing**: A robust, modality-aware preprocessing pipeline (`utils/preprocessing.py`) ensures data integrity and standardization for both Raman and FTIR data.
|
| 103 |
+
- **Multi-Format Parsing**: The `utils/multifile.py` module handles parsing of `.txt`, `.csv`, and `.json` files.
|
| 104 |
+
- **Results Management**: The `utils/results_manager.py` module manages session and persistent results, with support for multi-model comparison and data export.
|
| 105 |
+
- **Performance Tracking**: The `utils/performance_tracker.py` module logs performance metrics to a SQLite database and provides a dashboard for visualization.
|
| 106 |
+
- **Deployment**: The application is containerized using Docker (`Dockerfile`) for reproducible, cross-platform execution.
|