Giter Site home page Giter Site logo

salehahmedshafin / pytorch-custom-cnn-model Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 15 KB

The architecture is a deep neural network for image processing, composed of convolutional layers capturing features, followed by pooling and fully connected layers. It uses ReLU activation, dropout for regularization, and ends with a linear output layer for classification.

Jupyter Notebook 100.00%
cnn cnn-classification cnn-for-visual-recognition custom-cnn pytorch

pytorch-custom-cnn-model's Introduction

Pytorch-Custom-CNN-model

Dataset-
It is a medical images directory structure branched into 3 subfolders (COVID, NORMAL, PNEUMONIA) which contains the Chest X-ray (CXR) Images.
COVID: 1626 images
NORMAL: 1802 images
PNEUMONIA: 1800 images
Original Dataset Link- https://www.kaggle.com/datasets/sachinkumar413/covid-pneumonia-normal-chest-xray-images
In the Dataset folder contains customized dataset which is splitting the whole dataset into three parts-

1- Training (70%)
2- Validation (15%)
3- Testing (15%)

Model Architecture:

CNN(
(conv_layers): Sequential(
(0): Conv2d(3, 16, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): ReLU()
(2): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(3): Conv2d(16, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(4): ReLU()
(5): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(6): Conv2d(32, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(7): ReLU()
(8): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(9): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(10): ReLU()
(11): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
)
(fc_layers): Sequential(
(0): Linear(in_features=25088, out_features=512, bias=True)
(1): ReLU()
(2): Dropout(p=0.2, inplace=False)
(3): Linear(in_features=512, out_features=256, bias=True)
(4): ReLU()
(5): Dropout(p=0.2, inplace=False)
(6): Linear(in_features=256, out_features=128, bias=True)
(7): ReLU()
(8): Dropout(p=0.2, inplace=False)
(9): Linear(in_features=128, out_features=3, bias=True)
)
)

There are 4 Conv2d layers and 4 Linear Layer and use MaxPool in the pooling layer

Model Summary:

Layer (type) Output Shape Param #
Conv2d-1 [-1, 16, 224, 224] 448
ReLU-2 [-1, 16, 224, 224] 0
MaxPool2d-3 [-1, 16, 112, 112] 0
Conv2d-4 [-1, 32, 112, 112] 4,640
ReLU-5 [-1, 32, 112, 112] 0
MaxPool2d-6 [-1, 32, 56, 56] 0
Conv2d-7 [-1, 64, 56, 56] 18,496
ReLU-8 [-1, 64, 56, 56] 0
MaxPool2d-9 [-1, 64, 28, 28] 0
Conv2d-10 [-1, 128, 28, 28] 73,856
ReLU-11 [-1, 128, 28, 28] 0
MaxPool2d-12 [-1, 128, 14, 14] 0
Linear-13 [-1, 512] 12,845,568
ReLU-14 [-1, 512] 0
Dropout-15 [-1, 512] 0
Linear-16 [-1, 256] 131,328
ReLU-17 [-1, 256] 0
Dropout-18 [-1, 256] 0
Linear-19 [-1, 128] 32,896
ReLU-20 [-1, 128] 0
Dropout-21 [-1, 128] 0
Linear-22 [-1, 3] 387
Total params 13,107,619
Trainable params 13,107,619
Non-trainable params 0
Input size (MB) 0.57
Forward/backward pass size (MB) 25.86
Params size (MB) 50.00
Estimated Total Size (MB) 76.44

pytorch-custom-cnn-model's People

Contributors

salehahmedshafin avatar

Stargazers

 avatar

Watchers

Kostas Georgiou 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.