BarbaricDev
Upload image
JPG, PNG, WebP — max 10 MB
AI Demo

Fruit Recognition AI

A Convolutional Neural Network trained to classify images into 35 fruit and vegetable categories. Upload any image and see what the model thinks it is.

Upload an image
Choose or drag in a photo of a fruit or vegetable. JPG, PNG, and WebP are supported.
Click to upload or drag and drop
JPG, PNG, WebP — max 10 MB
Preview

Example predictions on 16 different fruit and vegetable images
Example predictions on 16 test images — red labels indicate a misclassification.

About this model

This model is a custom Convolutional Neural Network (CNN) built with PyTorch, trained from scratch on a labelled dataset of fruit and vegetable images. It can classify images into 35 categories spanning common fruits, vegetables, and root crops.

Architecture

The network uses a BiggerVGG design — four stacked convolutional blocks (each with two Conv2d + ReLU layers followed by MaxPool2d), ending in a fully-connected classifier. The input images are resized to 224×224 pixels and normalised to [0, 1] before being fed into the network.

Training

The model was trained using the Adam optimiser with a learning rate of 0.001 and cross-entropy loss. TrivialAugmentWide augmentation was applied during training to improve generalisation. The model achieved 84% accuracy on the held-out test split.

Limitations

The training set is relatively small — around 70 images per category — so performance on unusual or ambiguous specimens may be lower than a large-scale model. The source dataset was also not heavily cleaned: it contains cartoon and illustrated images for some categories, which can confuse the model when those training examples conflict with real photographs. The model is also constrained to its 35 categories: any input image will always be mapped to one of them, regardless of whether the subject actually belongs there. The confidence scores are raw softmax outputs and can be overconfident — treat a low top-1 score as a sign the input may be outside the model’s known categories.

Supported categories

Apple Banana Beetroot Bell Pepper Cabbage Capsicum Carrot Cauliflower Chilli Pepper Corn Cucumber Eggplant Garlic Ginger Grapes Jalepeno Kiwi Lemon Lettuce Mango Onion Orange Paprika Pear Peas Pineapple Pomegranate Potato Raddish Soy Beans Spinach Sweetcorn Sweetpotato Tomato Turnip