Coder Social home page Coder Social logo

hrudaykolla / christmas-image-classification Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 3.23 MB

Classification performed on Christams backdrop Images of 8 classes like 'Christmas Cookies', 'Christmas Presents', 'Christmas Tree', 'Fireworks', 'Penguin', 'Raindeer', 'Santa', 'Snowman'

Python 100.00%

christmas-image-classification's Introduction

Christmas Images Classification

Classification performed on Christams backdrop Images of 8 classes like 'Christmas Cookies', 'Christmas Presents', 'Christmas Tree', 'Fireworks', 'Penguin', 'Raindeer', 'Santa', 'Snowman'.

Introduction

The Data has 3736 images of different sizes and intensities for training and evaluating and 160 images for testing images. To enhance the training dataset, Data augmentations such as random cropping, flipping, rotating, and normalization were applied.

Transfer learning was employed using EfficientNet B4, and ConvNeXt Tiny from torch vision models trained on the ImageNet dataset, with the ConvNeXt Tiny model achieving a remarkable accuracy of 92% using pretrained weights.

Requirements

See requirements.txt file

Setup

  1. Install PyTorch and other required Python libraries in a virtual environment with:

    pip install -r requirements.txt
    
  2. Download Data: Download data and follow the below image for hierarchy. Data contains two folder:

    1. train_val (contains folders of images for training and validation).
    2. test, it has a test (sub folder that contains testing images) and test.csv containing ground truth labels of test images.

Usage

python main.py executes and runs the code with all the default arguments.

For changing the default arguments follow the below instructions:

  1. model selection:

    pretrained convnext_tiny model as a model: python main.py --model convnext

    pretrained efficientnetb4 model as a model: python main.py --model efficientnetb4

  2. model parameters:

    Validation and training data split ratio, Train loader Batch size, Validation loader Batch size, epochs, learning rate, and hidden units are some of the neural net parameters that can be altered through command line.

    python main.py --model efficientnetb4 --valtrainsplit 0.2 --trainbatchsize 4 --valbatchsize 4 --epochs 30 --learningrate 0.001 --weightdecay 0.0001

    python main.py -m efficientnetb4 -vts 0.2 -tbs 4 -vbs 4 -e 30 -lr 0.001 -wd 0.0001

Outputs

The output of the network is saved in Outputs folder. Output contains:

  1. best_model (weights of model with highest validation accuracy).
  2. configuration.txt (text file with model configurations).
  3. terminal_output.txt (terminal output during training and evaluation).
  4. ./runs (folder with logs of tensorboard).

Testing

For testing use evaluate.py file. Update the following path in the file. for example:

dataset location

path = ./data/test

Output path location

ouput_path = ./outputs/output_1

After updating, run python evaluate.py this save two more files in output folder.

  1. predictions.csv (Contains prediction of the test images).
  2. test_terminal_output (terminal output during testing)

The output folder looks as below after training and testing.

This work was a group project consisting two people

christmas-image-classification's People

Contributors

hrudaykolla avatar ianmendonca avatar

Watchers

Kostas Georgiou avatar  avatar

Forkers

ianmendonca

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.