Inspiration

What it does

How we built it

Challenges we ran into

Accomplishments that we're proud of

What we learned

What's next for MandiLens

Inspiration

Tomato grading at a mandi is done by eye, and two people can grade the same tray differently. I wanted a repeatable first pass from a phone photo, with a person kept in the loop when the call is shaky.

What it does

Photograph a tray of tomatoes next to a printed 50 mm marker. OpenCV 5 measures each fruit and grades it A, B or C from diameter, ripeness and defects. An agent then decides what to do: fix the photo, ask for a retake, send a fruit to a person for review, or route the lot. The grades are house bands, not an AGMARK certificate.

How we built it

Python 3.12 with OpenCV 5 for the pipeline stages, and a FastAPI app with a small web UI. The agent loop has a rule planner and a Bedrock planner that call the same tools. For deployment there is a SAM template with API Gateway, four arm64 Lambda functions, an OpenCV 5 layer, a private S3 bucket that expires uploads after 7 days, and DynamoDB. Bedrock is wired but off until the account can call Nova Lite. The template validates, but nothing is deployed and the local demo needs no credentials.

Challenges

Millimetres from a photo depend on the marker, so the print size matters: the black square is 50 mm and the quiet zone is not counted. Bad photos were the other problem. Soft focus, dark shots, a missing marker, a red tray and cut off fruit all needed their own handling, and the agent has to change its mind for each.

Accomplishments that we're proud of

The agent visibly changes its decision across the bundled bad samples, and every step shows up in a trace on the grade slip. Tests paint trays with a known marker and known fruit and run the same pipeline the API uses.

What we learned

Measure first, then let the agent reason about whether to trust the measurement. Painted test trays made the pipeline much easier to check, though those eval numbers come from the painted set, not from a real mandi.

What's next

Test on real mandi photos, deploy the stack to AWS, turn on the Bedrock planner, and tune the grade bands with people who grade tomatoes for a living.

Built With

Share this project:

Updates

Submission history