Digital pathology research toolkit
See how TB AFB candidate detection works
Use the simulated microscopy field below to see how a confidence threshold changes which candidate boxes are displayed.
Research use only. The demo uses simulated detections. Run the Python application locally to review your own images.
Try the detection demo
Set a confidence threshold and run the demo to see which simulated detections are retained.
Controls
Implementation workflow
How the repository processes images
The website mirrors the actual code paths without pretending that GitHub Pages can execute the server-side model.
Image / WSI loading
Raster images use OpenCV. Supported whole-slide formats use OpenSlide for level-aware access.
data/wsi_loader.pyTiling
Large slides are divided into bounded tiles so inference can run at manageable spatial and memory scales.
01_extract_tiles.pyCandidate detection
An AFB-trained YOLO checkpoint can score candidate bacilli. The local web app labels heuristic fallback explicitly.
models/yolo_detector.pyPost-processing
Detections are filtered by confidence, class, morphology, and overlap before being translated to slide coordinates.
inference/postprocessor.pyHuman review
Candidate boxes remain research outputs for expert review, annotation, correction, and downstream validation.
static/annotate.htmlArchitecture
Running the toolkit locally
GitHub Pages hosts this static demonstration because it is HTML, CSS, JavaScript, and Canvas only. The actual detection application stays local/server-side because it depends on PyTorch, Ultralytics, native OpenSlide libraries, model checkpoints, local files, and potentially very large WSIs.
See the repository README for installation and example commands.
Validation boundary
Candidate detection is not a TB diagnosis
The repository intentionally separates model-generated candidates from smear grading. Candidate counts are not automatically converted into a WHO/IUATLD grade. The grading utility is intended for confirmed microscopy counts with an appropriate examined-field protocol.
Local setup
Install the research toolkit
For annotation and training, install the local toolkit. To try a ready-to-run AFB checkpoint, visit the Pretrained AFB Detection Model.