Computer vision baseline pipeline for BBBC021 using classical image processing.
BBBC021_Project/
|
|-- data/
| |-- raw/
| | |-- images/
| | `-- metadata/
| | `-- BBBC021_v1_image.csv
| |
| `-- processed/
| |-- resized/
| |-- normalized/
| `-- cleaned/
|
|-- outputs/
| |-- detections/
| |-- overlays/
| |-- metrics/
| `-- plots/
|
|-- models/
| |-- checkpoints/
| `-- configs/
|
|-- notebooks/
| |-- 01_data_exploration.ipynb
| |-- 02_preprocessing.ipynb
| |-- 03_detection.ipynb
| `-- 04_analysis.ipynb
|
|-- src/
| |-- data_loader.py
| |-- preprocess.py
| |-- detect.py
| |-- features.py
| `-- visualize.py
|
|-- requirements.txt
`-- README.md
- Download BBBC021 images + metadata.
- Build a simple Group A vs Group B split from metadata.
- Run spot detection (OpenCV thresholding + contour filtering).
- Compute per-image metrics:
- spot count
- average brightness
- total intensity
- area covered
- Save overlays, metric tables, and comparison plots.
Run these commands in a terminal from the project folder:
git init
git add .
git commit -m "Initial BBBC021 baseline pipeline"
# Create an empty repo on GitHub named BBBC021_Project, then:
git remote add origin https://github.com/<YOUR_USERNAME>/BBBC021_Project.git
git branch -M main
git push -u origin main- In Colab, use GitHub tab and open this repository notebook.
- Run notebooks in order:
- notebooks/01_data_exploration.ipynb
- notebooks/02_preprocessing.ipynb
- notebooks/03_detection.ipynb
- notebooks/04_analysis.ipynb
- Create a new notebook.
- Clone repo in a cell:
!git clone https://github.com/<YOUR_USERNAME>/BBBC021_Project.git
%cd BBBC021_Project
!pip install -r requirements.txt- Open and run the notebook sequence above.
After running 03_detection.ipynb and 04_analysis.ipynb, check:
- Overlays:
outputs/overlays/(5-10 sample images) - Spot table:
outputs/metrics/spot_count_sample.csv - Full metrics:
outputs/metrics/image_metrics.csv - Group plots:
outputs/plots/*.png
For sharing and verification in GitHub, packaged artifacts are copied to:
outputs/deliverable/overlays/outputs/deliverable/metrics/outputs/deliverable/plots/
- BBBC021 images are distributed as multiple plate ZIPs; the exploration notebook starts with one ZIP for quick testing and can be extended to more ZIP URLs.
- Raw images are excluded from git via
.gitignoreto keep repo size manageable. - You can adjust detection parameters in
src/detect.py.
Run the end-to-end refined pipeline:
python src/phase_pipeline.pyThis creates:
final_figures/- Figure 1: pipeline workflow
- Figure 2: detection overlays
- Figure 3: feature comparison boxplots
- Figure 4: ROC + feature importance
- Figure 5: PCA + clustering
final_tables/image_feature_table.csv
results_summary/classification_metrics.jsonfeature_importance.csvpca_clusters.csvsummary.md
Run the multi-batch robustness analysis:
python src/robustness_pipeline.pyThis downloads three BBBC021 batches if needed, evaluates multiple detection parameter sets, and creates:
final_figures/figure6_batch_robustness.pngfigure7_threshold_sensitivity.pngfigure8_robustness_classification.png
final_tables/robustness_feature_table.csv
results_summary/robustness_batch_summary.csvrobustness_classification.csvrobustness_config_summary.csvrobustness_summary.jsonrobustness_summary.md
Run the CNN comparison pipeline:
python src/deep_learning_pipeline.pyThis creates:
final_figures/figure9_deep_learning_roc.pngfigure9_deep_learning_training.png
final_tables/deep_learning_predictions.csv
results_summary/deep_learning_metrics.jsonmodel_comparison_final.csvmanuscript_draft.mdmanuscript_mdpi_submission.md
Run the full advanced evaluation pipeline:
python src/full_dataset_advanced_pipeline.pyThis run expands to at least 1500 images and adds:
- confusion matrices for RF, CNN, ResNet-18
- per-class ROC AUC reporting
- DeLong statistical tests (CNN vs RF, ResNet vs RF)
- PCA batch effect plots before and after batch-normalization
- feature ablation study
- calibration curves + expected calibration error (ECE)
- ResNet-18 transfer learning baseline
- biological validation of top features against compound metadata
- computational cost comparison table
- nested cross-validation diagnostics on training data
Generated outputs include:
final_tables/full_dataset_features_1500plus.csvresults_summary/advanced_model_metrics.csvresults_summary/advanced_delong_tests.jsonresults_summary/advanced_nested_cv.csvresults_summary/advanced_biological_validation.csvresults_summary/advanced_computational_cost.csvresults_summary/advanced_calibration_ece.csv