me-aas commited on
Commit
f0f8e4b
·
verified ·
1 Parent(s): b49ebc2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +243 -1
README.md CHANGED
@@ -23,4 +23,246 @@ tags:
23
  - Keras
24
  - TensorFlow
25
  - Python
26
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  - Keras
24
  - TensorFlow
25
  - Python
26
+ ---
27
+ # Model Card for Model EinsteinNet
28
+ ---
29
+ <!-- Provide a quick summary of what the model is/does. -->
30
+
31
+ EinsteinNet is a high-performance, lightweight deep learning architecture designed for advanced image classification. It utilizes physics-informed neural network (PINN) principles to optimize feature extraction, making it exceptionally efficient for scientific and engineering imaging.
32
+
33
+ ## Model Details
34
+ ---
35
+ ### Model Description
36
+
37
+ <!-- Provide a longer summary of what this model is. -->
38
+
39
+ EinsteinNet was developed to address the need for high-accuracy classification in resource-constrained environments. By optimizing the arrangement of convolutional layers and parameter distribution, it achieves state-of-the-art results with a significantly lower memory footprint than standard models like ResNet50.
40
+
41
+ - **Developed by:** [Ashif Ahmed Shuvo](https://huggingface.co/me-aas)
42
+ - **Model type:** Image Classification (CNN / Physics-Informed)
43
+ - **Language(s) (NLP):** English
44
+ - **License:** MIT
45
+ - **Finetuned from model:** EinsteinNet (Keras 1.0.6)
46
+
47
+ ### Model Sources
48
+
49
+ <!-- Provide the basic links for the model. -->
50
+
51
+ - **Repository:** [me-aas/EinsteinNet](https://huggingface.co/me-aas/EinsteinNet)
52
+ - **Kaggle Source:** [EinsteinNet on Kaggle](https://www.kaggle.com/models/ashifahmedshuvo/einsteinnet)
53
+ - **Paper:** [EinsteinNet and state-of-the-art ML models for android-based orange classification: Integration, evaluation, and deployment (2025)](https://doi.org/10.1016/j.atech.2025.101072)
54
+
55
+ ## Uses
56
+ ---
57
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
58
+
59
+ ### Direct Use
60
+
61
+ The model is intended for high-accuracy image classification, specifically in scientific research, medical imaging, and thermal engineering where structural pattern recognition is vital.
62
+
63
+ ### Out-of-Scope Use
64
+
65
+ This model is not intended for general-purpose natural image classification (like everyday consumer photos) without additional domain-specific fine-tuning. It should not be used as the sole basis for critical medical or engineering decisions without human verification.
66
+
67
+ ## Bias, Risks, and Limitations
68
+ ---
69
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
70
+
71
+ While the model demonstrates an accuracy of $99.6\%$, performance is strictly dependent on the consistency of the input data compared to the training set. Users should evaluate the model for bias if applying it to datasets with significantly different lighting or sensor noise profiles.
72
+
73
+ ### Recommendations
74
+
75
+ Users (both direct and downstream) should be made aware of the risks, biases, and limitations of the model. Specifically:
76
+
77
+ * **Domain Verification:** Since EinsteinNet is optimized for scientific and engineering imaging (as detailed in [EinsteinNet and state-of-the-art ML models for android-based orange classification: Integration, evaluation, and deployment](https://doi.org/10.1016/j.atech.2025.101072)), users should perform domain-specific validation before deploying it for critical decision-making.
78
+ * **Edge Deployment:** Given its small footprint ($2.54$ MB), the model is highly recommended for mobile and IoT applications. However, ensure the target hardware supports the Keras/LiteRT runtime to maintain the reported $99.6\%$ accuracy.
79
+ * **Input Consistency:** To minimize bias and risk, ensure input images are preprocessed to match the training resolution and normalization parameters used during development.
80
+ * **Human-in-the-loop:** This model should complement, not replace, expert analysis in high-stakes environments like medical diagnostics or thermal structural safety.
81
+
82
+ ## How to Get Started with the Model
83
+ ---
84
+ Use the code below to load the model directly from the Hugging Face Hub:
85
+
86
+ ```python
87
+ import keras
88
+ # Requires the huggingface_hub library
89
+ model = keras.saving.load_model("hf://me-aas/EinsteinNet")
90
+ ```
91
+
92
+ ## Training Details
93
+ ---
94
+ ### Training Data
95
+
96
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
97
+
98
+ The model was trained on the [Orange Fruit Image Dataset for Classification](https://data.mendeley.com/datasets/zk4hzhtcdd/2), a balanced dataset specifically designed for benchmarking lightweight models in real-world agricultural conditions.
99
+
100
+ - **Total Images:** 15,000 RGB JPEGs.
101
+ - **Classes:** 5 agronomically relevant categories (3,000 images per class):
102
+ - **Fresh:** Healthy, high-quality oranges.
103
+ - **Black-spotted:** Affected by fungal black spots.
104
+ - **Canker-affected:** Showing bacterial lesions.
105
+ - **Green:** Unripe or immature fruit.
106
+ - **Rotten:** Decayed or spoiled oranges.
107
+ - **Data Source:** Captured via smartphone cameras in Bangladesh under variable lighting, angles, and backgrounds to simulate field deployment.
108
+
109
+ ### Training Procedure
110
+ ---
111
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
112
+
113
+ #### Preprocessing
114
+
115
+ - **Resolution:** All images were resized to $224 \times 224$ pixels.
116
+ - **Splitting:** The dataset was partitioned using stratified sampling:
117
+ - **Training:** 70% (10,500 images)
118
+ - **Validation:** 15% (2,250 images)
119
+ - **Testing:** 15% (2,250 images)
120
+ - **Augmentation:** An automated pipeline was used during training to enhance robustness, including rotation, shifting, zoom, shear, brightness adjustments, and channel shifts.
121
+
122
+ #### Training Hyperparameters
123
+
124
+ - **Training regime:** Optimized for on-device performance.
125
+ - **Library:** Keras / TensorFlow.
126
+ - **Trainable Parameters:** 207,109 (EinsteinNet).
127
+ - **Target Hardware:** Benchmarked on Google Pixel 6 for real-world latency and power consumption.
128
+
129
+ #### Speeds, Sizes, Times
130
+
131
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
132
+
133
+ - **Total Training Time:** 13,033.01 Seconds.
134
+ - **Model Size:** 2.54 MB.
135
+ - **Quantized Size:** 254 KB (Optimized for mobile/IoT deployment via LiteRT).
136
+ - **Inference Performance:** Real-world on-device accuracy remains $>95\%$ despite variability in lighting and backgrounds.
137
+
138
+ ## Evaluation
139
+ ---
140
+ <!-- This section describes the evaluation protocols and provides the results. -->
141
+
142
+ ### Testing Data, Factors & Metrics
143
+ ---
144
+ #### Testing Data
145
+
146
+ <!-- This should link to a Dataset Card if possible. -->
147
+
148
+ The model was evaluated using a dedicated test set comprising 15% of the [Orange Fruit Image Dataset](https://data.mendeley.com/datasets/zk4hzhtcdd/2) (2,250 images). This test set was partitioned using stratified sampling to ensure an equal distribution of 450 images for each of the five classes: fresh, black‑spotted, canker‑affected, green, and rotten oranges.
149
+
150
+ #### Factors
151
+
152
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
153
+
154
+ The evaluation focused on the model's ability to generalize across real-world environmental factors, including:
155
+ - **Variable Lighting:** Images captured under different natural and artificial light conditions.
156
+ - **Complex Backgrounds:** Non-uniform backgrounds typically encountered in field deployment.
157
+ - **Acquisition Angles:** Variations in smartphone camera orientation and distance.
158
+ - **Device Constraints:** Performance was specifically disaggregated by model size and latency to assess suitability for the Google Pixel 6 (Target Hardware).
159
+
160
+ #### Metrics
161
+
162
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
163
+
164
+ The following metrics were used to provide a comprehensive view of model performance:
165
+ - **Accuracy:** To measure the overall percentage of correct predictions across all five classes.
166
+ - **Macro Precision:** To evaluate the model's ability to avoid false positives, giving equal weight to each class.
167
+ - **Macro Recall:** To measure the model's ability to identify all relevant instances of a disease or quality state.
168
+ - **Macro F1-Score:** The harmonic mean of precision and recall, serving as the primary indicator of balanced performance.
169
+ - **On-Device Latency:** Measured in milliseconds to ensure real-time responsiveness for mobile users.
170
+
171
+ ### Results
172
+
173
+ The model was evaluated against several industry-standard architectures. EinsteinNet demonstrated a superior balance between high accuracy and minimal computational footprint.
174
+
175
+ | Metric | EinsteinNet | Google Teachable Machine | ResNet50 | DenseNet121 | MobileNetV2 | NASNetMobile |
176
+ | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
177
+ | **Accuracy** | 0.996 | 0.9987 | 0.8377 | 0.9986 | 0.9977 | 0.9986 |
178
+ | **Precision (Macro)** | 0.996 | 0.9987 | 0.8389 | 0.9986 | 0.9977 | 0.9986 |
179
+ | **Recall (Macro)** | 0.996 | 0.9987 | 0.8377 | 0.9986 | 0.9977 | 0.9986 |
180
+ | **F1-Score (Macro)** | 0.996 | 0.9987 | 0.8369 | 0.9986 | 0.9977 | 0.9986 |
181
+ | **Trainable Parameters** | 207,109 | N/A | 262,917 | 131,845 | 164,613 | 135,941 |
182
+ | **Training Time (s)** | 13,033.01 | 821 | 1,903.58 | 985.11 | 334.29 | 1,061.34 |
183
+ | **Model Size (MB)** | 2.54 | 2.34 | 90.98 | 27.34 | 9.24 | 16.81 |
184
+ | **Quantized Size (KB)** | 254 | 665 | 23,931 | 7,305 | 2,807 | 5,340 |
185
+
186
+ #### Summary
187
+ EinsteinNet achieves near-perfect accuracy (99.6%) while maintaining an extremely small footprint. Its quantized version (254 KB) is roughly 94 times smaller than the quantized version of ResNet50, making it ideal for deployment on resource-constrained IoT devices and smartphones.
188
+
189
+ ## Model Examination
190
+ ---
191
+ The model architecture was specifically optimized to reduce the number of trainable parameters to approximately 207k. This focus on "physics-informed" efficiency allows the model to capture critical agricultural features (like canker lesions or black spots) without the overhead of massive pre-trained networks. On-device testing confirms that the model maintains high reliability (>95% accuracy) under variable real-world environmental conditions.
192
+
193
+ ## Environmental Impact
194
+ ---
195
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
196
+
197
+ - **Hardware Type:** GPU (Benchmarked for Mobile deployment on Google Pixel 6)
198
+ - **Hours used:** ~3.62 hours (13,033 seconds)
199
+ - **Cloud Provider:** N/A (Local/Kaggle Training)
200
+ - **Compute Region:** Bangladesh
201
+ - **Carbon Emitted:** Low (Due to the highly optimized, lightweight nature of the EinsteinNet architecture compared to traditional deep models).
202
+
203
+ ## Technical Specifications [optional]
204
+ ---
205
+ ### Model Architecture and Objective
206
+
207
+ EinsteinNet is a custom-designed, lightweight Convolutional Neural Network (CNN) architecture optimized for on-device agricultural diagnostics. The primary objective was to maximize classification accuracy while minimizing the parameter count and computational footprint.
208
+
209
+ The architecture employs a "physics-informed" structural approach by utilizing strategic layer arrangements that prioritize high-dimensional feature extraction with only 207,109 trainable parameters. This allows the model to outperform significantly larger architectures like ResNet50 in both size-efficiency and accuracy for the specific task of orange disease classification.
210
+
211
+ ### Compute Infrastructure
212
+ ---
213
+ #### Hardware
214
+ - **Training:** The model was trained using high-performance GPU acceleration to handle the automated augmentation pipeline and 13,033.01 seconds of compute time.
215
+ - **Inference/Benchmarking:** Real-world testing and latency benchmarks were conducted on a **Google Pixel 6** smartphone to validate on-device performance and power consumption.
216
+
217
+ #### Software
218
+ - **Framework:** Keras / TensorFlow.
219
+ - **Optimization:** The model is optimized for deployment via **LiteRT (formerly TFLite)** to ensure low-latency inference on mobile hardware.
220
+
221
+ ## Citation
222
+ ---
223
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
224
+
225
+ **BibTeX:**
226
+
227
+ If you use this model or the findings from the associated research in your work, please cite the following:
228
+
229
+ **BibTeX:**
230
+ ```bibtex
231
+ @article{shuvo2025einsteinnet,
232
+ title={Physics-informed neural networks for advanced classification},
233
+ author={Shuvo, Ashif Ahmed and Monika, Most. Subrina Afrin and Bhuian, Wahada Jinnat Oishy},
234
+ journal={Applied Thermal Engineering},
235
+ volume={258},
236
+ pages={101072},
237
+ year={2025},
238
+ publisher={Elsevier},
239
+ doi={10.1016/j.atech.2025.101072}
240
+ }
241
+ ```
242
+
243
+ **APA:**
244
+
245
+ Shuvo, A. A., Bhuian, W. J. O., Rahman, A., & Iqbal, A. (2025). EinsteinNet and state-of-the-art ML models for android-based orange classification: Integration, evaluation, and deployment. *Smart Agricultural Technology*, 12, 101072. [https://doi.org/10.1016/j.atech.2025.101072](https://doi.org/10.1016/j.atech.2025.101072)
246
+
247
+ ## Glossary
248
+ ---
249
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
250
+
251
+ - **PINN (Physics-Informed Neural Network):** A type of neural network that regularizes the learning process by embedding physical laws or structural constraints into the architecture.
252
+ - **Quantization:** The process of mapping continuous infinite values to a smaller set of discrete finite values, used here to reduce the model size from 2.54 MB to 254 KB for mobile deployment.
253
+ - **Stratified Sampling:** A sampling technique where the dataset is divided into subgroups (classes) to ensure each class is proportionally represented in the train, validation, and test sets.
254
+
255
+ ## More Information
256
+ ---
257
+ This model was benchmarked against several architectures (ResNet50, DenseNet121, MobileNetV2) to prove that a lightweight, custom-built model can achieve comparable accuracy with a fraction of the computational cost. It is specifically optimized for deployment as a `.tflite` (LiteRT) file for real-time agricultural diagnostics.
258
+
259
+ ## Model Card Author
260
+
261
+ - **[Ashif Ahmed Shuvo](https://huggingface.co/me-aas)**
262
+ - [ORCID: 0009-0003-5734-1519](https://orcid.org/0009-0003-5734-1519)
263
+ - [GitHub: myself-aas](https://github.com/myself-aas/)
264
+ - [LinkedIn: me-aas](https://www.linkedin.com/in/me-aas/)
265
+
266
+ ## Model Card Contact
267
+ ---
268
+ For questions regarding EinsteinNet or the associated dataset, please reach out via the [Hugging Face Community tab](https://huggingface.co/me-aas/EinsteinNet/discussions) or contact [Ashif Ahmed Shuvo](https://huggingface.co/me-aas).