AI-Based-Oral-Health-Analysis-System-YOLOv8-: AI-Based Oral Health Analysis System: The Split-Brain Architecture That Turns YOLOv8 Into a Dental Workflow
A Node.js orchestrator, a Flask inference engine, and structured prediction records combine into a surprisingly disciplined blueprint for accessible medical imaging.
- The repo’s most important design decision is the split between Node.js orchestration and Flask inference, because that turns a model demo into a workflow system.
- Its real product idea is structured evidence, not a flat diagnosis string, because it stores labels, confidence, bounding boxes, and even failures.
- Manual OpenCV annotation gives the output a domain-specific visual language that makes the result easier to trust and reuse.
- The project is best read as a template for image-based diagnostic systems, not as a finished clinical product.
This repository does something many ML demos do not. It treats inference as one step in a larger clinical workflow, not the whole product. The model is YOLOv8, but the story is the plumbing around it: upload, route, annotate, persist, recover.
That matters because medical AI lives or dies on traceability. A result without coordinates, confidence, and failure history is hard to audit. This repo keeps all three.
Why this is not just a dental AI demo
The project is split across three layers: a React frontend, a Node.js backend, and a Flask inference service. That separation is the core insight. Node handles users, history, and request routing. Flask does one job well: load the model and run inference quickly.
AI Based Oral Health Analysis System
A monolithic prototype would have been easier to sketch, but harder to trust. Here, the split is not accidental plumbing. It is the product shape.
How a prediction becomes a clinical record
The upload path starts in the browser with drag-and-drop, then moves through Multer in Node, then across to Flask with the image payload. Flask loads YOLOv8 once at startup, which keeps subsequent requests lighter. After inference, the service returns structured detections and an annotated filename.
The model output is not flattened into a vague result string. The controller calculates top confidence, saves the detection schema, and stores bounding boxes in MongoDB. That gives the frontend room to re-render the same evidence later without asking the model to run again.
Why the annotations matter more than they look
The annotation code in flask_api/app.py is a small but telling choice. Instead of relying on YOLO’s default saved output, the repo draws boxes manually with a custom color map. Cancer is one color. Gingivitis is another. That is not decoration. It is a visual vocabulary.
In medical UI, consistent color coding does real work. It helps users scan the output faster, and it makes the system feel domain-specific rather than generic. The model may be general-purpose object detection. The presentation is not.
COLOR_MAP = {
'Cancer': (0, 0, 255),
'Calculus': (255, 255, 0),
'Caries': (0, 255, 0),
'Gingivitis': (255, 0, 255),
'Ulcers': (0, 165, 255)
}
for box in result.boxes:
cls = int(box.cls[0])
label = model.names[cls]
color = COLOR_MAP.get(label, (255, 255, 255))
# draw bbox and label manually
Failure is part of the record
The most production-shaped detail in the repo is how it handles service failure. If Flask is unavailable, the Node backend catches ECONNREFUSED and saves a failed prediction state. That is a quiet but important move. It turns downtime into an observable event instead of a silent dead end.
This is where the project stops looking like a student demo and starts looking like a system designed by someone who has seen things break. In a workflow like this, failure is not an exception to the product. It is part of the product history.
| Approach | What it optimizes for | What it loses | Why this repo is stronger as a template |
|---|---|---|---|
| Monolithic ML demo | Simplicity | Separation of concerns and resilience | Hard to extend beyond a proof of concept |
| Flask-only prototype | Fast model integration | Clear ownership boundaries and web app structure | Works, but grows messy as auth and history expand |
| Commercial dental AI | Clinical maturity and compliance | Open inspection and modification | Great product, poor blueprint for builders |
| This repo | Workflow clarity and auditable records | Clinical validation and deployment hardening | Best as a reference architecture for the next system |
What this repo gets right compared with other approaches
Compared with generic YOLO dental projects, this one adds operational structure. Compared with commercial dental AI, it is open, inspectable, and easy to modify. Compared with a pure Flask proof of concept, it draws a clearer line between the web product and the model service.
That makes it especially useful as a template. The repo is not trying to be the final word in dental diagnostics. It is showing how to build the first serious version of the pipeline.
What the repo is really good for
If you are building any image-based diagnostic tool, the value here is architectural, not just medical. Keep the web layer separate from the model. Store structured detections, not summaries. Save failures. Expose enough evidence that a human can inspect the output without re-running inference.
That is the real lesson. The repo uses familiar open-source pieces, but it combines them with unusual discipline. The result is a narrow system that feels broader than its subject.