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:

  1. acacia
  2. acer
  3. ash
  4. birch
  5. cedar
  6. ebony
  7. elm
  8. hickory
  9. mahogany
  10. maple
  11. oak
  12. pine
  13. poplar
  14. rosewood
  15. stained-red-oak
  16. 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
Safetensors
Model size
11.2M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for bsustersic/wood-identifier-resnet18

Finetuned
(70)
this model