Smart_Scan is a Flask web app for AI-assisted shelf/product scanning.
It detects objects from uploaded images, estimates quality/freshness, extracts OCR text for product scans, and exposes summary/history/trend APIs.
- YOLO-based object detection for
productandfruitmodes - Freshness scoring and shelf-gap summary metrics
- OCR extraction for product scans (EasyOCR)
- Annotated output image and confidence graph rendering
- Scan history + trends via SQLite-backed APIs
- Live alerts endpoint for latest scan
- Python + Flask
- PyTorch + Ultralytics YOLO
- EasyOCR + OpenCV + Pillow
- Matplotlib + NumPy
- SQLite
app.py- Flask app, inference pipeline, routesscan.py- scan-related helper logicdatabase.py- schema + history/trend accessalerts.py- alert evaluation rulesconfig.py- thresholds/model paths/shelf settingstemplates/- HTML templatesstatic/- CSS/assetstest_smoke.py- runtime smoke tests
Recommended Python: 3.12.x (
runtime.txtpinspython-3.12.5).
cd C:\github-all\Smart_Scan
py -3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txtpython app.pyThen open: http://127.0.0.1:5000/
With the server running in one terminal, run in another terminal:
.\.venv\Scripts\Activate.ps1
python test_smoke.pyExpected output includes:
PASS /api/historyPASS /api/trendsPASS /detectAll smoke tests passed.
GET /- main UIPOST /detect- run detection (imagefile +mode=product|fruit)GET /api/history- scan historyGET /api/trends- trend/aggregate dataGET /api/alerts/live- alerts for latest scanGET /image- last annotated image bufferGET /graph- last confidence graph buffer
Operational utility routes:
GET /favicon.icoreturns204GET /.well-known/appspecific/com.chrome.devtools.jsonreturns204
These are intentionally handled to keep development logs clean.
- First install can be slow due to large ML dependencies (
torch,ultralytics,easyocr). - CPU mode is supported; CUDA is used automatically if available.
- Model files (
*.pt,*.pkl) are loaded at startup from paths inconfig.py.