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
Files changed (2) hide show
  1. README.md +53 -28
  2. utils/image_processing.py +0 -3
README.md CHANGED
@@ -9,7 +9,12 @@ 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.
@@ -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**: Multi-model comparison, performance tracking dashboard
 
 
 
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
- - [ ] Add more trained CNNs for comparison
38
- - [ ] Image-based inference (future modality)
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. **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
 
@@ -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**: 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.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  license: apache-2.0
10
  ---
11
 
12
+ # AI-Driven Polymer Aging Prediction and Classification (v0.1)
13
+
14
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
15
+ ![Streamlit](https://img.shields.io/badge/Streamlit-1.25%2B-brightgreen)
16
+ ![Docker](https://img.shields.io/badge/docker-ready-blue)
17
+ ![HF Space](https://img.shields.io/badge/HF%20Space-Live-blueviolet)
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