Instructions to use bsustersic/wood-identifier-resnet18 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bsustersic/wood-identifier-resnet18 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="bsustersic/wood-identifier-resnet18") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("bsustersic/wood-identifier-resnet18") model = AutoModelForImageClassification.from_pretrained("bsustersic/wood-identifier-resnet18", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Wood Identifier ResNet-18
This is a fine-tuned ResNet-18 model for identifying wood species from images.
Model Description
- Base Model: microsoft/resnet-18
- Fine-tuned for: Wood species identification
- Number of classes: 16
- Library: transformers (HuggingFace)
- Architecture: ResNet-18
Wood Species Classes
The model can identify the following 16 wood species:
- acacia
- acer
- ash
- birch
- cedar
- ebony
- elm
- hickory
- mahogany
- maple
- oak
- pine
- poplar
- rosewood
- stained-red-oak
- walnut
Intended Use
This model is designed to identify wood species from images. It can be used via the HuggingFace Inference API or downloaded for local inference.
How to Use
Using the Inference API (Recommended)
import requests
from PIL import Image
import io
API_URL = "https://api-inference.huggingface.co/models/bsustersic/wood-identifier-resnet18"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
def identify_wood(image_path):
with open(image_path, "rb") as f:
data = f.read()
response = requests.post(API_URL, headers=headers, data=data)
return response.json()
# Example usage
predictions = identify_wood("wood_sample.jpg")
print(predictions)
Using Transformers Library
from transformers import AutoImageProcessor, AutoModelForImageClassification
from PIL import Image
processor = AutoImageProcessor.from_pretrained("bsustersic/wood-identifier-resnet18")
model = AutoModelForImageClassification.from_pretrained("bsustersic/wood-identifier-resnet18")
image = Image.open("wood_sample.jpg")
inputs = processor(image, return_tensors="pt")
outputs = model(**inputs)
predictions = outputs.logits.softmax(dim=1)
# Get top prediction
predicted_class = predictions.argmax().item()
confidence = predictions[0][predicted_class].item()
print(f"Predicted: {model.config.id2label[predicted_class]} ({confidence:.2%})")
Training Details
- Training Framework: Hugging Face Transformers
- Base Model: microsoft/resnet-18
- Fine-tuning Dataset: Custom wood species image dataset
- Image Size: 224x224 pixels
- Number of Training Images: ~1036 images across 16 species
Performance
This model achieves good accuracy on wood species identification tasks. Performance may vary depending on:
- Image quality and lighting conditions
- Wood surface finish (raw, stained, polished)
- Viewing angle and grain visibility
Limitations
- Model performance depends on image quality
- Best results with clear, well-lit images showing wood grain
- May struggle with heavily stained or painted wood
- Performance may vary on wood species not in the training set
Model Card Authors
bsustersic
Model Card Contact
For questions or issues, please open an issue on the model repository.
- Downloads last month
- 10
Model tree for bsustersic/wood-identifier-resnet18
Base model
microsoft/resnet-18