✨ PyTorch 2D CNN • 7 Flower Classes • 150×150 Spatial Architecture

Detect & Identify Flowers with Deep Learning

Upload or drag any flower image to classify between Daisy, Dandelion, Rose, Sunflower, Tulip, Bellflower, and Lotus with instant confidence scores and botanical profiles.

⚡ Quick Test With 1-Click Samples: Click any flower below to detect instantly
Loading sample flowers...

📸 Input Flower Photo

RGB 150×150 Normalization

Drag & drop your flower photo here

Supports JPG, PNG, WEBP, BMP up to 20MB

or press Ctrl + V to paste

🔬 Detection & Confidence

Ready
🌺

Awaiting Flower Photo

Upload your photo on the left or select any sample flower above to run the neural network.

📘 Architecture & Deployment Guide

How Users Can Run & Integrate Your Model

Your model is trained, validated, and ready for production. Here are the 4 ways users and developers can consume it:

🌐

1. Interactive Web App (Current)

Run this local web application. Anyone on your local network or Wi-Fi can open it in their browser and drag-and-drop photos.

# Start the web server py app.py # Or run with host 0.0.0.0 to share on local Wi-Fi
⚡

2. REST API for Web & Mobile Apps

Developers can send HTTP POST requests with any image to your FastAPI endpoint to get instant JSON predictions.

curl -X POST "http://localhost:8000/api/predict" \ -F "file=@my_flower.jpg"
🐍

3. Direct Python Import

Import your trained model into any Python script, data science notebook, or batch processing pipeline.

from model import predict_flower result = predict_flower("flower.jpg") print(result["top_flower"], result["confidence_pct"])
🚀

4. Free Cloud Hosting (Hugging Face)

Deploy your model for free to Hugging Face Spaces or Render so anyone in the world can use it via public URL.

# Launch the included Gradio interface py gradio_app.py # Push to Hugging Face Spaces for 24/7 public access

From NumPy MLP to PyTorch CNN: The Engineering Story

The project originated as ScratchNet, an MLP written in pure NumPy. While the MLP achieved 90% training accuracy, it flattened images into 67,500 1D vectors, losing all spatial geometry and dropping to 40% on real-world photos due to background color memorization.

Switching to this PyTorch Convolutional Neural Network solved the issue: 3 hierarchical convolutional blocks extract invariant edge and petal textures, while MaxPooling downsamples spatial dimensions (150 → 75 → 37 → 18). The model achieved a robust ~79% test accuracy across 2,240 test images on the 7 flower classes.

7 Flower Classes
150×150 RGB Resolution
~79% Test Accuracy
21.6 MB Model Weights