Instructions to use m7kael/yachtmaster-boat-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use m7kael/yachtmaster-boat-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="m7kael/yachtmaster-boat-classifier") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("m7kael/yachtmaster-boat-classifier") model = AutoModelForImageClassification.from_pretrained("m7kael/yachtmaster-boat-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
YachtMaster Boat Image Classifier
A Vision Transformer (ViT) model fine-tuned to classify boat images into 5 categories:
- cruising: Photos of boats underway on the water
- exterior: Static dock, marina, or anchored views
- interior: Cabin, salon, galley, stateroom, or internal living spaces
- layout: Floor plans, general arrangement drawings, deck plans, or schematic diagrams
- technical: Machinery spaces, engine compartments, bilge, or technical areas
Usage
from transformers import ViTImageProcessor, ViTForImageClassification
from PIL import Image
# Load model and processor
processor = ViTImageProcessor.from_pretrained("m7kael/yachtmaster-boat-classifier")
model = ViTForImageClassification.from_pretrained("m7kael/yachtmaster-boat-classifier")
# Load image
image = Image.open("boat.jpg")
# Process and predict
inputs = processor(image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
# Get predictions
predicted_class_idx = logits.argmax(-1).item()
predicted_class = model.config.id2label[predicted_class_idx]
print(f"Predicted class: {predicted_class}")
API Usage
import requests
API_URL = "https://api-inference.huggingface.co/models/m7kael/yachtmaster-boat-classifier"
headers = {"Authorization": "Bearer YOUR_TOKEN"}
def query(filename):
with open(filename, "rb") as f:
data = f.read()
response = requests.post(API_URL, headers=headers, data=data)
return response.json()
# Example
result = query("boat.jpg")
print(result)
Performance
Based on test set evaluation:
- Accuracy: Check test_results.json
- F1 Score: Check test_results.json
- Precision/Recall: Check test_results.json per class
Training
Fine-tuned from google/vit-base-patch16-224-in21k on custom boat image dataset.
- Base model: Vision Transformer (ViT) with patch size 16x16
- Input size: 224x224 pixels
- Number of classes: 5
- Framework: Hugging Face Transformers + PyTorch
Model Details
- Model type: ViTForImageClassification
- Base model: google/vit-base-patch16-224-in21k
- Input preprocessing: ViTImageProcessor
- Classes: 5 boat image categories
- Format: Safetensors (optimized for inference)
License
This model is released under the Apache 2.0 license.
- Downloads last month
- 6