How t-k-234/eyedis-using-ensemle-learning works
What this project is (type + purpose)
This repo is a Flask-based web application that:
• Serves HTML pages (Jinja templates in templates/, assets in static/)
• Accepts file uploads (retinal images and/or PDFs) into uploads/
• Runs ML inference using pre-trained model artifacts (main_model.h5, model_eye.h5) to classify eye disease
• Produces a human-readable summary/report and stores outputs in summaries/
• Uses a local SQLite database (users.db, db.py) for user/auth or basic persistence
The README describes an ensemble (CNN/ResNet/Swin) trained with PyTorch/TensorFlow; the repo structure indicates that training is mostly offline (e.g., pytorch_resnet18.ipynb), while the deployed web app loads ready-to-serve model files (.h5) for runtime inference.
• Runtime web system (Flask + DB + inference + storage)
• Offline ML training pipeline (notebook → model artifacts → deployed to app)
File tree to architectural building blocks
Use the tree to drive the decomposition into as many components as possible (don’t overthink—split by responsibility):
Runtime / Serving
• Web Server / App
• app.py → Flask routes, request handling, page rendering, upload endpoints, inference trigger
• Database Layer
• db.py + users.db → SQLite access, likely users/login/register state
• Model Artifacts
• main_model.h5, model_eye.h5 → TensorFlow/Keras models loaded by the Flask app at startup or per request
• HTML Views (UI)
• templates/*.html → pages like login/register/home, disease detection pages (dect.html, indexeye.html), summarization page (sum.html)
• Static Assets
• static/css/*, static/js/*, static/img/* → styling and client-side behavior
• File Storage
• uploads/* → raw user uploaded files
• summaries/* → generated summaries / result PDFs
Offline / Training (should be shown as separate “pipeline”)
• pytorch_resnet18.ipynb → training/experiments; produces a model that is eventually exported/converted to deployment format (represented as .h5 in this repo)
Flask Web App (Python)
• Route/controller layer (in app.py)
• Template rendering (Jinja + templates/)
Auth/User Data Store
• SQLite (users.db) accessed via db.py
ML Inference Subsystem
• Model loader (loads .h5)
• Preprocessing (OpenCV/NumPy; implied by README)
• Predictor (classification)
• Post-processing (label mapping, confidence)
Report/Summary Generator
• Generates short text explanation
• Writes output artifact(s) into summaries/
File Storage
• Upload directory (uploads/) for inputs
• Summaries directory (summaries/) for outputs
Optional but accurate to include (since it’s in repo/README):
Offline Training Environment
• Notebook (pytorch_resnet18.ipynb) + dataset (external Kaggle)
• Outputs: trained weights → exported .h5 → copied into runtime
(1) Authentication flow
• Browser → Flask: GET /login, POST /login, GET/POST /register
• Flask ↔ SQLite: create user / validate credentials
• Flask → Browser: rendered HTML (templates/login.html, templates/register.html)
(2) Inference flow (retinal image classification)
• Browser → Flask: POST upload retinal image (multipart form)
• Flask → File Storage: write file to uploads/
• Flask → ML Inference: preprocess image → run model(s) (main_model.h5 / model_eye.h5)
• ML Inference → Flask: predicted class (+ optional probabilities)
• Flask → Report/Summary Generator: build explanation text (disease info)
• Report/Summary Generator → File Storage: write summary artifact to summaries/
• Flask → Browser: render results page (templates/dect.html / templates/sum.html / templates/indexeye.html depending on routing)
(3) Static content flow
• Browser → Flask (or direct static serving): static/css, static/js
(4) Offline training → deployment flow
• Kaggle Dataset → Training Notebook (pytorch_resnet18.ipynb)
• Notebook → Model Artifact(s): exported weights (represented as .h5 files here)
• Model Artifact(s) → Flask runtime: loaded at startup for inference
Architectural patterns to highlight (specific to this repo)
• Monolithic Flask app: all runtime logic (routing + inference + summary + persistence) is in one deployable unit (app.py + local assets)
• Server-side rendered UI: Jinja templates, not a SPA
• Local persistence: SQLite file DB (users.db)
• File-system backed object storage: uploads and summaries stored on disk (uploads/, summaries/)
• ML inference as an internal library/module: not separated into a microservice (so show it as a component inside the Flask container)
Concrete labeling based on THIS repository (use these names)
• “Flask App (app.py)"
• “DB Access Layer (db.py)"
• “SQLite DB (users.db)"
• “Templates (templates/*.html)"
• “Static Assets (static/)"
• “Uploaded Inputs (uploads/)"
• “Generated Summaries (summaries/)"
• “Model Artifacts (main_model.h5, model_eye.h5)"
• “Training Notebook (pytorch_resnet18.ipynb)" + “External Dataset (Kaggle)”