Giter Site home page Giter Site logo

ugenteraan / resnet-50-cbam-pytorch Goto Github PK

View Code? Open in Web Editor NEW
73.0 2.0 20.0 445.57 MB

Implementation of Resnet-50 with and without CBAM in PyTorch v1.8. Implementation tested on Intel Image Classification dataset from https://www.kaggle.com/puneet6060/intel-image-classification.

License: MIT License

Python 100.00%
resnet-50 pytorch-implementation deep-learning image-classification cbam-resnet

resnet-50-cbam-pytorch's Introduction

ResNet-50 with CBAM using PyTorch 1.8

Introduction

This repository contains the implementation of ResNet-50 with and without CBAM. Note that some parameters of the architecture may vary such as the kernel size or strides of convolutional layers. The implementation was tested on Intel's Image Classification dataset that can be found here.

Pretrained Weights

The trained models' weights are provided here.

How to Use

In order to train your own custom dataset with this implementation, place your dataset folder at the root directory. Make sure that your dataset is split into two subfolder. train and test where the former contains your training dataset and the latter contains your validation set. Refer to the folder named intel_dataset in the repo as an example.

If you wish to train the model without CBAM, you can do so with

python train.py --data_folder [YOUR DATASET FOLDER NAME] --gpus [NUMBER OF GPU]

To train the model with CBAM, run

python train.py --data_folder [YOUR DATASET FOLDER NAME] --gpus [NUMBER OF GPU] --use_cbam

There are more arguments that can be supplied to the command. Run

python train.py -h

for more information.

If you wish to visualize the final layer of feature maps produced by the trained model, create a folder in the root directory and simply place your images inside it and run

python visualize.py --data_folder [FOLDER NAME] 

Additionally, if the model was trained on CBAM architecture, then add --use_cbam at the end of the command above.

Performance

ResNet-50 with CBAM achieved an accuracy of 86.6% on the validation set while ResNet-50 without CBAM achieved an accuracy of 84.34% on the same validation set. The figures below show the improvement of the models over the epochs.

ResNet-50 Without CBAM

Accuracy over 30 epochs

Loss over 30 epochs

ResNet-50 with CBAM

Accuracy over 30 epochs

Loss over 30 epochs

Visualization

The figures below are the feature maps of the final convolutional layer of both ResNet-50 without CBAM and ResNet-50 with CBAM.

ResNet-50 With CBAM


ResNet-50 Without CBAM

resnet-50-cbam-pytorch's People

Contributors

ugenteraan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

resnet-50-cbam-pytorch's Issues

About the heat map

How did you draw your heatmap?I can't find the code to draw the heatmap.

Pretrained weights

The link for pre-trained weights cannot be opened. Can you upload the new file? Thank you very much!

How it works

How I run on my own computer, not on the server.

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.