Classify meiotic phases from microscopy images using OpenCV preprocessing, spatial feature extraction, and a Random Forest model.
Repository: github.com/valereoo/KDS
| Goal | Where | How |
|---|---|---|
| Train / regenerate model | Google Colab | Open notebook in Colab |
| Use the classifier (UI) | Local or Streamlit Cloud | Run the Streamlit app |
Live app: kdskelompok17.streamlit.app
KDS/
├── notebooks/ # Training notebook (run on Colab)
├── data/ # CSV inputs/outputs (gitignored if large)
├── models/ # Trained .joblib for the web app
├── app.py # Streamlit entry point
├── src/kds/ # App logic used by Streamlit
└── requirements.txt
The training pipeline lives in:
notebooks/Kelompok17_K04_IF3211_18223010_18223016_18223030_18223068_klasifikasi_fase_meiosis_opencv.ipynb
It downloads the Kaggle dataset hasan1101/mitosis-detection, extracts OpenCV features, trains a Random Forest, and writes artifacts to outputs_meiosis_opencv/.
Run this in the first cell of Colab, then open the notebook from the file browser (notebooks/ → your .ipynb):
!git clone https://github.com/valereoo/KDS.git
%cd KDS/notebooks- Runtime → Change runtime type → Python 3 (GPU not required).
- Run cells top to bottom from the training notebook.
- Kaggle data — the notebook uses
kagglehubto download the dataset automatically. If download fails:- Create a Kaggle API token (
kaggle.json). - In Colab: Upload
kaggle.json, then run:!mkdir -p ~/.kaggle && mv kaggle.json ~/.kaggle/ && chmod 600 ~/.kaggle/kaggle.json
- Re-run the dataset download cell.
- Create a Kaggle API token (
- Optional manual labels — place
manual_phase_labels.csvin the notebook working directory (notebooks/when using%cd KDS/notebooks), or use the template the notebook generates.
The notebook saves files under outputs_meiosis_opencv/. Copy the important ones into the repo layout so the Streamlit app can use them:
| From (Colab) | Copy to (repo) |
|---|---|
outputs_meiosis_opencv/meiosis_phase_opencv_random_forest.joblib |
models/ |
outputs_meiosis_opencv/opencv_spatial_features.csv |
data/ |
outputs_meiosis_opencv/manual_phase_labels_template.csv |
data/ |
outputs_meiosis_opencv/predictions_test.csv |
data/ |
outputs_meiosis_opencv/feature_importance.csv |
data/ |
outputs_meiosis_opencv/permutation_importance.csv |
data/ |
Download from Colab (run in a new cell after training):
from google.colab import files
from pathlib import Path
import shutil
out = Path("outputs_meiosis_opencv")
zip_path = "/content/kds_artifacts.zip"
shutil.make_archive("/content/kds_artifacts", "zip", out)
files.download(zip_path)Unzip locally into models/ and data/ as in the table above.
Commit the model to GitHub (use Git LFS for the .joblib):
git lfs install
git lfs track "*.joblib"
git add models/meiosis_phase_opencv_random_forest.joblib
git commit -m "Add trained model"
git pushThe interactive classifier is app.py. It needs the trained model in models/meiosis_phase_opencv_random_forest.joblib (from Colab or a previous local run).
git clone https://github.com/valereoo/KDS.git
cd KDS
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # macOS / Linux
pip install -r requirements.txt
streamlit run app.pyOpen the URL shown in the terminal (usually http://localhost:8501).
- Push this repo to GitHub (include the model via Git LFS, or upload it after first Colab run).
- Go to share.streamlit.io → sign in with GitHub.
- New app → repository
valereoo/KDS→ Main file:app.py→ Deploy.
Deployed app: https://kdskelompok17.streamlit.app/
git clone https://github.com/valereoo/KDS.git
cd KDS
git lfs install
git lfs track "*.joblib"
git add .
git commit -m "Your message"
git push origin mainenv/,.venv/, and large*.csvfiles indata/are gitignored by default.- Track
.joblibwith Git LFS (seemodels/README.md).
| File | Folder |
|---|---|
Training notebook (.ipynb) |
notebooks/ |
| CSV datasets & exports | data/ |
Trained model (.joblib) |
models/ |
| Virtual environment | env/ or .venv/ (local only, not committed) |
| Variable | Description |
|---|---|
KDS_MODEL_PATH |
Override path to the .joblib model |
Add your license here (e.g. MIT).