colab notebook ยท ready to run
Flower Classifier Lab
A complete, GPU-ready notebook that teaches a MobileNetV2 to tell five flowers apart โ then grades itself and judges your photos.
- ๐ผ daisy
- ๐พ dandelion
- ๐น rose
- ๐ป sunflower
- ๐ท tulip
Grab the notebook
โฌ flower_classification_mobilenetv2.ipynbThen: open colab.research.google.com โ File โ Upload notebook โ pick the file โ Runtime โ Change runtime type โ GPU โ Run all. The Kaggle dataset downloads itself via kagglehub โ no API key, no kaggle.json.
What's inside
- Dataset download, zero setup
kagglehub.dataset_download("alxmamaev/flowers-recognition")โ 4.3k photos, plus a robust finder for the archive's nested folders and a per-class image census. - Sample gallery3ร5 grid of random specimens so you see the data before you trust it.
- tf.data pipeline80/20 split, 224ร224, batches of 32, cached + prefetched. Validation kept unshuffled so the confusion matrix doesn't lie.
- Data augmentation โ visualizedRandom flip / rotation / zoom / translation / contrast as in-model layers, with one flower shown eight augmented ways.
- Transfer learningFrozen ImageNet MobileNetV2 + GlobalAveragePooling + Dropout + softmax head.
preprocess_inputlives inside the graph, so the saved model eats raw pixels. - Head trainingAdam 1e-3, EarlyStopping + ReduceLROnPlateau, ~10 epochs.
- Fine-tuningTop ~55 backbone layers unfrozen at Adam 1e-5 โ the classic two-phase recipe, with the phase boundary marked on the curves.
- EvaluationJoined accuracy/loss curves, sklearn classification report, annotated confusion matrix, and a "most confident mistakes" gallery.
- Your own photo
files.upload()cell โ drop in any flower picture, get top-3 probabilities. - ExportSaves
.keras+ quantized.tflite(~3 MB โ MobileNet back in its natural habitat).
๐ฑ Expect ~90%+ validation accuracy after fine-tuning. The notebook ends with ideas to push further โ EfficientNetV2, class weights, Grad-CAM. No accounts, no keys, no tracking: the notebook is yours.