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.

8 min read • View on GitHub • More from 868Rahul

A wide editorial scene shows two desks facing each other across a white expanse. One desk is a Node.js control station with upload files, a database ledger, and routing notes; the other is a Flask inference station with a dental scan, bounding boxes, and annotation tools. A taut physical thread connects the two, showing the request handoff between workflow and model.
The repo’s main idea is not the model alone. It is the handoff between orchestration and inference, with evidence preserved at every step.
Key Takeaways

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

Rahul Singh, Project Author/Maintainer · 868Rahul/AI-Based-Oral-Health-Analysis-System-YOLOv8-

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.

A close-up process illustration shows a dental scan moving through stamped stages from upload to proxy to inference to annotation to persistence. Each stage adds structure, ending in a record card that contains a label, confidence score, and bounding box coordinates. The image explains how the system converts visual analysis into an auditable medical record.
The pipeline does more than detect disease. It turns a prediction into a durable record that can be stored, inspected, and re-rendered.

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 whole system is easier to understand as a handoff chain than as a single app. Each stage owns one responsibility, and even failures become records.

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.

ApproachWhat it optimizes forWhat it losesWhy this repo is stronger as a template
Monolithic ML demoSimplicitySeparation of concerns and resilienceHard to extend beyond a proof of concept
Flask-only prototypeFast model integrationClear ownership boundaries and web app structureWorks, but grows messy as auth and history expand
Commercial dental AIClinical maturity and complianceOpen inspection and modificationGreat product, poor blueprint for builders
This repoWorkflow clarity and auditable recordsClinical validation and deployment hardeningBest 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.