File size: 3,454 Bytes
63c0e3d d95925b 547139e 92fb47d d960b43 547139e 64cee33 547139e 92fb47d 547139e 92fb47d 1e0a8c4 92fb47d 547139e 92fb47d 1e0a8c4 92fb47d 1e0a8c4 92fb47d 547139e 92fb47d 547139e 020f6ef 547139e ab0489c 92fb47d c053bca b225af8 3998744 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
---
license: mit
datasets:
- grano1/core_sample_image_data
language:
- en
metrics:
- accuracy
- f1
base_model:
- microsoft/swinv2-tiny-patch4-window16-256
pipeline_tag: image-classification
tags:
- geotechnics
---
# πͺ¨ Core Sample Main Fraction Classifier
This multi-label classification model was fine-tuned for automated visual analysis of soil core samples, and trained / validated / tested on the `grano1/core_sample_image_data` dataset available via the HuggingFace eco-system. The model aims to predict one of the following four class labels - termed in accordance with DIN 4023 - from cropped core sample images (300x300 pixels):
- π€ Clay (T)
- π€ Silt (U)
- π‘ Sand (S)
- βͺ Gravel (G)
## π Metrics
The following table summarizes selected metrics quantifying the model performance on the test set:
| π Metric | Value |
|------------------------------------|--------|
| Categorical Cross-Entropy Loss | 0.0946 |
| Accuracy | 0.9718 |
| F1-score (macro, aggregated) | 0.8765 |
| F1-score (weighted, aggregated) | 0.9712 |
## βοΈ Hyperparameters
The following table summarizes selected hyperparameters used for training the model:
| Metric | Value |
|---------------------------|----------|
| Batch size | 8 |
| Optimizer | AdamW |
| Warm-up ratio | 0.1 |
| Metric for best model | F1-Score (Macro) |
| Early stopping patience | 3 |
## π Usage
```python
# Load the dataset
data_dataset = load_dataset("grano1/core_sample_image_data")
# Load image processor and model
processor = AutoImageProcessor.from_pretrained("grano1/core_sample_image_main_fraction_model")
model = AutoModelForImageClassification.from_pretrained("grano1/core_sample_image_main_fraction_model")
model.eval() # Set model to evaluation mode
# Show sample features
data_dataset["test"].features
# Select sample from test set
split = "test"
sample = data_dataset[split][2] # Pick one sample
image = sample["image"]
# Prepare input for model
inputs = processor(images=image, return_tensors="pt")
# Run inference
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
predicted_class = logits.argmax(dim=1).item()
print(sample)
# Get predicted and true label name
id2label = model.config.id2label
label2id = model.config.label2id
predicted_label_name = id2label[predicted_class]
# Show result
print(f"β
Predicted label: {predicted_label_name}")
print(f"π§Ύ True label: {sample['HB']}")
# Display image
plt.imshow(sample['image'])
plt.axis('off') # Hide axes
plt.show()
```
## π Limitations
The `grano1/core_sample_image_data` dataset includes more `HB` labels than the four identified by this model. This may require binning procedures, e.g., fS => S. Instructions can be found in the citation documented below.
## β¨ Citation
If you use this model, please cite:
```bibtex
@inproceedings{Granitzer.2025,
author = {Granitzer, Andreas-Nizar and Beck, Johannes and Leo, Johannes and Tschuchnigg, Franz},
title = {Explainable Insight into the Vision-Based Classification of Soil Core Samples from Close-Range Images},
pages = {228--233},
editor = {Uzielli, Marco and Phoon, Kok-Kwang},
booktitle = {Proceedings of the 3rd Workshop on the Future of Machine Learning in Geotechnics (3FOMLIG)},
year = {2025},
address = {Florence, Italy}
} |