Upload model card and dataset checkpoints
Browse files- CHECKSUMS.sha256 +7 -0
- LICENSE +21 -0
- README.md +101 -0
- checkpoint_manifest.json +77 -0
- checkpoints/Aachen-Heerlen/hqsam_lora_decoder_best.pth +3 -0
- checkpoints/EBC/semantic_hqsam_best.pth +3 -0
- checkpoints/EMPS/hqsam_lora_decoder_best.pth +3 -0
- checkpoints/Grain/hqsam_lora_decoder_best.pth +3 -0
- checkpoints/MetalDAM/semantic_hqsam_best.pth +3 -0
- checkpoints/Super/semantic_hqsam_best.pth +3 -0
- checkpoints/UHCS/semantic_hqsam_best.pth +3 -0
CHECKSUMS.sha256
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
4bbca68e4f700cc635e2cbf81b2c92f5ba67ab0ba635646f9eae249ee4da79e9 checkpoints/Aachen-Heerlen/hqsam_lora_decoder_best.pth
|
| 2 |
+
edcd912db9c947d98c2a17915a8d4c6c34aa6b3e00f73ec4731ed34ce0a1cd9f checkpoints/EBC/semantic_hqsam_best.pth
|
| 3 |
+
bf2c21e39bc3f0fb1b90475fd5e56b7991da125704c99aaacd3f4a8e50c35efd checkpoints/EMPS/hqsam_lora_decoder_best.pth
|
| 4 |
+
fb1063891bed2c39ae8688e42f1f1717e6e0a8a2c578c1129bed127ebb620bfa checkpoints/Grain/hqsam_lora_decoder_best.pth
|
| 5 |
+
1eb8e3822d478f41672e115fc3bb7512ce5dd894a792bcd0d75d0abb76a7718f checkpoints/MetalDAM/semantic_hqsam_best.pth
|
| 6 |
+
b673cea3e2b0f06cc05f538510f29b4f267d478de7625b4079aeea4780d80ae7 checkpoints/Super/semantic_hqsam_best.pth
|
| 7 |
+
93b6cd6aa651cd03cafcf8a2c291aaa226dbc505daaee92a30b9c287735ac18b checkpoints/UHCS/semantic_hqsam_best.pth
|
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2026 The Material Image Segmentation Benchmark Authors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: pytorch
|
| 4 |
+
pipeline_tag: image-segmentation
|
| 5 |
+
tags:
|
| 6 |
+
- semantic-segmentation
|
| 7 |
+
- microstructure
|
| 8 |
+
- materials-science
|
| 9 |
+
- segment-anything
|
| 10 |
+
- lora
|
| 11 |
+
- hq-sam
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# HQ-SAM Fine-Tuned Checkpoints for Microstructure Segmentation
|
| 15 |
+
|
| 16 |
+
## Model Description
|
| 17 |
+
|
| 18 |
+
This repository contains dataset-specific fine-tuned parameter checkpoints for
|
| 19 |
+
HQ-SAM with its ViT-B backbone. The files do not contain the full base model.
|
| 20 |
+
Load them together with `sam_hq_vit_b.pth` using the matching source script.
|
| 21 |
+
|
| 22 |
+
Source code:
|
| 23 |
+
https://github.com/WUT-AI-AI4Mat/microstructure-segmentation-benchmark
|
| 24 |
+
|
| 25 |
+
## Fine-Tuning Routes and Checkpoints
|
| 26 |
+
|
| 27 |
+
| Dataset | Route | Classes | File |
|
| 28 |
+
| --- | --- | ---: | --- |
|
| 29 |
+
| Aachen-Heerlen | LoRA plus mask decoder | 2 | `checkpoints/Aachen-Heerlen/hqsam_lora_decoder_best.pth` |
|
| 30 |
+
| EMPS | LoRA plus mask decoder | 2 | `checkpoints/EMPS/hqsam_lora_decoder_best.pth` |
|
| 31 |
+
| Grain | LoRA plus mask decoder | 2 | `checkpoints/Grain/hqsam_lora_decoder_best.pth` |
|
| 32 |
+
| EBC | LoRA, mask decoder, and class tokens | 3 | `checkpoints/EBC/semantic_hqsam_best.pth` |
|
| 33 |
+
| Super | LoRA, mask decoder, and class tokens | 3 | `checkpoints/Super/semantic_hqsam_best.pth` |
|
| 34 |
+
| MetalDAM | LoRA, mask decoder, and class tokens | 5 | `checkpoints/MetalDAM/semantic_hqsam_best.pth` |
|
| 35 |
+
| UHCS | LoRA, mask decoder, and class tokens | 7 | `checkpoints/UHCS/semantic_hqsam_best.pth` |
|
| 36 |
+
|
| 37 |
+
Class counts include background.
|
| 38 |
+
|
| 39 |
+
## Base Model Requirement
|
| 40 |
+
|
| 41 |
+
Download the official HQ-SAM ViT-B checkpoint from:
|
| 42 |
+
https://huggingface.co/lkeab/hq-sam/resolve/main/sam_hq_vit_b.pth
|
| 43 |
+
|
| 44 |
+
The files in this repository contain LoRA and mask-decoder parameters.
|
| 45 |
+
Multiclass files additionally contain learned class tokens.
|
| 46 |
+
|
| 47 |
+
## Training Details
|
| 48 |
+
|
| 49 |
+
- Base architecture: HQ-SAM ViT-B
|
| 50 |
+
- SAM encoder input: longest side resized and padded to 1024 x 1024
|
| 51 |
+
- Training batch size: 1
|
| 52 |
+
- Epochs: 200
|
| 53 |
+
- Optimizer: AdamW
|
| 54 |
+
- Learning rate: 0.0001
|
| 55 |
+
- Weight decay: 0.0001
|
| 56 |
+
- Scheduler: CosineAnnealingLR with minimum learning rate 0.000001
|
| 57 |
+
- Early-stopping patience: 50
|
| 58 |
+
- LoRA rank: 8
|
| 59 |
+
- LoRA alpha: 16
|
| 60 |
+
- LoRA dropout: 0.05
|
| 61 |
+
- LoRA targets: `qkv` and `proj`
|
| 62 |
+
- Binary objective: BCE, Dice, and IoU MSE
|
| 63 |
+
- Multiclass objective: cross-entropy and Dice
|
| 64 |
+
|
| 65 |
+
## Usage
|
| 66 |
+
|
| 67 |
+
Example for binary EMPS segmentation:
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
hf download NAMESPACE/microstructure-hq-sam checkpoints/EMPS/hqsam_lora_decoder_best.pth --local-dir weights/hq-sam
|
| 71 |
+
python hqsam/test_lora_decoder.py \
|
| 72 |
+
--dataset-root /path/to/EMPS \
|
| 73 |
+
--checkpoint weights/pretrained/sam_hq_vit_b.pth \
|
| 74 |
+
--finetuned-checkpoint weights/hq-sam/checkpoints/EMPS/hqsam_lora_decoder_best.pth \
|
| 75 |
+
--output-dir results/hq_sam_emps
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
For multiclass checkpoints, use `hqsam/test_semantic_hqsam.py` and pass the
|
| 79 |
+
class count from the table.
|
| 80 |
+
|
| 81 |
+
## Inference Parameters
|
| 82 |
+
|
| 83 |
+
The original automatic-mask path uses `points_per_side=32`,
|
| 84 |
+
`pred_iou_thresh=0.85`, `stability_score_thresh=0.8`, and `crop_n_layers=0`.
|
| 85 |
+
The binary fine-tuned path uses `pred_iou_thresh=0.78` and
|
| 86 |
+
`stability_score_thresh=0.8`.
|
| 87 |
+
|
| 88 |
+
## Evaluation, Intended Use, and Limitations
|
| 89 |
+
|
| 90 |
+
Evaluation saves original-resolution masks and calculates the common benchmark
|
| 91 |
+
metrics through `Myutils/metrics.py`. These checkpoints are intended for
|
| 92 |
+
research reproduction on the named datasets. They require the matching HQ-SAM
|
| 93 |
+
ViT-B base checkpoint and may not generalize to unseen materials or imaging
|
| 94 |
+
conditions. They are not validated for safety-critical or industrial
|
| 95 |
+
quality-control decisions.
|
| 96 |
+
|
| 97 |
+
## License and Citation
|
| 98 |
+
|
| 99 |
+
The released experiment files are provided under the MIT license. HQ-SAM and
|
| 100 |
+
its base checkpoint remain subject to upstream terms and are not redistributed
|
| 101 |
+
here. A paper citation will be added after publication.
|
checkpoint_manifest.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "HQ-SAM",
|
| 3 |
+
"source_code": "https://github.com/WUT-AI-AI4Mat/microstructure-segmentation-benchmark",
|
| 4 |
+
"checkpoint_count": 7,
|
| 5 |
+
"checkpoints": [
|
| 6 |
+
{
|
| 7 |
+
"dataset": "Aachen-Heerlen",
|
| 8 |
+
"task": "binary_segmentation",
|
| 9 |
+
"num_classes": 2,
|
| 10 |
+
"fine_tuning_route": "lora_and_mask_decoder",
|
| 11 |
+
"path": "checkpoints/Aachen-Heerlen/hqsam_lora_decoder_best.pth",
|
| 12 |
+
"size_bytes": 22405385,
|
| 13 |
+
"sha256": "4bbca68e4f700cc635e2cbf81b2c92f5ba67ab0ba635646f9eae249ee4da79e9",
|
| 14 |
+
"requires_base_checkpoint": "sam_hq_vit_b.pth"
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"dataset": "EBC",
|
| 18 |
+
"task": "multiclass_semantic_segmentation",
|
| 19 |
+
"num_classes": 3,
|
| 20 |
+
"fine_tuning_route": "lora_mask_decoder_and_class_tokens",
|
| 21 |
+
"path": "checkpoints/EBC/semantic_hqsam_best.pth",
|
| 22 |
+
"size_bytes": 22409839,
|
| 23 |
+
"sha256": "edcd912db9c947d98c2a17915a8d4c6c34aa6b3e00f73ec4731ed34ce0a1cd9f",
|
| 24 |
+
"requires_base_checkpoint": "sam_hq_vit_b.pth"
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"dataset": "EMPS",
|
| 28 |
+
"task": "binary_segmentation",
|
| 29 |
+
"num_classes": 2,
|
| 30 |
+
"fine_tuning_route": "lora_and_mask_decoder",
|
| 31 |
+
"path": "checkpoints/EMPS/hqsam_lora_decoder_best.pth",
|
| 32 |
+
"size_bytes": 22405385,
|
| 33 |
+
"sha256": "bf2c21e39bc3f0fb1b90475fd5e56b7991da125704c99aaacd3f4a8e50c35efd",
|
| 34 |
+
"requires_base_checkpoint": "sam_hq_vit_b.pth"
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"dataset": "Grain",
|
| 38 |
+
"task": "binary_segmentation",
|
| 39 |
+
"num_classes": 2,
|
| 40 |
+
"fine_tuning_route": "lora_and_mask_decoder",
|
| 41 |
+
"path": "checkpoints/Grain/hqsam_lora_decoder_best.pth",
|
| 42 |
+
"size_bytes": 22405385,
|
| 43 |
+
"sha256": "fb1063891bed2c39ae8688e42f1f1717e6e0a8a2c578c1129bed127ebb620bfa",
|
| 44 |
+
"requires_base_checkpoint": "sam_hq_vit_b.pth"
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"dataset": "MetalDAM",
|
| 48 |
+
"task": "multiclass_semantic_segmentation",
|
| 49 |
+
"num_classes": 5,
|
| 50 |
+
"fine_tuning_route": "lora_mask_decoder_and_class_tokens",
|
| 51 |
+
"path": "checkpoints/MetalDAM/semantic_hqsam_best.pth",
|
| 52 |
+
"size_bytes": 22411887,
|
| 53 |
+
"sha256": "1eb8e3822d478f41672e115fc3bb7512ce5dd894a792bcd0d75d0abb76a7718f",
|
| 54 |
+
"requires_base_checkpoint": "sam_hq_vit_b.pth"
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"dataset": "Super",
|
| 58 |
+
"task": "multiclass_semantic_segmentation",
|
| 59 |
+
"num_classes": 3,
|
| 60 |
+
"fine_tuning_route": "lora_mask_decoder_and_class_tokens",
|
| 61 |
+
"path": "checkpoints/Super/semantic_hqsam_best.pth",
|
| 62 |
+
"size_bytes": 22409839,
|
| 63 |
+
"sha256": "b673cea3e2b0f06cc05f538510f29b4f267d478de7625b4079aeea4780d80ae7",
|
| 64 |
+
"requires_base_checkpoint": "sam_hq_vit_b.pth"
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"dataset": "UHCS",
|
| 68 |
+
"task": "multiclass_semantic_segmentation",
|
| 69 |
+
"num_classes": 7,
|
| 70 |
+
"fine_tuning_route": "lora_mask_decoder_and_class_tokens",
|
| 71 |
+
"path": "checkpoints/UHCS/semantic_hqsam_best.pth",
|
| 72 |
+
"size_bytes": 22413935,
|
| 73 |
+
"sha256": "93b6cd6aa651cd03cafcf8a2c291aaa226dbc505daaee92a30b9c287735ac18b",
|
| 74 |
+
"requires_base_checkpoint": "sam_hq_vit_b.pth"
|
| 75 |
+
}
|
| 76 |
+
]
|
| 77 |
+
}
|
checkpoints/Aachen-Heerlen/hqsam_lora_decoder_best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4bbca68e4f700cc635e2cbf81b2c92f5ba67ab0ba635646f9eae249ee4da79e9
|
| 3 |
+
size 22405385
|
checkpoints/EBC/semantic_hqsam_best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:edcd912db9c947d98c2a17915a8d4c6c34aa6b3e00f73ec4731ed34ce0a1cd9f
|
| 3 |
+
size 22409839
|
checkpoints/EMPS/hqsam_lora_decoder_best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bf2c21e39bc3f0fb1b90475fd5e56b7991da125704c99aaacd3f4a8e50c35efd
|
| 3 |
+
size 22405385
|
checkpoints/Grain/hqsam_lora_decoder_best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fb1063891bed2c39ae8688e42f1f1717e6e0a8a2c578c1129bed127ebb620bfa
|
| 3 |
+
size 22405385
|
checkpoints/MetalDAM/semantic_hqsam_best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1eb8e3822d478f41672e115fc3bb7512ce5dd894a792bcd0d75d0abb76a7718f
|
| 3 |
+
size 22411887
|
checkpoints/Super/semantic_hqsam_best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b673cea3e2b0f06cc05f538510f29b4f267d478de7625b4079aeea4780d80ae7
|
| 3 |
+
size 22409839
|
checkpoints/UHCS/semantic_hqsam_best.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:93b6cd6aa651cd03cafcf8a2c291aaa226dbc505daaee92a30b9c287735ac18b
|
| 3 |
+
size 22413935
|