image classification

Practical Python for automating four real-world image decisions

Jev doesn't just look at images, he makes decisions about them.

3 min readTowards Data Science

The most useful thing about Jev's four Python examples is that none of them require a large language model. Fabric classification against a reference photo, product sharpness scoring, shipping-label cropping, and subtle car-damage detection all run on classical computer vision logic. That is a deliberate choice, and it matters. For readers who have been told that every image problem needs a vision model, Why Simple Keyword Search Still Beats AI Models for Agent Tool Selection makes the same point in a different domain: simpler methods often outperform expensive ones when the task is well-defined. Jev's code proves it with pixels instead of text.

The fabric-classification script compares color histograms. The sharpness scorer measures edge contrast. The label cropper finds contours. The damage detector looks for differences in luminance gradients. Each approach is a direct mapping from a visual problem to a handful of OpenCV functions. There is no training data, no GPU, no API call. That is the takeaway: for a huge swath of real-world image decisions, the right algorithm is the one that matches the geometry of the problem, not the one with the most parameters. If you are building an agent that needs to decide whether a product photo is usable or a shipping label is readable, you can solve it with seventy lines of Python and a local machine. The same philosophy drives the open-source decision models that run locally and empower your AI agents we covered recently. Small, transparent, and deterministic beats large and opaque when the question is "is this blurry?" or "does this match the reference?"

What this means for anyone managing image workflows is a shift in how to think about automation. The instinct is often to reach for the biggest tool in the box. Jev's examples suggest a better instinct: start with the simplest reliable method, test it against your actual data, and only escalate to a model when the simple method fails. The car-damage example is especially telling. Spotting a subtle scratch on a used car is a task where many teams would default to a fine-tuned vision transformer. Jev's approach uses background subtraction and edge density. It works because the problem is framed correctly: a scratch is a local anomaly in an otherwise uniform surface, and that is exactly what edge detection measures. The same principle applies to validating AI output locally with Ollama, Gemma 4, and Nimble, where a small local model catches errors that a large cloud model would happily produce. The pattern is consistent: put the simplest reliable check first.

One question lingers. Jev's code is practical and reproducible, but it assumes the user knows how to tune thresholds. A fabric match that works in daylight may fail under tungsten light. A sharpness threshold that passes product photos may reject book scans. The open question is whether these four examples can be packaged into a reusable library with sensible defaults, or whether each deployment will require manual calibration. That is the next step for anyone who wants to turn this approach from a demo into a daily workflow.

From Towards Data Science

Practical code for classifying fabric against reference photos, scoring product sharpness, cropping shipping labels, and spotting subtle car damage.

The post How Jev Makes Decisions About Images, With 4 Python Examples appeared first on Towards Data Science.

Read the original at Towards Data Science