Free course · Lesson 5 of 5
A First Image Classifier
In this lesson you will
- Explain feature vectors
- Explain why local test photos matter
A classifier needs every image described by the same numbers, a feature vector. Simple features include a colour histogram (how much of each colour) and HOG (the directions of edges in small cells). A model such as a support vector machine learns which feature patterns go with which category.
- Train and test on different photos: keep near-identical shots of the same object together, or the test score will be too optimistic.
- Read the mistakes: a gallery of wrongly classified images often shows the cause at once, for example dark photos or cluttered backgrounds.
- Test on local photos: a model trained on public images taken elsewhere usually performs worse on local photos, so measure and report this separately.
Produce classifier (colour histogram + HOG, SVM) - illustrative results Test set Images Correct AccuracyPublic images (studio photos) 200 182 91%Local market photos (own photos) 60 41 68% Most local errors: shadows, several fruits in one photo, plastic bags.Next steps: capture rules (one item, shade, plain cloth behind it)and adding some local photos to training.
Practice exercise
Take five photos of the same fruit in different light and backgrounds, and write which photos a model trained on studio images might get wrong.
Key takeaways
- Classifiers learn from features such as colour and shape
- Always test on photos taken in local conditions
Free self-study lesson — no certificate. For the full instructor-led program, see registration options.