source.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 = "/home/alumno/Desktop/datos/SDOML/garbage_classifier/\ 43 data/raw/Garbage_Dataset_Classification/images/" 44LOSS_CURVES_PATH = "/home/alumno/Desktop/datos/SDOML/garbage_classifier/\ 45 models/performance/loss_curves/" 46MODEL_PATH = "/home/alumno/Desktop/datos/SDOML/garbage_classifier/\ 47 models/weights/model_resnet18_garbage.ckpt" 48SAMPLE_IMG_PATH = ( 49 "/home/alumno/Desktop/datos/SDOML/garbage_classifier/data/raw/sample.jpg" 50) 51CLASS_NAMES = ["cardboard", "glass", "metal", "paper", "plastic", "trash"] 52MAX_EPOCHS = 10 53NUM_CLASSES = len(CLASS_NAMES)
DATASET_PATH =
'/home/alumno/Desktop/datos/SDOML/garbage_classifier/ data/raw/Garbage_Dataset_Classification/images/'
LOSS_CURVES_PATH =
'/home/alumno/Desktop/datos/SDOML/garbage_classifier/ models/performance/loss_curves/'
MODEL_PATH =
'/home/alumno/Desktop/datos/SDOML/garbage_classifier/ models/weights/model_resnet18_garbage.ckpt'
SAMPLE_IMG_PATH =
'/home/alumno/Desktop/datos/SDOML/garbage_classifier/data/raw/sample.jpg'
CLASS_NAMES =
['cardboard', 'glass', 'metal', 'paper', 'plastic', 'trash']
MAX_EPOCHS =
10
NUM_CLASSES =
6