How arunima072004/explainable-cnn-vit-model-for-brain-tumour-detection works
This is a full-stack brain MRI analysis application. A user uploads a scan and selects a masking threshold; the React upload page sends it to Flask, whose inference pipeline detects a tumour with ViT, localizes it, classifies the region with ResNet-50, and produces explainability images. Results are displayed in the UI and can be submitted for PDF generation. The graph reflects the documented pipeline and shown calls; unsampled frontend and report internals are represented at their documented subsystem level.
Main entry points: ResultsPage.jsx Results view · utils.py Image decoding and transforms · app.py Flask API · UploadPage.jsx MRI upload
Components 15
Web interface
- MRI upload
frontend/src/pages/UploadPage.jsx - UI state and routing
frontend/src/App.jsx - Results view
frontend/src/pages/ResultsPage.jsx - Image viewer
frontend/src/components/ImageViewer.jsx - Confidence display
frontend/src/components/ConfidenceBar.jsx - Tumour type badge
frontend/src/components/TumorTypeBadge.jsx
API and orchestration
- Flask API
backend/app.py
MRI analysis
- Image decoding and transforms
backend/utils.py - ViT detection
backend/model.py - Attention localization
backend/utils.py - ResNet classification
backend/model.py - Grad-CAM and masks
backend/utils.py
Reporting
- PDF endpoint
backend/app.py - PDF report generation
backend/report.py
Other components
- User
Connections 20
- User → MRI upload: selects scan
README.md - MRI upload → UI state and routing: sets upload state
frontend/src/App.jsx - UI state and routing → MRI upload: renders
frontend/src/App.jsx - UI state and routing → Results view: renders results
frontend/src/App.jsx - MRI upload → Flask API: posts image
frontend/src/pages/UploadPage.jsx - Flask API → Image decoding and transforms: decodes image
backend/app.py - Flask API → ViT detection: loads model
backend/app.py - Flask API → Image decoding and transforms: runs pipeline
backend/app.py - Image decoding and transforms → ViT detection: runs detection
README.md - Image decoding and transforms → Attention localization: localizes region
README.md - Image decoding and transforms → ResNet classification: classifies region
README.md - Image decoding and transforms → Grad-CAM and masks: generates visualizations
README.md - Flask API → Results view: returns result
README.md - Results view → Image viewer: renders image view
frontend/src/pages/ResultsPage.jsx - Results view → Confidence display: renders confidence
frontend/src/pages/ResultsPage.jsx - Results view → Tumour type badge: renders tumour type
frontend/src/pages/ResultsPage.jsx - Results view → PDF endpoint: posts result
frontend/src/pages/ResultsPage.jsx - PDF endpoint → PDF report generation: generates PDF
backend/app.py - User → Results view: views findings
README.md - PDF report generation → User: downloads report