BananaVision — K-Means & MDP
Move from defect observation to structured sorting decisions.

Context
Plantations du Haut-Penja produces bananas for export, subject to strict quality requirements. On the packing line, every fruit must be inspected to decide whether it is accepted, downgraded or rejected.
However, this inspection is mainly visual: it depends on each operator's judgement, leading to variation between inspectors and inconsistent results. Yet a sorting error has a cost, whether a batch is rejected for export or compliant fruit is wrongly discarded. This academic AI project therefore explores how to structure this decision to make it more consistent, accounting for uncertainty and the consequences of each choice.
IMG-BANANA-01 · CONTEXT
BananaVision — context
Export bananas, strict quality standards.
Problem
How can fruit features and defect families be used to recommend a consistent sorting action, accounting for uncertainty and the cost of each decision?
Solution
Design of a decision-support pipeline combining perception, classification, clustering and sequential decision-making, to go from a fruit image to a sorting recommendation. Images are turned into features and analysed by classification and clustering modules; a decision model then evaluates the consequences of possible actions.
IMG-BANANA-02 · SOLUTION
BananaVision — solution
Diverging verdicts and costly errors.
Contribution
Team project. I developed two modules:
- K-Means, which groups observations by their features, without predefined labels, to reveal defect families. It is not a supervised classifier.
- The Markov Decision Process (MDP), which models sorting as a decision under uncertainty (states, actions, transition probabilities, rewards). I implemented its resolution with Value Iteration and Policy Iteration to derive a sorting policy.
Classification, interface and pipeline integration were handled by the rest of the team.
Features
- Images are preprocessed and their visual features extracted (team).
- Supervised classification is planned, with a Naive Bayes baseline and a CNN (team).
- K-Means groups observations into interpretable defect profiles.
- The MDP compares possible actions: accept, redirect or hold for manual inspection.
- Value Iteration and Policy Iteration each compute a policy, allowing the two methods to be compared.
- The project also analyses data bias and the social impact of automation.
Architecture
A fruit image is first converted into usable features. Classification indicates the likely defect type, while K-Means places the observation in a group of similar profiles. This information defines the fruit's state in the MDP. From the defined transitions and rewards, Value Iteration and Policy Iteration compute the most beneficial action for each state, which becomes the sorting recommendation.
IMG-BANANA-03 · ARCHITECTURE
BananaVision — overall architecture
Images are preprocessed (team).
Stack
Python, pandas, NumPy, scikit-learn.
To verify: exact module libraries. MobileNetV2 and EfficientNet-B0 are project-brief recommendations, not confirmed trained models.
Benefits
- Sorting decisions rely on an explicit model rather than individual judgement alone.
- Defect families emerge from the data, without prior labelling.
- The cost of each sorting error is built into the recommendation.
- The approach accounts for uncertainty and the human impact of automation.
Links
This case study distinguishes the overall project scope from my personal contribution. No undocumented result or metric is presented.