utils.config
Configuration Module for Garbage Classification Project.
This module contains all configuration parameters and constants used throughout the garbage classification project, including dataset paths, model parameters, and class definitions.
Attributes
- DATASET_PATH (str): Path to the raw garbage dataset directory containing training images.
- LOSS_CURVES_PATH (str): Directory path where training/validation loss and accuracy curves are saved.
- MODEL_PATH (str): Path where the trained model checkpoint is saved or loaded from.
- SAMPLE_IMG_PATH (str): Path to a sample image used for default predictions.
- CLASS_NAMES (list of str): List of garbage category names for classification. Categories: cardboard, glass, metal, paper, plastic, trash.
- MAX_EPOCHS (int): Maximum number of training epochs.
- NUM_CLASSES (int): Number of classification categories (derived from CLASS_NAMES length).
Examples
>>> from utils import config as cfg
>>> model = GarbageClassifier(num_classes=cfg.NUM_CLASSES)
>>> trainer = pl.Trainer(max_epochs=cfg.MAX_EPOCHS)
Notes
All paths are relative to the project root directory. Ensure the directory structure matches the configured paths before running training or inference.
1#!/usr/bin/env python3 2# -*- coding: utf-8 -*- 3""" 4Configuration Module for Garbage Classification Project. 5 6This module contains all configuration parameters and constants used 7throughout the garbage classification project, including dataset paths, 8model parameters, and class definitions. 9 10Attributes 11---------- 12DATASET_PATH : str 13 Path to the raw garbage dataset directory containing training images. 14LOSS_CURVES_PATH : str 15 Directory path where training/validation loss and accuracy curves are 16 saved. 17MODEL_PATH : str 18 Path where the trained model checkpoint is saved or loaded from. 19SAMPLE_IMG_PATH : str 20 Path to a sample image used for default predictions. 21CLASS_NAMES : list of str 22 List of garbage category names for classification. 23 Categories: cardboard, glass, metal, paper, plastic, trash. 24MAX_EPOCHS : int 25 Maximum number of training epochs. 26NUM_CLASSES : int 27 Number of classification categories (derived from CLASS_NAMES length). 28 29Examples 30-------- 31>>> from utils import config as cfg 32>>> model = GarbageClassifier(num_classes=cfg.NUM_CLASSES) 33>>> trainer = pl.Trainer(max_epochs=cfg.MAX_EPOCHS) 34 35Notes 36----- 37All paths are relative to the project root directory. Ensure the directory 38structure matches the configured paths before running training or inference. 39""" 40__docformat__ = "numpy" 41 42DATASET_PATH = '../data/raw/sample_dataset/' 43LOSS_CURVES_PATH = '../models/performance/loss_curves/' 44MODEL_PATH = '../models/weights/model_resnet18_garbage.ckpt' 45SAMPLE_IMG_PATH = 'sample.jpg' 46CLASS_NAMES = ["cardboard", "glass", "metal", "paper", "plastic", "trash"] 47MAX_EPOCHS = 10 48NUM_CLASSES = len(CLASS_NAMES)