This model is a fine-tuned version of google/vit-base-patch16-224-in21k for classifying house conditions into 4 categories.
This Vision Transformer (ViT) model has been fine-tuned to classify house images into four condition categories:
| Class | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| good | 0.78 | 0.70 | 0.74 | 10 |
| unknown | 1.00 | 0.83 | 0.91 | 24 |
| ruined | 0.62 | 1.00 | 0.77 | 15 |
| medium | 0.85 | 0.74 | 0.79 | 31 |
Overall Metrics:
Predicted →
good unknown ruined medium
good [ 7 0 0 3 ]
unknown [ 1 20 2 1 ]
ruined [ 0 0 15 0 ]
medium [ 1 0 7 23 ]
Key Insights:
from transformers import ViTForImageClassification, ViTImageProcessor
from PIL import Image
import torch
# Load model and processor
model = ViTForImageClassification.from_pretrained("YOUR_USERNAME/YOUR_MODEL_NAME")
processor = ViTImageProcessor.from_pretrained("YOUR_USERNAME/YOUR_MODEL_NAME")
# Load and preprocess image
image = Image.open("path_to_image.jpg").convert("RGB")
inputs = processor(image, return_tensors="pt")
# Make prediction
with torch.no_grad():
outputs = model(**inputs)
predicted_class_idx = outputs.logits.argmax(-1).item()
predicted_label = model.config.id2label[str(predicted_class_idx)]
print(f"Predicted class: {predicted_label}")
# Get probabilities
probs = torch.nn.functional.softmax(outputs.logits, dim=-1)[0]
for idx, prob in enumerate(probs):
label = model.config.id2label[str(idx)]
print(f"{label}: {prob.item():.2%}")
The model was fine-tuned using the Hugging Face Transformers library with the following approach:
google/vit-base-patch16-224-in21k
Vision Transformer (ViT) model pre-trained on ImageNet-21k at resolution 224x224.
If you use this model, please cite:
@misc{house-condition-vit,
author = {Your Name},
title = {Fine-tuned ViT for House Condition Classification},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/YOUR_USERNAME/YOUR_MODEL_NAME}}
}
This model card was created by the model author.
model.safetensors 343 MBtraining_args.bin 5.8 kB