DEV Community

Cover image for How I built AI food recognition that actually understands Indian meals (katoris, thalis and all)
Akhil Babu
Akhil Babu

Posted on

How I built AI food recognition that actually understands Indian meals (katoris, thalis and all)

Every calorie-tracking app I tried gave up on the same thing: a thali.

Five items on one steel plate — rice, dal, a sabzi, sambar, two chutneys — no barcode, no packaging, and portions measured in katoris, not grams. I'd spend two minutes searching a database for "sambar," get three wrong matches, and give up. So I built CalStepAI to solve exactly that. Here's what the hard parts actually were.

Why the existing databases break

Most trackers are built on two assumptions: Western foods, and barcodes. Both fall apart here.

  • "Dal" is not one number. It's toor dal, it's a thin varan, it's a thick dal fry with a tadka of ghee — a 2x calorie spread depending on preparation you can't see.
  • "1 cup" means nothing to someone who serves in katoris. Ask an Indian user to log "0.75 cups of sambar" and you've already lost them.
  • Vision models hallucinate the wrong cuisine. Raw image models love to label a dosa a "crepe" and chutney a "sauce." Technically close. Nutritionally useless.

The real problem: estimation under uncertainty

Here's the thing nobody wants to admit — you never know the exact quantity from a photo. You can't. Pretending otherwise is how you get confidently-wrong numbers that erode trust the first time a user checks.

So the whole engine is built around handling uncertainty honestly instead of faking precision. Four rules:

1. User text beats vision output. If the photo pipeline says ["crepe", "sauce"] but the user typed "2 dosa with chutney," the text wins. Vision is a prior, not the answer.

2. Map generic labels to culturally correct foods.

"crepe"  → dosa
"stew"   → could be curry / dal / sambar  (needs context)
"flatbread" → roti / naan / paratha        (ask, don't guess)
ðŸ”ī Hot News: akhil babu /how i built ai food recognition that actually understands indian meals katoris thalis and all jj - āļŠāļĢāļļāļ›āļ”āļĢāļēāļĄāđˆāļēāļĨāđˆāļēāļŠāļļāļ” ðŸ”ī Hot News: akhil babu /how i built ai food recognition that actually understands indian meals katoris thalis and all jj - āļŠāļĢāļļāļ›āļ”āļĢāļēāļĄāđˆāļēāļĨāđˆāļēāļŠāļļāļ”

3. Default to realistic servings, and say so. No quantity given? Assume one medium serving, count-based where possible ("2 dosa"), and surface the assumption to the user instead of burying it.

4. Never hallucinate precision. Low confidence gets labeled as low confidence — "estimated based on a typical serving" — not dressed up as 247 kcal.

Multi-item meals: decompose, don't blob

The thali only works if you estimate each component separately and sum them. One lumped "meal: ~800 kcal" guess is useless for coaching. The output is structured per item:

{
  "items": [
    { "name": "dosa", "quantity": "2 medium", "calories": 240,
      "protein": 6, "carbs": 40, "fat": 8, "confidence": "medium" },
    { "name": "coconut chutney", "quantity": "2 tbsp", "calories": 90,
      "protein": 1, "carbs": 3, "fat": 8, "confidence": "low" }
  ],
  "total": { "calories": 330, "protein": 7, "carbs": 43, "fat": 16 },
  "assumptions": ["Assumed medium dosa", "Standard coconut chutney portion"]
}
ðŸ”ī Hot News: akhil babu /how i built ai food recognition that actually understands indian meals katoris thalis and all jj - āļŠāļĢāļļāļ›āļ”āļĢāļēāļĄāđˆāļēāļĨāđˆāļēāļŠāļļāļ” ðŸ”ī Hot News: akhil babu /how i built ai food recognition that actually understands indian meals katoris thalis and all jj - āļŠāļĢāļļāļ›āļ”āļĢāļēāļĄāđˆāļēāļĨāđˆāļēāļŠāļļāļ”

Portions map to units people actually use — katori, bowl, piece, grams — so the number on screen is one they can sanity-check against their own plate.

Calories aren't enough — the coaching layer

A number isn't a product. The part that made people stick was turning each meal into one or two actionable suggestions, not a generic "high calorie" label.

Bad: "High calorie meal."
Good: "This meal is carb-heavy and low in protein. Adding eggs, paneer, or curd would balance it."

That's driven by the user's goal (fat loss / muscle gain / maintenance), what they've already eaten today, and the time of day.

The stack, briefly

  • App: Capacitor + React + Vite (one codebase, native iOS shell)
  • Recognition: a vision + LLM pipeline that outputs the structured JSON above, with the user's text input folded in as the strongest signal
  • Steps: Apple HealthKit sync
  • Also in the app: water tracking, streaks, and "Kalo," the coaching layer

What I'd still change

I'm not going to pretend it's solved:

  • Packaged foods should hit a barcode → USDA FoodData Central lookup instead of guessing. That's next.
  • Cuisine detection as an explicit field would cut the "crepe vs dosa" errors earlier in the pipeline.
  • It still gets fried-vs-steamed wrong sometimes, which is a real calorie swing. Cooking method is the hardest thing to read from a single photo.

Disclosure

I built CalStepAI — it's live on iOS, free with an optional Pro plan. If you want to see the thali case in action: calstepai.com · App Store.

Happy to answer anything about the estimation approach in the comments — the uncertainty-handling is the part I find most interesting, and I'm sure there are failure modes I haven't hit yet.

Top comments (0)