Back to the console

Flower Image Classifier

CourseApplied AI, MapĂșa UniversityDataKaggle Flowers, 5 classesMy roleBuilt the notebook from data checks to recommendationToolsPyTorch, torchvision, Google Colab

Two pretrained image models were fine-tuned on 2,744 flower photos. I recommended MobileNetV3 at 92.72% test accuracy on a Colab T4 GPU, because it is 5.5x smaller and faster per image than ResNet50 at 91.99%.

The question

Two well-known models can both tell flowers apart. The question was which one should power a lightweight flower identification feature that may run on a CPU or a phone.

Cleaning the data first

Every image was checked and none was unreadable. Three groups of exact duplicates turned up, and one pair was the same picture filed under both rose and tulip, so those two were removed, leaving 2,744 usable images. The dataset's own test folder has no labels, so a test set was made from the labeled images.

Keeping the comparison fair

Results on a Colab T4 GPU

ResNet50 against MobileNetV3 Large
MeasureResNet50MobileNetV3 Large
Test accuracy91.99%92.72%
Test errors, of 4123330
Parameters23.5 M4.2 M
Saved model size94.4 MB17.0 MB
Time per image, batch of 323.38 ms0.74 ms
Training time, 3 epochs61.9 s46.1 s
Test confusion matrices for ResNet50 and MobileNetV3 Large
Test confusion matrices for both models.

The accuracy gap is about 3 images out of 412, which is within normal variation for one split, so it was not treated as a real win. The decision came from size and speed. Both models confuse tulips and roses most.

Knowing when to ask a person

The inference function returns the prediction, confidence, top guesses, and a review flag. Images go to human review when confidence is under 0.80. On validation data that threshold caught 38 of the model's 41 mistakes.

Limits

Only the final layer was trained for 3 epochs, the photos come from public web sources, and timing was measured on one GPU runtime, so it only shows the relative speed.

Next reportChallengeHub Activity Tracker