How doansilinh/nckh-generative-ai works
Main Components
• Data Acquisition & Preprocessing:
• get_data.py: Responsible for downloading data from Kaggle.
• load_data.py: Used to load and possibly preprocess the data.
• Model Components:
• generator_model.py: Defines the generator part of the GAN.
• discriminator_model.py: Defines the discriminator part.
• gan_model.py: Likely integrates the generator and discriminator into the complete GAN.
• Training & Testing:
• train_model.py: Handles the training process (using parameters from setting.py).
• test_model.py: Evaluates the trained model and outputs results.
• Settings & Configuration:
• setting.py: Contains key hyperparameters (e.g., number of epochs, learning rates) for both generator and discriminator.
• Output:
• models (as referenced in the README, even if not in file tree): Folder that stores model checkpoints.
• images folder: Stores output images from model testing.
• Data flow should start with the “Data Acquisition” component via get_data.py, followed by data importation using load_data.py.
• Once data is available, the “Training” module starts with train_model.py, which utilizes the GAN model (constructed from generator_model.py, discriminator_model.py, gan_model.py) and uses configuration from setting.py.
• After training, the “Testing” process in test_model.py picks up the trained model (or models saved into the models directory) and produces sample outputs stored in the images folder.
• External dependency on Kaggle for data download and on the Python libraries listed in requirements.txt.
Important Architectural Patterns and Design Principles
• Modular design: Each script (data, model, training, testing) represents a distinct module or layer.
• Separation of Concerns: Data handling is kept separate from model definitions and training logic.
• Configurability: settings (hyperparameters, number of epochs, learning rates) are externalized in setting.py, allowing easy tuning and experiments.
Relevant Technologies and Components
• Python is the primary language.
• Libraries specified in requirements.txt (likely including deep learning frameworks such as TensorFlow, PyTorch, or similar; check the file for exact libraries).
• Use of external datasets from Kaggle (data acquisition script).
• Storage of trained models and output images as stated in the README.
Elements
• Clear labels for each module:
– Data Acquisition: get_data.py
– Data Loading/Preprocessing: load_data.py
– Model Definitions: generator_model.py, discriminator_model.py, gan_model.py
– Training: train_model.py (with settings.py for hyperparameters)
– Testing: test_model.py
– Outputs: models (checkpoints) and images (generated samples)
– Data operations and data sources (e.g., external data from Kaggle)
– Model components (machine learning model definitions)
– Execution flows (training vs. testing)
• Dependencies on external libraries and note that pip install –r requirements.txt installs these dependencies.