Coder Social home page Coder Social logo

cbs_mldl_2024's Introduction

Machine Learning and Deep Learning Course Project (CDSCO1005U)

This repository contains the final project for the Machine Learning and Deep Learning course (CDSCO1005U). The project involves developing and training machine learning models for image classification tasks.

Project Structure

The project is organized into several directories:

  • data/: Contains the training and validation datasets.
  • models/: Contains the trained models.
  • notebooks/: Contains Jupyter notebooks for experiments.
  • src/: Contains the Python source code for the project.

Key Components

  • src/main.py: The main script for training deep models.
  • src/svm_training.py: Script to training SVM models.
  • notebooks/test.ipynb: A Jupyter notebook for testing the trained models.
  • notebooks/experiment_ResNet.ipynb: A notebook for experimenting with ResNet models.
  • notebooks/experiment_CNN.ipynb: A notebook for experimenting with Custom CNN models.
  • notebooks/experiment_SVM.ipynb: ` A notebook for experimenting with SVM models.

Training Models with main.py

The main.py file in this project is used to train our models. Here's how you can use it:

Prerequisites Ensure you have the following installed:

  • Python 3.10 or later
  • TensorFlow 2.16 or later
  • Keras 3.2 or later
  • Keras-cv 0.8.2

Steps

  1. Set up your environment: Make sure you have installed all the necessary packages listed in the prerequisites.

  2. Prepare your data: Unzip the dataset.zip in the /data directory. The data should be in a format that can be read by the load_datasets function in src/data_loader.py.

  3. Run the script: Navigate to the src directory and run the main.py script. You can do this by opening a terminal in the src directory and running the following command:

python main.py

This will start the training process using the default parameters defined in the main.py file:

  • TRAIN_DATADIR: The directory where the training data is located. Default is ./data/train_directory.
  • VAL_DATADIR: The directory where the validation data is located. Default is ./data/val_directory.
  • BATCH_SIZE: The batch size for training. Default is 128.
  • EPOCHS: The number of epochs for training. Default is 35.
  • MAX_LR: The maximum learning rate. Default is 1e-2.
  • CLASSES: The number of classes. Default is 11.
  • MODEL_NAME: The name of the model. Default is 'resnet18'.

The main function in main.py uses these constants to load the datasets, build the model, and start the training process.

  1. Customize the training process: If you want to use a different model or change the training parameters, you can modify the constants in the main.py file or pass a different model building function to the main function.

Output

The trained model will be saved in the models directory. The training process also generates logs, which are saved in the logs directory.

Training SVM with svm_training.py

Step

  1. Run the script: Navigate to the directory containing the svm_training.py script in your terminal and run the following command:
python svm_training.py

This will start the training process. The script will first load the datasets from the specified directories. It will then create an SVM model with a PCA pipeline and train it using the loaded data.

  1. Check the output: After the training is completed, the script will evaluate the model's accuracy on the validation data and print the accuracy score. The trained model will be saved as svm_model.pkl in the ../models directory.

cbs_mldl_2024's People

Contributors

magnuss0 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.