You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

🌸 Flower Classification Model

πŸ“Š Model Info

HF Model
License
PyTorch
Downloads

Model: nailarais1/image-classifier-efficientnet
Author: Naila Rais
Task: Image Classification Β· 102 Flower Species

Quick Start

Installation

pip install torch torchvision pillow

Basic Usage

import torch
import torchvision.transforms as transforms
from PIL import Image

# Load model
checkpoint = torch.load('best_model.pth', map_location='cpu')
model = ...  # Your model architecture
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()

# Predict flower
def predict_flower(image_path):
    transform = transforms.Compose([
        transforms.Resize(256),
        transforms.CenterCrop(224),
        transforms.ToTensor(),
        transforms.Normalize(mean=[0.485, 0.456, 0.406], 
                             std=[0.229, 0.224, 0.225])
    ])
    
    image = Image.open(image_path).convert('RGB')
    image_tensor = transform(image).unsqueeze(0)
    
    with torch.no_grad():
        outputs = model(image_tensor)
        _, predicted = torch.max(outputs, 1)
    
    return predicted.item()

# Get flower name
flower_id = predict_flower('your_flower.jpg')
flower_name = class_names[flower_id]  # Use class_config.json
print(f"Predicted: {flower_name}")

Model Info

  • What it does: Identifies 102 different flower species
  • Input: Flower images (224Γ—224 pixels)
  • Output: Flower name and confidence score
  • Architecture: EfficientNet
  • Training: 3 epochs on Oxford Flowers dataset

Example Results

  • 🌹 Input: rose_image.jpg β†’ Output: "rose" (98.2%)
  • 🌻 Input: sunflower.jpg β†’ Output: "sunflower" (95.7%)
  • 🌷 Input: tulip.jpg β†’ Output: "tulip" (92.3%)

Files Included

  • best_model.pth - Trained model weights
  • class_config.json - Flower names mapping
  • config.json - Model configuration
  • labels.txt - List of all flower names

Supported Flowers

102 species including:

  • 🌹 Rose
  • 🌻 Sunflower
  • 🌷 Tulip
  • 🌼 Daisy
  • πŸ’ Lily
  • 🏡️ Orchid
  • 🌺 Hibiscus
  • 🌸 Cherry Blossom
  • And 94 more...

For Developers

# Get top-5 predictions
def top_k_predictions(image_path, k=5):
    # ... (implementation)
    return [
        {"flower": "rose", "confidence": 0.98},
        {"flower": "tulip", "confidence": 0.01},
        # ...
    ]

License

MIT License - Free for personal and commercial use βœ…

Need Help?

  • Model not loading? Check PyTorch version
  • Wrong predictions? Use clear, centered flower images
  • Other issues? Open a discussion on this repo

Download and start classifying flowers today! 🌸

Model by Naila Rais Β· Hosted on Hugging Face

Downloads last month
15
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ 1 Ask for provider support

Dataset used to train nailarais1/image-classifier-efficientnet