Finetuned ResNet Model for Park Image Classification
Overview
This model is a finetuned ResNet model that has been trained on images from a local park in Pleasanton.
Dataset
The training dataset consists of two classes: "Sierra Redwood" and "Coastal Redwood". The dataset contains images captured within the park in Pleasanton.
Model Architecture
The model architecture used for this classification task is ResNet-50.
Usage
To use this model, you can follow these steps:
- Install the required dependencies, including PyTorch and torchvision.
- Download the model file "resnet_park_redwood_finetuned.tar.gz" from the provided link.
- Load the model using the
torch.load
function and extract the model weights. - Prepare your input image by resizing it to 224x224 pixels and applying the necessary transformations (e.g., normalization).
- Pass the preprocessed image through the model to obtain the predicted class probabilities.
- Optionally, apply softmax to the predicted probabilities to obtain normalized scores.
- The model will output the predicted label (Sierra Redwood or Coastal Redwood) along with the corresponding probability scores.
Example Code
Here's an example code snippet for using the finetuned ResNet model:
from transformers import AutoModelForImageClassification, AutoImagePipeline
model_name = "resnet_c_s_redwood_finetuned"
image_path = "path/to/your/image.jpg"
# Load the pre-trained model
model = AutoModelForImageClassification.from_pretrained(model_name)
# Create an image classification pipeline
classifier = AutoImagePipeline(model=model, model_name=model_name)
# Perform image classification
result = classifier(image_path)
# Print the predicted label
predicted_label = result[0]['label']
print(predicted_label)
- Downloads last month
- 7
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.