Daniel Eddie Rollins commited on
Commit
57d7d49
·
1 Parent(s): 1af9684

Update model card

Browse files
Files changed (1) hide show
  1. README.md +76 -100
README.md CHANGED
@@ -16,185 +16,161 @@ tags:
16
  # afMLevel-background-unet
17
 
18
  This U‑Net model predicts tilt, scanner drift, and other large‑scale imaging artifacts present in Atomic Force Microscopy (AFM) height maps.
19
- It outputs a **background** image, the same size and scale as the raw AFM image, which can be subtracted (via the accompanying [afMLevel](https://github.com/mayatek1/afMLevel)
20
  code) to produce a levelled height map.
21
 
22
  ## Model Details
23
 
 
 
24
  ### Model Description
25
 
26
- This model is part of the [afMLevel](https://github.com/mayatek1/afMLevel) project.
27
- The repository includes tools for:
 
28
 
29
  - running inference,
30
  - subtracting the predicted background,
31
- - integrating the model into analysis workflows.
32
-
33
- The model is a 7‑layer **U‑Net**, adapted from the original U‑Net architecture, and implemented fully in **PyTorch**.
34
- It performs image‑to‑image regression to estimate background height 'image' caused by physical and instrumental AFM artifacts.
35
-
36
 
37
  - **Developed by:** Maya Tekchandani
38
- - **Maintained by:** Dr Daniel E. Rollins
39
  - **Principal Investigator:** Dr George R. Heath
40
- - **Affiliation:** University of Leeds
41
  - **Funded by [optional]:** [More Information Needed]
42
- - **Shared by:** [Heath-AFM-Lab](https://heath-afm-lab.github.io/)
43
- - **Model type:** U‑Net regression model for AFM background prediction
44
  - **License:** BSD‑3‑Clause
45
- - **Finetuned from model [optional]:** None (trained from scratch)
46
-
47
- ### Model Sources [optional]
48
 
49
- <!-- Provide the basic links for the model. -->
50
 
51
  - **Repository:** https://github.com/mayatek1/afMLevel
52
- - **Paper [optional]:** In preparation
53
- - **Demo [optional]:** [Demonstration notebooks](https://github.com/mayatek1/afMLevel/tree/main/notebooks)
54
 
55
- # Uses
56
 
57
- ## Direct Use
58
 
59
- The [afMLevel](https://github.com/mayatek1/afMLevel/) inference code operates on **NumPy arrays**, so raw AFM files must first be
60
- loaded using an external reader such as [playnano](https://github.com/derollins/playNano), [AFMReader](https://github.com/AFM-SPM/AFMReader), or a custom
61
- loader. Once loaded, the afMLevel repo and notebooks handle inference and output of either
62
- the predicted background or the levelled image directly.
63
 
64
- The model has been primarily tested on **biological AFM data** and is best suited to that
65
- context, though it may generalise to other sample types with similar imaging characteristics.
66
 
67
- ## Downstream Use
68
 
69
- - Integration into the **playNano** package, which also handles file reading, making it a
70
- natural end-to-end workflow.
71
- - Batch levelling of **high-speed AFM videos** via playnano.
72
- - As a preprocessing step feeding into segmentation, particle detection, or other analysis
73
- tools.
74
 
75
- ## OutofScope Use
 
 
 
 
76
 
77
  This model is **not** intended for:
78
 
79
- - predicting physical or mechanical properties of samples,
80
- - denoising extremely corrupted AFM images outside the training distribution,
81
- - interpreting AFM contact mechanics,
82
- - working on specialized AFM modes (KPFM, MFM, FMM, etc.) without validation,
83
- - non-biological samples, without first validating performance on representative images.
84
 
85
- # Bias, Risks, and Limitations
86
 
87
- - The model was trained on a specific dataset of real AFM height maps; performance may degrade for very different imaging modes, scan sizes, or materials.
88
- - Extremely noisy scans or those containing jump‑to‑contact instabilities may produce inaccurate background predictions.
89
  - Users should visually inspect levelled outputs before scientific interpretation.
90
 
91
  ### Recommendations
92
 
93
- - Always verify a subset of corrected images manually.
94
- - Avoid applying the model to AFM imaging modes it has not been trained on (i.e. phase, electrical, magnetic modes).
95
 
96
  ## How to Get Started with the Model
97
 
98
- The recommended way to use this model is through the
99
- [afMLevel](https://github.com/mayatek1/afMLevel) repository, which handles inference,
100
- background subtraction, and output. Demonstration notebooks are available
101
- [here](https://github.com/mayatek1/afMLevel/tree/main/notebooks).
102
 
103
  ## Training Details
104
 
105
- The model was trained from scratch on real AFM topography data using the PyTorch framework.
106
 
107
  ### Training Data
108
 
109
- This model was trained on a **non‑public dataset of 2,001 real AFM height‑map images**.
110
  To increase dataset size and improve generalization, images were augmented using:
111
 
112
- - reflection along the y-axis,
113
- - rotation by 180°,
114
- - (mask model only) synthetic line-noise artefacts.
115
 
116
- This produced **6,003 training images** for the background model.
117
  A **60:40 train‑validation split** was used.
118
 
119
  ### Training Procedure
120
 
121
- - **Architecture:** 7‑layer U‑Net with large convolutional filters (9×9)
122
- - **Framework:** PyTorch
123
- - **Optimizer:** Adam
124
- - **Learning rate:** 0.0005
125
- - **Objective:** pixel‑wise continuous regression to target background images
126
- - **Hardware:** trained using GPU acceleration
127
- - Loss‑curve diagnostics were used to monitor convergence.
128
 
129
- #### Preprocessing [optional]
130
 
131
  [More Information Needed]
132
 
133
-
134
  #### Training Hyperparameters
135
 
136
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
137
-
138
- #### Speeds, Sizes, Times [optional]
139
 
140
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
141
 
142
  [More Information Needed]
143
 
144
  ## Evaluation
145
 
146
- <!-- This section describes the evaluation protocols and provides the results. -->
147
 
148
- ### Testing Data, Factors & Metrics
149
 
150
- #### Testing Data
151
 
152
- <!-- This should link to a Dataset Card if possible. -->
 
 
 
 
153
 
154
- [More Information Needed]
155
-
156
- #### Factors
157
 
158
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
159
 
160
- [More Information Needed]
161
-
162
- #### Metrics
163
-
164
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
165
-
166
- [More Information Needed]
167
 
168
  ### Results
169
 
170
- [More Information Needed]
171
-
172
- #### Summary
173
 
 
174
 
175
-
176
- ## Citation [optional]
177
-
178
- Paper in preparation
179
 
180
  **BibTeX:**
181
-
182
- [More Information Needed]
183
 
184
  **APA:**
185
-
186
  [More Information Needed]
187
 
188
- ## Model Card Authors [optional]
189
-
190
- - **Maya Tekchandani** (primary developer)
191
- - **Dr Daniel E. Rollins** (maintainer)
192
- - **Dr George R. Heath** (project supervisor & PI)
193
 
194
- ## Model Card Contact
 
 
195
 
196
- # Contact
197
 
198
- For questions or issues, please contact:
199
- **George R. Heath- University of Leeds**
200
  Email: G.R.Heath@leeds.ac.uk
 
16
  # afMLevel-background-unet
17
 
18
  This U‑Net model predicts tilt, scanner drift, and other large‑scale imaging artifacts present in Atomic Force Microscopy (AFM) height maps.
19
+ It outputs a **background** image, the same size and scale as the raw AFM image, which can be subtracted (via the accompanying [afMLevel](https://github.com/mayatek1/afMLevel)
20
  code) to produce a levelled height map.
21
 
22
  ## Model Details
23
 
24
+ This model is part of the [afMLevel](https://github.com/mayatek1/afMLevel) project.
25
+
26
  ### Model Description
27
 
28
+ This model is a 7‑layer **U‑Net** architecture implemented in **PyTorch**, trained to perform image‑to‑image regression for background prediction in AFM height maps. The network was trained on **256 × 256‑pixel images** and therefore expects inputs of this size at inference time.
29
+
30
+ The afMLevel repository includes tools for:
31
 
32
  - running inference,
33
  - subtracting the predicted background,
34
+ - integrating the model into AFM anasis workflows.
 
 
 
 
35
 
36
  - **Developed by:** Maya Tekchandani
37
+ - **Maintained by:** Dr Daniel E. Rollins
38
  - **Principal Investigator:** Dr George R. Heath
39
+ - **Affiliation:** University of Leeds
40
  - **Funded by [optional]:** [More Information Needed]
41
+ - **Shared by:** [Heath-AFMab](https://heath-afm-lab.github.io/)
42
+ - **Model type:** U‑Net regression model for AFM background estimation
43
  - **License:** BSD‑3‑Clause
44
+ - **Finetuned from model:** None (trained from scratch)
 
 
45
 
46
+ ### Model Sources
47
 
48
  - **Repository:** https://github.com/mayatek1/afMLevel
49
+ - **Paper:** In preparation
50
+ - **Demo notebooks:** https://github.com/mayatek1/afMLevel/tree/main/notebooks
51
 
52
+ ## Uses
53
 
54
+ This model is designed for used within the [afMLevel](https://github.com/mayatek1/afMLevel/) `background_model` module.
55
 
56
+ ### Direct Use
 
 
 
57
 
58
+ The [afMLevel](https://github.com/mayatek1/afMLevel/) model aplication package operates on **NumPy arrays**, so raw AFM files must first be loaded using an external reader such as [playnano](https://github.com/derollins/playNano), [AFMReader](https://github.com/AFM-SPM/AFMReader), or a custom loader. Once loaded, afMLevel handles inference and outputs either the predicted background or the final levelled image.
 
59
 
60
+ The model has been primarily tested on **biological AFM data**. It may generalise to other sample types with similar imaging characteristics.
61
 
62
+ ### Downstream Use
 
 
 
 
63
 
64
+ - Integration into **playNano**, enabling endtoend reading and levelling.
65
+ - Batch levelling of **high‑speed AFM videos** via playNano.
66
+ - Preprocessing for segmentation, particle detection, or other AFM analysis tools.
67
+
68
+ ### Out‑of‑Scope Use
69
 
70
  This model is **not** intended for:
71
 
72
+ - prediction of physical or mechanical properties,
73
+ - denoising heavily corrupted AFM scans outside the training distrution,
74
+ - interpretation of AFM contact mechanics,
75
+ - specialised AFM modes (KPFM, MFM, FMM, etc.) without validation,
76
+ - nonbiological samples without performance verification.
77
 
78
+ ## Bias, Risks, and Limitations
79
 
80
+ - The model was trained on a specific dataset of real AFM height maps; performance may degrade for very different imaging modes, scan sizes, or materials.
81
+ - Extremely noisy scans or those containing jump‑to‑contact instabilities may produce inaccurate background predictions.
82
  - Users should visually inspect levelled outputs before scientific interpretation.
83
 
84
  ### Recommendations
85
 
86
+ - Manually verify a subset of levelled images.
87
+ - Avoid applying the model to imaging modes it was not trained on.
88
 
89
  ## How to Get Started with the Model
90
 
91
+ Use the model through the [afMLevel](https://github.com/mayatek1/afMLevel) repository, which handles background prediction, subtraction, and output generation. Demonstration notebooks are provided in the repository.
 
 
 
92
 
93
  ## Training Details
94
 
95
+ The model was trained from scratch on real AFM topography data using PyTorch.
96
 
97
  ### Training Data
98
 
99
+ This model was trained on a **non‑public dataset of 2,001 real AFM height‑map images**.
100
  To increase dataset size and improve generalization, images were augmented using:
101
 
102
+ - reflection along the yaxis,
103
+ - rotation by 180°.
 
104
 
105
+ This produced **6,003 training images**.
106
  A **60:40 train‑validation split** was used.
107
 
108
  ### Training Procedure
109
 
110
+ - **Architecture:** 7‑layer U‑Net with large convolutional filters (9×9)
111
+ - **Framework:** PyTorch
112
+ - **Optimizer:** Adam
113
+ - **Learning rate:** 0.0005
114
+ - **Objective:** pixel‑wise continuous regression
115
+ - **Hardware:** trained with GPU acceleration
116
+ - Loss curves were monitored to assess convergence.
117
 
118
+ #### Preprocessing
119
 
120
  [More Information Needed]
121
 
 
122
  #### Training Hyperparameters
123
 
124
+ - **Training regime:** [More Information Needed]
 
 
125
 
126
+ #### Speeds, Sizes, Times
127
 
128
  [More Information Needed]
129
 
130
  ## Evaluation
131
 
132
+ The performance of the background model was evaluated indirectly through its impact on automated levelling. The main metric used was **Mean Squared Error (MSE)** between the auto‑levelled output and manually levelled ground‑truth images. Visual inspection was also carried out by the developers. Full evaluation results will be provided in the accompanying paper (in preparation).
133
 
134
+ ### Testing Data
135
 
136
+ Evaluation was performed on a held‑out set of real AFM height maps spanning a wide range of:
137
 
138
+ - biological sale types,
139
+ - imaging conditions,
140
+ - noise levels,
141
+ - numbers of surface planes,
142
+ - scan artefacts (e.g., streaks, line noise).
143
 
144
+ *A dataset link will be added when appropriate.*
 
 
145
 
146
+ ### Metrics
147
 
148
+ - **Primary metric:** MSE between auto‑levelled and manually levelled images
149
+ - **Distribution analysis:** comparing mean vs median MSE
150
+ - **Success‑rate metric:** proportion of images with MSE < 0.1 (empirical “well‑levelled” threshold)
 
 
 
 
151
 
152
  ### Results
153
 
154
+ Initial internal testing indicates that the background model supports reliable automated levelling across a broad range of AFM images. Full quantitative and statistical analyses will be included in the companion paper (in preparation).
 
 
155
 
156
+ ## Citation
157
 
158
+ Paper in praration
 
 
 
159
 
160
  **BibTeX:**
161
+ [More Inrmation Needed]
 
162
 
163
  **APA:**
 
164
  [More Information Needed]
165
 
166
+ ## Model Card Authors
 
 
 
 
167
 
168
+ - **Maya Tekchandani**
169
+ - **Dr Daniel E. Rollins**
170
+ - **Dr George R. Heath**
171
 
172
+ ## Contact
173
 
174
+ For questions or issues, please contact:
175
+ **George R. Heath, University of Leeds**
176
  Email: G.R.Heath@leeds.ac.uk