How ayushsinghrana15/multi-class-fishimage-classification works
Project Type and Purpose
• This is an end-to-end machine-learning application with two main phases:
a. Offline training pipeline (data preprocessing, model training, evaluation)
b. Online interactive deployment (Streamlit web app for image upload and inference)
• Purpose: classify images into 11 fish/seafood species using both custom CNN and five transfer-learning models, then let end users query alongside confidence visualizations.
File Structure
• Top-level scripts & notebooks:
• Multiclass Fish Image Classification.ipynb (exploratory & proof-of-concept)
• train_models.py (implied; described in README)
• fishclass.py (Streamlit app entry point)
• Model artifacts (.h5) saved at top level: best_model.h5, best_resnet50.h5, etc.
• Dataset hierarchy under images.cv_*: data/{train,val,test}/{class-folders}
• sample_fish_images/: sample inputs for deployment
• requirements.txt & .devcontainer/: dependency management & dev environment
• README.md: architecture & usage summary
README
• Confirms use of TensorFlow/Keras for training, scikit-learn/matplotlib/seaborn for evaluation, and Streamlit for deployment.
• Phases: data preprocessing & augmentation → model training (+ fine-tuning) → evaluation (metrics + confusion matrices) → interactive app (upload/select image, top-3 predictions, bar chart, info panels).
Diagramming the Architecture
a. Main Components
1. Data Storage
• Raw images on disk (images.cv_…/data)
• sample_fish_images folder
2. Preprocessing & Augmentation Module
• Python scripts/notebooks reading from Data Storage
• Applies resizing, normalization, flips/rotations
3. Model Training & Fine-Tuning Module
• Custom CNN training pipeline
• Transfer-learning pipelines: VGG16, ResNet50, MobileNet, InceptionV3, EfficientNetB0
• Outputs: trained .h5 model artifacts
4. Model Evaluation Module
• Runs test-set predictions
• Computes accuracy, precision, recall, F1, confusion matrix
• Visualization using matplotlib/seaborn
5. Deployment App (Streamlit)
• fishclass.py: loads saved .h5 models
• UI: image upload or sample selection
• Inference engine: preprocess → model.predict → post-process top-3 classes + confidences
• Visualization: confidence bar chart + species info
6. Dev/Runtime Environment
• Python environment with requirements.txt
• Optional Docker/Devcontainer for repeatable builds
b. Relationships & Data Flows
• Data Storage → Preprocessing → Model Training → Model Artifacts
• Model Artifacts → Model Evaluation → Metrics & Plots
• Model Artifacts → Deployment App
• End-User (Browser) ↔ Streamlit App ↔ Inference Engine ↔ Model Artifacts
• Dev/CI (GitHub, Devcontainer) supports all phases
c. Architectural Patterns & Principles
• Layered architecture: clearly separate data layer, processing/training layer, evaluation layer, deployment layer
• Reusable artifacts: .h5 models serve both evaluation and deployment
• Modularity: each ML component (custom vs. transfer learning) is pluggable
d. Key Technologies/Frameworks
• TensorFlow/Keras (modeling)
• NumPy/Pillow (data handling)
• scikit-learn (metrics)
• matplotlib/seaborn (visualizations)
• Streamlit (web UI)
• Docker/Devcontainer (optional containerization)
Detailed Capture of Essential Elements
• Fact that multiple models (five pretrained + custom) can be toggled/trained
• Metrics module outputs (confusion matrix charts)
• Sample image directory as optional input to Streamlit
• That fishclass.py both loads models and handles user interactions