Zing 论坛

正文

Vegetable Vision:一个面向生产的CNN图像分类项目实践

新加坡理工学院学生的深度学习课程项目,展示了如何将课程笔记本重构为具有MLOps实践、CI/CD流水线、安全扫描和完整文档的生产就绪项目。

CNN卷积神经网络图像分类TensorFlowKerasMLOps深度学习数据增强CI/CD
发布时间 2026/04/29 17:14最近活动 2026/04/29 17:21预计阅读 6 分钟
Vegetable Vision:一个面向生产的CNN图像分类项目实践
1

章节 01

Vegetable Vision: A Production-Oriented CNN Image Classification Project Guide

Vegetable Vision is a project by Singapore Polytechnic student Goh Kun Ming, which transforms a deep learning course assignment (Jupyter Notebook) into a production-ready machine learning project. It integrates MLOps practices, CI/CD pipelines, security scans, and complete documentation. The project focuses on vegetable image classification using CNNs, compares multiple architectures, and demonstrates how to bridge academic work to production-level engineering.

2

章节 02

Project Background & Motivation

The project originated from a course assignment (ST1504 Deep Learning CA1 Part A) at Singapore Polytechnic, where the task was to build a CNN classifier for vegetable images using a single Jupyter Notebook. The author realized the need to refactor the notebook into maintainable, reusable code to enable future reuse, maintenance, and expansion—leading to the birth of Vegetable Vision, which retains academic value while adopting modern software engineering and MLOps best practices.

3

章节 03

Core Technical Goals & Model Architecture Comparisons

The project's key technical goals include:

  1. Implementing multi-class vegetable image classification with TensorFlow/Keras, comparing input sizes (23px vs.101px) and data augmentation effects.
  2. Evaluating 5 CNN architectures: Sequential model (baseline), Functional API (flexible), Residual connections (alleviate gradient vanishing), Inception-like (multi-scale features), and Depthwise Separable convolution (lightweight, reduced compute).
  3. Refactoring the notebook into a maintainable codebase with production-level standards.
4

章节 04

Project Structure & MLOps Practices

Structure:

  • Original notebook kept in root and notebooks/ for academic integrity.
  • src/vegetable_vision/ for modular code (model definitions, training, data processing).
  • tests/ for pytest suites (config validation, data loading, notebook tools).
  • docs/ for comprehensive documentation.
  • Notebook split script to divide large notebooks into small files and ensure sync with original.

MLOps:

  • Dependency management: pyproject.toml, separate runtime (requirements.txt) and dev (requirements-dev.txt) dependencies.
  • Code quality: Ruff (formatting/static check), Bandit (security scan), pip-audit (dependency audit).
  • CI/CD: GitHub Actions automate tests, code checks, security scans, CodeQL analysis on each commit.
5

章节 05

Dataset & Training Process

The vegetable image dataset uses standard train/validation/test splits. Due to academic use restrictions, data is not committed to version control (via .env and .gitignore). Training scripts have a command-line interface to specify data directory, model type, image size, and epochs. Evaluation scripts load saved models to generate performance reports, enabling easy integration into automation pipelines.

6

章节 06

Documentation & Educational/Industry Value

Documentation:

  • PROJECT_CONTEXT.md (background/decisions), DATASET.md (format/source/restrictions), MLOPS.md (practices), MODEL_CARD.md (model details/limitations), ARCHITECTURE.md (code structure), CI_SECURITY.md (CI/security config).

Value:

  • Educational: Shows students how to turn academic prototypes into production-ready products—critical for AI industry competitiveness.
  • Industry: Provides a lightweight MLOps reference using simple tools (pytest, Ruff, GitHub Actions) to build effective quality assurance systems.
7

章节 07

Limitations & Future Improvement Directions

Limitations:

  • Full model reproduction requires original dataset and GPU resources.
  • Test coverage focuses on infrastructure code (not model training logic, which needs heavy compute).

Future Directions:

  • Integrate experiment tracking tools (Weights & Biases/MLflow).
  • Add model version management (e.g., DVC).
  • Implement model serving (e.g., FastAPI).
  • Expand test coverage to model inference paths.