A web-based African food recognition and calorie estimation system. Upload a meal photo and get instant nutritional breakdown. Built with React + TypeScript (frontend), Django REST Framework (backend), and a custom-trained TFLite model for Nigerian/African cuisine recognition.
# CalVision - Food Recognition & Calorie Estimation
CalVision is a full-stack app for logging meals from photos. Users can upload a
meal image, receive Nigerian-food segmentation/classification with estimated
calories/macros, and save the result to their meal history.
## Quick Start (Docker)
```bash
# 1. Clone the project
git clone && cd calvision
# 2. Copy env file and add your USDA key if you have one
cp backend/.env.example backend/.env
# 3. Start everything
docker-compose up --build
# Frontend ->
localhost
# Backend ->
localhost
# Admin ->
localhost
```
## Manual Setup
### Backend
```bash
cd backend
python -m venv venv && source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # Edit with your values.
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
```
### Frontend
```bash
cd frontend
npm install
echo "VITE_API_URL=
localhost" > .env
npm run dev -- --port 3000
```
## USDA API Key
Get a free key at:
api.nal.usda.gov
Add it to `backend/.env` as `USDA_API_KEY=your_key`
## Environment Variables
| Variable | Description |
|----------|-------------|
| `SECRET_KEY` | Django secret key |
| `DEBUG` | True for development |
| `DATABASE_URL` | Database URL. Defaults to local SQLite if omitted. |
| `USDA_API_KEY` | USDA FoodData Central API key |
| `ALLOWED_HOSTS` | Comma-separated Django host allowlist |
| `CORS_ALLOWED_ORIGINS` | Comma-separated frontend origins allowed by the API |
Frontend variables:
| Variable | Description |
|----------|-------------|
| `VITE_API_URL` | Backend API origin, for example `
localhost` |
## AI Pipeline
CalVision uses a YOLO instance segmentation model first. It detects visible
food regions, returns bounding boxes and segmentation masks, and the backend
draws the colored AI output overlay shown on the results page.
The tr …