How m3mentomor1/breast-cancer-image-classification-with-densenet121 works
Project type and purpose
• This is a full-stack machine-learning application for breast ultrasound image classification.
• Purpose: load a pre-trained DenseNet121-based CNN, run inference on uploaded ultrasound images via a Streamlit web UI, and display multiclass predictions (benign, malignant, normal).
File structure
• Top‐level artifacts:
• LICENSE, README.md, requirements.txt – project metadata & deps
• model_training.ipynb, model_evaluation.ipynb – offline training & evaluation pipelines
• splitted_model/ (model.h5 in 32 parts) – stored model artifacts
• streamlit_app.py – the entry point for the deployed web UI
• test_images/ – sample inputs for evaluation
• No separate “frontend” vs. “backend” directories: Streamlit combines UI & inference logic in one script.
• Dependencies declared in requirements.txt; deployment handled by Streamlit Cloud.
README for additional insights
• Describes transfer-learning pipeline: DenseNet121 base (frozen) + custom Dense + Dropout layers.
• Mentions Streamlit deployment for user interaction.
• References external dataset source and model weight download URL.
a. Main components
1. Client (Web Browser)
2. Streamlit App (streamlit_app.py)
3. Model Loader/Inference Engine (TensorFlow/Keras + DenseNet121 + custom layers)
4. Model Artifact Storage (splitted_model/model.h5 parts combined at startup)
5. Offline Training & Evaluation Modules (Jupyter notebooks + dataset)
6. External Services (Kaggle dataset source, Google Drive / Streamlit Cloud)
b. Relationships & interactions
• User uploads or selects an image in the browser → HTTP request to Streamlit server
• Streamlit server reconstructs model.h5 from parts (or downloads weights) → loads into TensorFlow
• Inference Engine processes image → returns predicted class
• Streamlit UI displays results (class label + probability + optional confusion matrix visuals)
• Offline notebooks consume raw dataset → train/fine-tune model → export model.h5 → split into parts
c. Architectural patterns / design principles
• MVC-like separation: Streamlit’s UI widgets (View) + Python callbacks (Controller) + model artifacts (Model)
• Transfer-learning pipeline: frozen base + trainable head
• Modularity: notebooks isolated from deployment code, model parts separated from code
d. Key technologies/frameworks
• Python, Streamlit (UI + web server)
• TensorFlow/Keras (model loading & inference)
• Jupyter (training & evaluation)
• h5py (model file handling)
• External hosting: Streamlit Cloud, Google Drive