Spaces:
Sleeping
Sleeping
devjas1
commited on
Commit
Β·
2ee7ad2
1
Parent(s):
5cd8a58
(FEAT)[Refactor Image Processing Utilities]: Remove unused imports and clean up code structure in image_processing.py
Browse files- README.md +53 -28
- utils/image_processing.py +0 -3
README.md
CHANGED
|
@@ -9,7 +9,12 @@ pinned: false
|
|
| 9 |
license: apache-2.0
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.
|
|
@@ -20,9 +25,12 @@ It is a prototype pipeline for evaluating multiple convolutional neural networks
|
|
| 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**:
|
|
|
|
|
|
|
|
|
|
| 26 |
- π οΈ **Architecture**: PyTorch + Streamlit
|
| 27 |
|
| 28 |
---
|
|
@@ -34,8 +42,8 @@ It is a prototype pipeline for evaluating multiple convolutional neural networks
|
|
| 34 |
- [x] **FTIR support** (modular integration complete)
|
| 35 |
- [x] **Multi-model comparison dashboard**
|
| 36 |
- [x] **Performance tracking dashboard**
|
| 37 |
-
- [
|
| 38 |
-
- [
|
| 39 |
- [ ] RESTful API for programmatic access
|
| 40 |
|
| 41 |
---
|
|
@@ -44,22 +52,22 @@ It is a prototype pipeline for evaluating multiple convolutional neural networks
|
|
| 44 |
|
| 45 |
The application provides three main analysis modes in a tabbed interface:
|
| 46 |
|
| 47 |
-
1.
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
|
| 53 |
-
2.
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
|
| 59 |
-
3.
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
### Supported Input
|
| 65 |
|
|
@@ -72,9 +80,9 @@ The application provides three main analysis modes in a tabbed interface:
|
|
| 72 |
|
| 73 |
## Contributors
|
| 74 |
|
| 75 |
-
Dr. Sanmukh Kuppannagari (Mentor)
|
| 76 |
-
Dr. Metin Karailyan (Mentor)
|
| 77 |
-
Jaser Hasan (Author/Developer)
|
| 78 |
|
| 79 |
## Model Credit
|
| 80 |
|
|
@@ -92,15 +100,32 @@ _Resources, Conservation & Recycling_, **188**, 106718.
|
|
| 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**:
|
| 100 |
-
- **Backend**: PyTorch
|
| 101 |
-
- **Model Management**:
|
| 102 |
-
- **Data Processing**:
|
| 103 |
-
- **Multi-Format Parsing**:
|
| 104 |
-
- **Results Management**:
|
| 105 |
-
- **Performance Tracking**:
|
| 106 |
-
- **Deployment**:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
license: apache-2.0
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# AI-Driven Polymer Aging Prediction and Classification (v0.1)
|
| 13 |
+
|
| 14 |
+
[](https://opensource.org/licenses/Apache-2.0)
|
| 15 |
+

|
| 16 |
+

|
| 17 |
+

|
| 18 |
|
| 19 |
This web application classifies the degradation state of polymers using **Raman and FTIR spectroscopy** and deep learning.
|
| 20 |
It is a prototype pipeline for evaluating multiple convolutional neural networks (CNNs) on spectral data.
|
|
|
|
| 25 |
|
| 26 |
- π¬ **Modalities**: Raman & FTIR spectroscopy
|
| 27 |
- πΎ **Input Formats**: `.txt`, `.csv`, `.json` (with auto-detection)
|
| 28 |
+
- π§ **Models**: Figure2CNN (baseline), ResNet1D, ResNet18Vision, Custom CNNs (Enhanced, Efficient, Hybrid)
|
| 29 |
- π **Task**: Binary classification β Stable vs Weathered polymers
|
| 30 |
+
- π **Features**:
|
| 31 |
+
- Single-spectrum + Batch Spectrum Analysis
|
| 32 |
+
- Multi-model comparison
|
| 33 |
+
- Performance tracking dashboard
|
| 34 |
- π οΈ **Architecture**: PyTorch + Streamlit
|
| 35 |
|
| 36 |
---
|
|
|
|
| 42 |
- [x] **FTIR support** (modular integration complete)
|
| 43 |
- [x] **Multi-model comparison dashboard**
|
| 44 |
- [x] **Performance tracking dashboard**
|
| 45 |
+
- [x] Add more trained CNNs for comparison
|
| 46 |
+
- [x] Image-based inference (future modality)
|
| 47 |
- [ ] RESTful API for programmatic access
|
| 48 |
|
| 49 |
---
|
|
|
|
| 52 |
|
| 53 |
The application provides three main analysis modes in a tabbed interface:
|
| 54 |
|
| 55 |
+
1. **Standard Analysis**:
|
| 56 |
|
| 57 |
+
- Upload a single spectrum file (`.txt`, `.csv`, `.json`) or a batch of files.
|
| 58 |
+
- Choose a model from the sidebar.
|
| 59 |
+
- Run analysis and view the prediction, confidence, and technical details.
|
| 60 |
|
| 61 |
+
2. **Model Comparison**:
|
| 62 |
|
| 63 |
+
- Upload a single spectrum file.
|
| 64 |
+
- The app runs inference with all available models.
|
| 65 |
+
- View a side-by-side comparison of the models' predictions and performance.
|
| 66 |
|
| 67 |
+
3. **Performance Tracking**:
|
| 68 |
+
- Explore a dashboard with visualizations of historical performance data.
|
| 69 |
+
- Compare model performance across different metrics.
|
| 70 |
+
- Export performance data in CSV or JSON format.
|
| 71 |
|
| 72 |
### Supported Input
|
| 73 |
|
|
|
|
| 80 |
|
| 81 |
## Contributors
|
| 82 |
|
| 83 |
+
- Dr. Sanmukh Kuppannagari (Mentor)
|
| 84 |
+
- Dr. Metin Karailyan (Mentor)
|
| 85 |
+
- Jaser Hasan (Author/Developer)
|
| 86 |
|
| 87 |
## Model Credit
|
| 88 |
|
|
|
|
| 100 |
- **Live App**: [Hugging Face Space](https://huggingface.co/spaces/dev-jas/polymer-aging-ml)
|
| 101 |
- **GitHub Repo**: [ml-polymer-recycling](https://github.com/KLab-AI3/ml-polymer-recycling)
|
| 102 |
|
| 103 |
+
---
|
| 104 |
+
|
| 105 |
## π Technical Architecture
|
| 106 |
|
| 107 |
**The system is built on a modular, production-ready architecture designed for scalability and maintainability.**
|
| 108 |
|
| 109 |
+
- **Frontend**: Streamlit-based web application (`app.py`) with interactive, multi-tab UI.
|
| 110 |
+
- **Backend**: PyTorch for deep learning operations including model loading and inference.
|
| 111 |
+
- **Model Management**: Registry pattern (`models/registry.py`) for dynamic model loading and easy integration of new architectures.
|
| 112 |
+
- **Data Processing**: Modality-aware preprocessing pipeline (`utils/preprocessing.py`) for data integrity and standardization (Raman & FTIR).
|
| 113 |
+
- **Multi-Format Parsing**: `utils/multifile.py` for parsing `.txt`, `.csv`, and `.json` files.
|
| 114 |
+
- **Results Management**: `utils/results_manager.py` for managing session and persistent results, multi-model comparison, and data export.
|
| 115 |
+
- **Performance Tracking**: `utils/performance_tracker.py` logs metrics to SQLite and powers the dashboard.
|
| 116 |
+
- **Deployment**: Containerized via Docker (`Dockerfile`) for reproducible, cross-platform execution.
|
| 117 |
+
|
| 118 |
+
---
|
| 119 |
+
|
| 120 |
+
## Notable Additions in `space-deploy` Branch
|
| 121 |
+
|
| 122 |
+
- Enhanced FTIR support, with modular integration for spectral data.
|
| 123 |
+
- Multi-model comparison dashboard for evaluating multiple CNNs in parallel.
|
| 124 |
+
- Performance tracking dashboard with export options (CSV, JSON).
|
| 125 |
+
- Batch spectrum analysis for high-throughput evaluation.
|
| 126 |
+
- Updated color scheme (teal β yellow) for improved UI clarity.
|
| 127 |
+
- Improved README with Hugging Face Space config and clearer usage instructions.
|
| 128 |
+
- Bug fixes for filename casing and SDK deployment settings.
|
| 129 |
+
- Forward-looking plans for RESTful API and image-based inference.
|
| 130 |
+
|
| 131 |
+
---
|
utils/image_processing.py
CHANGED
|
@@ -4,11 +4,8 @@ Supports conversion of spectral images to processable data.
|
|
| 4 |
"""
|
| 5 |
|
| 6 |
from typing import Tuple, Optional, List, Dict
|
| 7 |
-
import base64
|
| 8 |
-
import io
|
| 9 |
import numpy as np
|
| 10 |
from PIL import Image, ImageEnhance, ImageFilter
|
| 11 |
-
import cv2
|
| 12 |
import matplotlib.pyplot as plt
|
| 13 |
from matplotlib.figure import Figure
|
| 14 |
import streamlit as st
|
|
|
|
| 4 |
"""
|
| 5 |
|
| 6 |
from typing import Tuple, Optional, List, Dict
|
|
|
|
|
|
|
| 7 |
import numpy as np
|
| 8 |
from PIL import Image, ImageEnhance, ImageFilter
|
|
|
|
| 9 |
import matplotlib.pyplot as plt
|
| 10 |
from matplotlib.figure import Figure
|
| 11 |
import streamlit as st
|