`potato-disease`: The Tiny CNN That Starts With a Leaf and Ends With the Weather

A notebook-built potato disease detector does more than classify spots. It hints at a next step where humidity, temperature, rainfall, and leaf texture all matter.

7 min read • View on GitHub • More from P-SAI-LEKHYA

A potato leaf under a magnifying lens sits beside a weather station with gauges for humidity, temperature, and rainfall, and both streams feed into one analysis desk. The scene explains that this repo is not only about identifying visible disease, but also about linking symptoms to the conditions that may have caused them.
The project’s real leap is not the classifier alone. It is the idea that image recognition and weather context should eventually meet in the same tool.
Key Takeaways

The quiet upgrade: this repo is not just reading leaves

The interesting clue is not the classifier. It is the extra weather data. This repository pulls in weather.csv alongside leaf images, which changes the question from What disease is this? to Why is this disease showing up now?

That is a small shift in code and a big shift in intent. A leaf image can identify Early Blight, Late Blight, or Healthy tissue. Weather context suggests a tool that could eventually explain disease pressure, not just label a photo.

The repo’s current path is image-first. Its implied next step is a second branch that brings weather into the decision.

Inside the classifier: six convolutional layers for tiny visual differences

This is a standard Keras workflow, but it is not a toy model. The notebooks use ImageDataGenerator for rescaling and light augmentation, including flips and small rotations. That matters because plant images are rarely perfectly framed, and disease signals often survive only if the model learns to ignore orientation noise.

The architecture stacks six Conv2D layers, each followed by pooling, then a flattening stage, a dense hidden layer, and a three-way softmax output. That depth is a deliberate choice for a problem where the difference between classes can be a ring pattern, a lesion edge, or a texture change no larger than a fingertip.

model = Sequential([
    layers.InputLayer(input_shape=(256, 256, 3)),
    layers.Rescaling(1.0 / 255),
    layers.Conv2D(32, 3, activation='relu'),
    layers.MaxPooling2D(),
    layers.Conv2D(32, 3, activation='relu'),
    layers.MaxPooling2D(),
    layers.Conv2D(64, 3, activation='relu'),
    layers.MaxPooling2D(),
    layers.Conv2D(64, 3, activation='relu'),
    layers.MaxPooling2D(),
    layers.Conv2D(64, 3, activation='relu'),
    layers.MaxPooling2D(),
    layers.Conv2D(64, 3, activation='relu'),
    layers.MaxPooling2D(),
    layers.Flatten(),
    layers.Dense(64, activation='relu'),
    layers.Dense(3, activation='softmax')
])
StageWhat it seesWhy it matters
First conv blocksEdges, veins, coarse contrastThese layers learn the basic geometry of a leaf.
Middle conv blocksSpots, blotches, repeated texturesThese layers separate disease patterns from healthy tissue.
Final conv blocksLesion structure and local texture combinationsThese layers push the model toward a class decision.
Dense + softmaxCompressed featuresThese layers turn visual evidence into one of three labels.
A leaf cross-section is shown as a layered visual stack, moving from edges and veins to spots and clustered texture, then ending in three output labels. The composition explains how convolutional layers progressively turn raw pixels into disease classification.
The model is not looking for one magic symptom. It is compressing small visual clues into a class decision.

Why the dataset structure matters more than it looks

The folder layout tells you a lot about the project’s maturity. There are separate train, test, and val directories, plus an Aug/ folder for expanded samples. That is the shape of a serious experiment, even if the code still lives mostly in notebooks.

It also suggests a practical mindset. The builder is not inventing a custom data pipeline from scratch. They are using a standard image classification workflow, which is exactly what you want when the real challenge is not infrastructure but signal quality.

Project shapeData handlingWhat it implies
Notebook-first repoTraining and evaluation live in Jupyter notebooksFast to iterate, easy to inspect, hard to package.
Structured dataset foldersTrain, validation, and test splits are explicitThe workflow is methodical, not improvised.
Offline augmentation folderExtra samples are prebuilt and storedThe project cares about robustness, but still feels experimental.
Simple inference pathA basic API layer exists alongside trainingThis is already more than a class demo, but not yet a product.

What this repo gets right, and what it is still missing

The strongest thing here is focus. This repo takes a single disease-detection problem and follows it through data preparation, augmentation, training, and a path to inference. That makes it easy to study and easy to extend.

The gaps are just as informative. The project has default notebook names, little modular structure, no polished product layer, and no strong public-facing documentation. That does not make it weak. It makes it legible as an early prototype.

AreaWhat existsWhat is missing
ModelingA real CNN with augmentation and a three-class outputNothing major in core approach.
PackagingTraining logic and inference plumbing are presentNo clear module boundary or clean app structure.
DocumentationEnough code to inspect the workflowNo mature README or developer guide.
Project polishFunctional and reproducible in notebook formNot yet ready to feel like a durable library or product.

How it compares to the usual potato CNN demo

Most tutorial repos stop at classification. They show that a CNN can separate healthy from diseased leaves, then leave it there. This repo goes a little further by pairing the image workflow with weather data and a simple API path.

That puts it in an interesting middle. It is smaller than a production agronomy platform, but more ambitious than a throwaway notebook. The project is useful because it shows the full shape of the problem without hiding behind scale.

Dimension`potato-disease`Typical tutorial CNN repoProduction agronomy platform
PurposeSingle-crop disease detection with a hint of contextDemonstrate image classificationSupport field decisions at scale
Model complexityCustom multi-layer CNNShallow or standard CNNOften ensembles or heavily tuned models
Data sourcesLeaf images plus weather.csvLeaf images onlyMulti-source, often proprietary
DeploymentNotebook training plus simple API pathUsually no deploymentMobile, cloud, or edge workflows
Decision scopeWhat disease is visible, and maybe whyWhat class is in the imageWhat action should a grower take

The larger lesson: precision agriculture starts as a notebook

This repo is small, but it points at a real pattern. Open datasets, standard CNNs, and lightweight APIs let one developer build the first version of a tool that feels much bigger than the codebase.

That is how a lot of useful software starts. Not with a platform, but with a notebook that asks a better question than the obvious one. Here, the better question is not just what the leaf looks like. It is what the weather made possible.