--- library_name: pytorch tags: - image-classification - pytorch - efficientnet - flowers - computer-vision - oxford-flowers-102 - vision pipeline_tag: image-classification datasets: - dpdl-benchmark/oxford_flowers102 license: mit metrics: - accuracy base_model: efficientnet language: - en --- # ๐ŸŒธ Flower Classification Model ## ๐Ÿ“Š Model Info [![HF Model](https://img.shields.io/badge/๐Ÿค—-Model%20Hub-yellow)](https://huggingface.co/nailarais1/image-classifier-efficientnet) [![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![PyTorch](https://img.shields.io/badge/PyTorch-2.0+-red.svg)](https://pytorch.org) [![Downloads](https://img.shields.io/badge/Downloads-100+-blue)](https://huggingface.co/nailarais1/image-classifier-efficientnet) Model: nailarais1/image-classifier-efficientnet Author: Naila Rais Task: Image Classification ยท 102 Flower Species ## Quick Start ### Installation ```bash pip install torch torchvision pillow ``` ### Basic Usage ```python 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 ```python # 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