Skip to content

Initialize PlantGuard AI scaffold: data pipeline, models, experiments, docs, and lint CI - #2

Open
TrstnSnhn wants to merge 3 commits into
mainfrom
codex/set-up-plantguard-ai-repository-x6twmm
Open

Initialize PlantGuard AI scaffold: data pipeline, models, experiments, docs, and lint CI#2
TrstnSnhn wants to merge 3 commits into
mainfrom
codex/set-up-plantguard-ai-repository-x6twmm

Conversation

@TrstnSnhn

Copy link
Copy Markdown
Owner

Motivation

  • Initialize an end-to-end scaffold for a plant disease classification project (PlantGuard AI) including data ingestion, training/evaluation pipelines, baseline models, and experiment tracking.
  • Provide reproducible experiment configs, placeholder results/visualizations, documentation, and minimal CI linting to onboard team members quickly.

Description

  • Add project metadata and docs including README.md, LICENSE (MIT), docs/* placeholders, and Jupyter notebook scaffolds under notebooks/.
  • Implement data utilities and pipeline: data/get_data.py for downloading/validating PlantVillage, and src/data_pipeline.py for splitting and creating dataloaders.
  • Add model implementations and training/eval tooling: src/models/ contains resnet_finetune.py, cnn_from_scratch.py, nlp_classifier.py, and src/train.py, src/eval.py, src/gradcam.py, src/nlp_pipeline.py, src/rl_agent.py for tasks and placeholder outputs.
  • Provide utilities and experiment orchestration: logging, metrics, seeding, visualization under src/utils/, experiment configs under experiments/configs/, placeholder results in experiments/results/, requirements.txt, and a top-level run.sh script to run the full pipeline; add a GitHub Actions lint workflow /.github/workflows/lint.yml using ruff.

Testing

  • Add CI lint workflow /.github/workflows/lint.yml that runs ruff check . (workflow added but not executed in this PR).
  • Performed lightweight smoke runs that executed successfully and produced placeholder outputs: python src/eval.py --all (wrote experiments/results/eval_summary.json), python src/gradcam.py (wrote experiments/results/gradcam_samples.png), python src/nlp_pipeline.py --action train (trained TF-IDF + LogisticRegression on seed data and wrote experiments/results/nlp_metrics.json), and python src/rl_agent.py --episodes 5 (wrote experiments/results/rl_learning_curve.png).

Codex Task

@TrstnSnhn

Copy link
Copy Markdown
Owner Author

new pull request

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51f740e8fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread run.sh Outdated
python src/data_pipeline.py --action split --seed 42

echo "=== Step 3: Train Non-DL Baseline ==="
python src/train.py --config experiments/configs/baseline_sklearn.yaml

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove unsupported sklearn config from run pipeline

Step 3 runs python src/train.py --config experiments/configs/baseline_sklearn.yaml, but build_model in src/train.py only supports simple_cnn and resnet18 while this config sets architecture: sklearn_rf. With set -e, this deterministic mismatch raises ValueError and aborts the pipeline before later training/evaluation steps, so the documented quick-start flow cannot complete.

Useful? React with 👍 / 👎.

Comment thread src/train.py

model = build_model(cfg).to(device)
criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), lr=cfg["training"].get("lr_unfrozen", 1e-3))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use frozen-phase learning rate before unfreezing

The initial optimizer is always created with training.lr_unfrozen even though ResNet training immediately freezes the backbone and configs define a separate training.lr_frozen. For example, resnet18_default.yaml provides different frozen/unfrozen rates, so this line runs the frozen phase at the wrong LR and undermines LR-sensitive experiments/ablations.

Useful? React with 👍 / 👎.

Comment thread src/train.py
for epoch in range(1, total_epochs + 1):
if cfg["model"]["architecture"] == "resnet18" and epoch == cfg["model"].get("freeze_epochs", 5) + 1:
model.unfreeze_backbone()
optimizer = torch.optim.Adam(model.parameters(), lr=cfg["training"].get("lr_unfrozen", 1e-4))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Rebind scheduler after replacing optimizer

When the model unfreezes, a brand-new optimizer is assigned, but the existing ReduceLROnPlateau scheduler still points to the old optimizer created earlier. From that point onward, scheduler.step(val_loss) updates stale parameter groups while the active optimizer keeps a fixed LR, so LR scheduling stops working during the unfrozen training stage.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant