Views
No views yet
| Property | Value |
|---|---|
| Base Model | facebook/dinov2-base (ViT-B/14, 86.6M params) |
| Training Method | Linear probe (frozen backbone + trained classifier head) |
| Training Dataset | Siddanna/transparent-tube-dataset |
| Accuracy | 100% on test set |
| Loss | 0.0014 |
| Image Size | 256×256 (DINOv2 default) |
| License | Apache 2.0 |
1from transformers import pipeline
2
3classifier = pipeline("image-classification", model="Siddanna/transparent-tube-classifier")
4result = classifier("your_tube_image.jpg")
5print(result)
6# [{'label': 'transparent_with_blue', 'score': 0.99}, {'label': 'transparent_alone', 'score': 0.01}]1from transformers import AutoImageProcessor, AutoModelForImageClassification
2from PIL import Image
3import torch
4
5# Load model and processor
6model = AutoModelForImageClassification.from_pretrained("Siddanna/transparent-tube-classifier")
7processor = AutoImageProcessor.from_pretrained("Siddanna/transparent-tube-classifier")
8
9# Load and classify image
10image = Image.open("your_tube_image.jpg")
11inputs = processor(image, return_tensors="pt")
12
13with torch.no_grad():
14 logits = model(**inputs).logits
15
16predicted_class = logits.argmax(-1).item()
17label = model.config.id2label[predicted_class]
18confidence = torch.softmax(logits, dim=-1)[0][predicted_class].item()
19
20print(f"Prediction: {label} (confidence: {confidence:.2%})")1e-3 (with cosine schedule)| Epoch | Train Loss | Eval Loss | Eval Accuracy |
|---|---|---|---|
| 1 | 0.032 | 0.019 | 100% |
| 2 | 0.011 | 0.002 | 100% |
| 3 | 0.002 | 0.001 | 100% |
| 4 | 0.004 | 0.010 | 99.5% |
data/
├── train/
│ ├── transparent_alone/ # Photos of transparent tube alone
│ └── transparent_with_blue/ # Photos of transparent + blue tube
└── test/
├── transparent_alone/
└── transparent_with_blue/1# Clone the training script
2# Option A: Linear probe (fast, good with 50+ images/class)
3python train.py --data_dir ./data --freeze_backbone --hub_model_id your-username/tube-classifier
4
5# Option B: Full fine-tune (better with 200+ images/class)
6python train.py --data_dir ./data --learning_rate 5e-5 --hub_model_id your-username/tube-classifier1@misc{transparent-tube-classifier,
2 title={Transparent Tube Classifier},
3 author={Siddanna},
4 year={2024},
5 publisher={Hugging Face},
6 url={https://huggingface.co/Siddanna/transparent-tube-classifier}
7}