SlideShare a Scribd company logo
Transfer Learning
Using
PyTorch
Ankit Gupta
Adarsh Pratik
Transfer learning is a research
problem in machine learning that
focuses on storing knowledge
gained while solving one problem
and applying it to a different but
related problem.
For example,
Knowledge gained while learning to
recognise cars could apply when trying to
recognise trucks.
Framework Used:
PyTorch
Software/Technology used:
Jupyter Notebook,
Python,
Convolutional Neural Network,
PreTrained ResNet Model .
JUPYTER NOTEBOOK
 The Jupyter Notebook is an interactive computing environment that enables
users to author notebook documents that include:
 Live code
 Interactive widgets
 Plots
 Narrative text
 Equations
 Images
 Video
 Jupyter Notebook is great for the following use cases:
 learn and try out Python
 data processing / transformation
 numeric simulation
 statistical modeling
 machine learning

 Python

 Python is a popular platform used for research and development of production systems. It is a vast
language with number of modules, packages and libraries that provides multiple ways of achieving a
task.
 Python and its libraries like NumPy, SciPy, Scikit-Learn, Matplotlib are used in data science and data
analysis. They are also extensively used for creating scalable machine learning algorithms. Python
implements popular machine learning techniques such as Classification, Regression,
Recommendation, and Clustering.
 Python offers ready-made framework for performing data mining tasks on large volumes of data
effectively in lesser time. It includes several implementations achieved through algorithms such as
linear regression, logistic regression, Naïve Bayes, k-means, K nearest neighbor, and Random Forest.



Convolution Neural Network
 A specific kind of such a deep neural network is the convolutional network, which is commonly
referred to as CNN or ConvNet.It's a deep, feed-forward artificial neural network. Remember that
feed-forward neural networks are also called multi-layer perceptrons(MLPs), which are the
quintessential deep learning models. The models are called "feed-forward" because information
fl�ows right through the model. There are no feedback connections in which outputs of the model
are fed back into itself.
 Convolutional neural networks have been one of the most influential innovations in the field of
computer vision. They have performed a lot better than traditional computer vision and have
produced state-of-the-art results. These neural networks have proven to be successful in many
different real-life case studies and applications, like:

 Image classification, object detection, segmentation, face recognition;
 Self driving cars that leverage CNN based vision systems;
 Classification of crystal structure using a convolutional neural network;
 And many more.
RESNET
 Residual Networks are important because (1) they have shown superior performance in ImageNet
and (2) they have shown that you can create extremely deep layers of neural networks. The first
result is an indicator of the value of pass through network elements. The second result has
ramifications also in recurrent networks because RNNs are implicitly deep.
PyTorch
The name PyTorch is inspired from popular library Torch, which was written in Lua.
The first key feature of PyTorch is imperative programming. An imperative program
performs computation as you type it.
The second key feature of PyTorch is Dynamic computational graphs. PyTorch is defined
by run, which means the graph structure is generated at runtime. These graphs arise
whenever the amount of work that needs to be done is variable.
Data Flow
1. Download the dataset
2. Data augmentation.
3. Downloading pre-trained ResNet model (Transfer learning)
4. Training the model on the dataset
5. How to decay the learning rate for every nth epoch
Imports needed
from __future__ import print_function , division
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
import numpy as np
import torchvision
from torchvision import datasets, models, transforms
import matplotlib.pyplot as plt
import time
import os
import copy
Data Augmentation
Data augmentation is a process where you make changes to existing photos like
adjusting the colors , flipping it horizontally or vertically , scaling , cropping and
many more.
Pytorch provides a very useful library called torchvision.transforms which
provides a lot of methods which helps to apply data augmentation. transforms
comes with a compose method which takes a list of transformation.
Training and Validating data
data_transforms = {
'train': transforms.Compose([
transforms.RandomResizedCrop(224),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize([0.485,0.456, 0.406], [0.229, 0.224, 0.225 ])
]),
'val':transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406],[0.229, 0.224, 0.225])
]),
}
Visualising image after augmentation
Train and Evaluate
model_ft =
train_model(model_ft,
criterion, optimizer_ft,
exp_lr_scheduler,
num_epochs=25)
Conclusion
visualize_model(model_conv)
plt.ioff()
plt.show()
Transfer Leaning Using Pytorch  synopsis Minor project pptx
Source code of the project on :
https://github.com/ankitAMD/1Ant_Bees_classification_Pytorch
Transfer Leaning Using Pytorch  synopsis Minor project pptx

More Related Content

PDF
Introduction To TensorFlow
Spotle.ai
 
PDF
Tensorflowv5.0
Sanjib Basak
 
PDF
DATA VISUALIZATION USING MATPLOTLIB (PYTHON)
Mohammed Anzil
 
PDF
TensorFlow and Keras: An Overview
Poo Kuan Hoong
 
PPTX
Daniel Shank, Data Scientist, Talla at MLconf SF 2016
MLconf
 
PDF
Erin LeDell, Machine Learning Scientist, H2O.ai at MLconf ATL 2016
MLconf
 
PDF
1645 goldenberg using our laptop
Rising Media, Inc.
 
PPTX
Deep learning with Tensorflow in R
mikaelhuss
 
Introduction To TensorFlow
Spotle.ai
 
Tensorflowv5.0
Sanjib Basak
 
DATA VISUALIZATION USING MATPLOTLIB (PYTHON)
Mohammed Anzil
 
TensorFlow and Keras: An Overview
Poo Kuan Hoong
 
Daniel Shank, Data Scientist, Talla at MLconf SF 2016
MLconf
 
Erin LeDell, Machine Learning Scientist, H2O.ai at MLconf ATL 2016
MLconf
 
1645 goldenberg using our laptop
Rising Media, Inc.
 
Deep learning with Tensorflow in R
mikaelhuss
 

What's hot (20)

PDF
Transformers in 2021
Grigory Sapunov
 
PDF
Machine learning-course- feb-2017
Gaurav Keswani
 
PDF
Distributed deep learning optimizations
geetachauhan
 
PPTX
TensorFlow in Context
Altoros
 
PPTX
Deep learning with tensorflow
Charmi Chokshi
 
PDF
Deep Learning libraries and first experiments with Theano
Vincenzo Lomonaco
 
PDF
Persian MNIST in 5 Minutes
Shahriar Yazdipour
 
PPTX
TensorFlow Tutorial Part1
Sungjoon Choi
 
PDF
Open-Source Frameworks for Deep Learning: an Overview
Vincenzo Lomonaco
 
PDF
TensorFlow
Sang-Houn Choi
 
PDF
Neural Turing Machines
Kato Yuzuru
 
PDF
FreddyAyalaTorchDomineering
FAYALA1987
 
PDF
Large Scale Deep Learning with TensorFlow
Jen Aman
 
PDF
AI & The Virtuous Cycle of Compute
inside-BigData.com
 
PPTX
A closer look in scipy
Chin Yun Yu
 
PDF
Hussein Mehanna, Engineering Director, ML Core - Facebook at MLconf ATL 2016
MLconf
 
PDF
Nikhil Garg, Engineering Manager, Quora at MLconf SF 2016
MLconf
 
PPTX
Deep Learning: Chapter 11 Practical Methodology
Jason Tsai
 
PPTX
[DL輪読会]Pay Attention to MLPs (gMLP)
Deep Learning JP
 
PPTX
Deep Learning with Microsoft R Open
Poo Kuan Hoong
 
Transformers in 2021
Grigory Sapunov
 
Machine learning-course- feb-2017
Gaurav Keswani
 
Distributed deep learning optimizations
geetachauhan
 
TensorFlow in Context
Altoros
 
Deep learning with tensorflow
Charmi Chokshi
 
Deep Learning libraries and first experiments with Theano
Vincenzo Lomonaco
 
Persian MNIST in 5 Minutes
Shahriar Yazdipour
 
TensorFlow Tutorial Part1
Sungjoon Choi
 
Open-Source Frameworks for Deep Learning: an Overview
Vincenzo Lomonaco
 
TensorFlow
Sang-Houn Choi
 
Neural Turing Machines
Kato Yuzuru
 
FreddyAyalaTorchDomineering
FAYALA1987
 
Large Scale Deep Learning with TensorFlow
Jen Aman
 
AI & The Virtuous Cycle of Compute
inside-BigData.com
 
A closer look in scipy
Chin Yun Yu
 
Hussein Mehanna, Engineering Director, ML Core - Facebook at MLconf ATL 2016
MLconf
 
Nikhil Garg, Engineering Manager, Quora at MLconf SF 2016
MLconf
 
Deep Learning: Chapter 11 Practical Methodology
Jason Tsai
 
[DL輪読会]Pay Attention to MLPs (gMLP)
Deep Learning JP
 
Deep Learning with Microsoft R Open
Poo Kuan Hoong
 
Ad

Similar to Transfer Leaning Using Pytorch synopsis Minor project pptx (20)

PDF
Pytorch A Detailed Overview Agladze Mikhail
ilzobrzan47
 
PDF
PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...
Edureka!
 
PDF
Deep-Learning-with-PydddddddddddddTorch.pdf
drjigarsoni28
 
PPTX
Demystifying-AI-Frameworks-TensorFlow-PyTorch-JAX-and-More (1).pptx
Anant Garg
 
PPTX
Python - Deep Learning library-PyTorch.pptx
akbarsayeedi32
 
PDF
TensorFlow meetup: Keras - Pytorch - TensorFlow.js
Stijn Decubber
 
PDF
Scaling Up AI Research to Production with PyTorch and MLFlow
Databricks
 
PPTX
python_libraries_for_artificial_intelligence.pptx
salehaalsaleh602
 
PPTX
Machine Learning Toolssssssssssssss.pptx
salehaalsaleh602
 
PPTX
Automatic Attendace using convolutional neural network Face Recognition
vatsal199567
 
PDF
PyTorch Deep Learning Framework | USDSI®
USDSI
 
PDF
pytdddddddddddddddddddddddddddddddddorch.pdf
drjigarsoni28
 
PDF
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
Edge AI and Vision Alliance
 
PDF
Python for Image Understanding: Deep Learning with Convolutional Neural Nets
Roelof Pieters
 
PDF
Pytorch for tf_developers
Abdul Muneer
 
PDF
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
Databricks
 
PPTX
hpcpp.pptx
pradhyumnpurohit1
 
PDF
1-pytorch-CNN-RNN.pdf
Andrey63387
 
PDF
Machine learning with py torch
Riza Fahmi
 
PDF
3_Transfer_Learning.pdf
FEG
 
Pytorch A Detailed Overview Agladze Mikhail
ilzobrzan47
 
PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...
Edureka!
 
Deep-Learning-with-PydddddddddddddTorch.pdf
drjigarsoni28
 
Demystifying-AI-Frameworks-TensorFlow-PyTorch-JAX-and-More (1).pptx
Anant Garg
 
Python - Deep Learning library-PyTorch.pptx
akbarsayeedi32
 
TensorFlow meetup: Keras - Pytorch - TensorFlow.js
Stijn Decubber
 
Scaling Up AI Research to Production with PyTorch and MLFlow
Databricks
 
python_libraries_for_artificial_intelligence.pptx
salehaalsaleh602
 
Machine Learning Toolssssssssssssss.pptx
salehaalsaleh602
 
Automatic Attendace using convolutional neural network Face Recognition
vatsal199567
 
PyTorch Deep Learning Framework | USDSI®
USDSI
 
pytdddddddddddddddddddddddddddddddddorch.pdf
drjigarsoni28
 
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
Edge AI and Vision Alliance
 
Python for Image Understanding: Deep Learning with Convolutional Neural Nets
Roelof Pieters
 
Pytorch for tf_developers
Abdul Muneer
 
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
Databricks
 
hpcpp.pptx
pradhyumnpurohit1
 
1-pytorch-CNN-RNN.pdf
Andrey63387
 
Machine learning with py torch
Riza Fahmi
 
3_Transfer_Learning.pdf
FEG
 
Ad

More from Ankit Gupta (20)

PPT
Biometricstechnology in iot and machine learning
Ankit Gupta
 
PDF
Week2 cloud computing week2
Ankit Gupta
 
PDF
Week 8 lecture material
Ankit Gupta
 
PDF
Week 4 lecture material cc (1)
Ankit Gupta
 
PDF
Week 3 lecture material cc
Ankit Gupta
 
PDF
Week 1 lecture material cc
Ankit Gupta
 
PDF
Mod05lec25(resource mgmt ii)
Ankit Gupta
 
PDF
Mod05lec24(resource mgmt i)
Ankit Gupta
 
PDF
Mod05lec23(map reduce tutorial)
Ankit Gupta
 
PDF
Mod05lec22(cloudonomics tutorial)
Ankit Gupta
 
PDF
Mod05lec21(sla tutorial)
Ankit Gupta
 
PDF
Lecture29 cc-security4
Ankit Gupta
 
PDF
Lecture28 cc-security3
Ankit Gupta
 
PDF
Lecture27 cc-security2
Ankit Gupta
 
PDF
Lecture26 cc-security1
Ankit Gupta
 
PDF
Lecture 30 cloud mktplace
Ankit Gupta
 
PDF
Week 7 lecture material
Ankit Gupta
 
PDF
Gurukul Cse cbcs-2015-16
Ankit Gupta
 
PDF
Microprocessor full hand made notes
Ankit Gupta
 
DOC
Intro/Overview on Machine Learning Presentation -2
Ankit Gupta
 
Biometricstechnology in iot and machine learning
Ankit Gupta
 
Week2 cloud computing week2
Ankit Gupta
 
Week 8 lecture material
Ankit Gupta
 
Week 4 lecture material cc (1)
Ankit Gupta
 
Week 3 lecture material cc
Ankit Gupta
 
Week 1 lecture material cc
Ankit Gupta
 
Mod05lec25(resource mgmt ii)
Ankit Gupta
 
Mod05lec24(resource mgmt i)
Ankit Gupta
 
Mod05lec23(map reduce tutorial)
Ankit Gupta
 
Mod05lec22(cloudonomics tutorial)
Ankit Gupta
 
Mod05lec21(sla tutorial)
Ankit Gupta
 
Lecture29 cc-security4
Ankit Gupta
 
Lecture28 cc-security3
Ankit Gupta
 
Lecture27 cc-security2
Ankit Gupta
 
Lecture26 cc-security1
Ankit Gupta
 
Lecture 30 cloud mktplace
Ankit Gupta
 
Week 7 lecture material
Ankit Gupta
 
Gurukul Cse cbcs-2015-16
Ankit Gupta
 
Microprocessor full hand made notes
Ankit Gupta
 
Intro/Overview on Machine Learning Presentation -2
Ankit Gupta
 

Recently uploaded (20)

PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Doc9.....................................
SofiaCollazos
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 

Transfer Leaning Using Pytorch synopsis Minor project pptx

  • 2. Transfer learning is a research problem in machine learning that focuses on storing knowledge gained while solving one problem and applying it to a different but related problem. For example, Knowledge gained while learning to recognise cars could apply when trying to recognise trucks.
  • 3. Framework Used: PyTorch Software/Technology used: Jupyter Notebook, Python, Convolutional Neural Network, PreTrained ResNet Model .
  • 4. JUPYTER NOTEBOOK  The Jupyter Notebook is an interactive computing environment that enables users to author notebook documents that include:  Live code  Interactive widgets  Plots  Narrative text  Equations  Images  Video  Jupyter Notebook is great for the following use cases:  learn and try out Python  data processing / transformation  numeric simulation  statistical modeling  machine learning 
  • 5.  Python   Python is a popular platform used for research and development of production systems. It is a vast language with number of modules, packages and libraries that provides multiple ways of achieving a task.  Python and its libraries like NumPy, SciPy, Scikit-Learn, Matplotlib are used in data science and data analysis. They are also extensively used for creating scalable machine learning algorithms. Python implements popular machine learning techniques such as Classification, Regression, Recommendation, and Clustering.  Python offers ready-made framework for performing data mining tasks on large volumes of data effectively in lesser time. It includes several implementations achieved through algorithms such as linear regression, logistic regression, Naïve Bayes, k-means, K nearest neighbor, and Random Forest.   
  • 6. Convolution Neural Network  A specific kind of such a deep neural network is the convolutional network, which is commonly referred to as CNN or ConvNet.It's a deep, feed-forward artificial neural network. Remember that feed-forward neural networks are also called multi-layer perceptrons(MLPs), which are the quintessential deep learning models. The models are called "feed-forward" because information fl�ows right through the model. There are no feedback connections in which outputs of the model are fed back into itself.  Convolutional neural networks have been one of the most influential innovations in the field of computer vision. They have performed a lot better than traditional computer vision and have produced state-of-the-art results. These neural networks have proven to be successful in many different real-life case studies and applications, like:   Image classification, object detection, segmentation, face recognition;  Self driving cars that leverage CNN based vision systems;  Classification of crystal structure using a convolutional neural network;  And many more.
  • 7. RESNET  Residual Networks are important because (1) they have shown superior performance in ImageNet and (2) they have shown that you can create extremely deep layers of neural networks. The first result is an indicator of the value of pass through network elements. The second result has ramifications also in recurrent networks because RNNs are implicitly deep.
  • 8. PyTorch The name PyTorch is inspired from popular library Torch, which was written in Lua. The first key feature of PyTorch is imperative programming. An imperative program performs computation as you type it. The second key feature of PyTorch is Dynamic computational graphs. PyTorch is defined by run, which means the graph structure is generated at runtime. These graphs arise whenever the amount of work that needs to be done is variable.
  • 9. Data Flow 1. Download the dataset 2. Data augmentation. 3. Downloading pre-trained ResNet model (Transfer learning) 4. Training the model on the dataset 5. How to decay the learning rate for every nth epoch
  • 10. Imports needed from __future__ import print_function , division import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler import numpy as np import torchvision from torchvision import datasets, models, transforms import matplotlib.pyplot as plt import time import os import copy
  • 11. Data Augmentation Data augmentation is a process where you make changes to existing photos like adjusting the colors , flipping it horizontally or vertically , scaling , cropping and many more. Pytorch provides a very useful library called torchvision.transforms which provides a lot of methods which helps to apply data augmentation. transforms comes with a compose method which takes a list of transformation.
  • 12. Training and Validating data data_transforms = { 'train': transforms.Compose([ transforms.RandomResizedCrop(224), transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize([0.485,0.456, 0.406], [0.229, 0.224, 0.225 ]) ]), 'val':transforms.Compose([ transforms.Resize(256), transforms.CenterCrop(224), transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406],[0.229, 0.224, 0.225]) ]), }
  • 13. Visualising image after augmentation
  • 14. Train and Evaluate model_ft = train_model(model_ft, criterion, optimizer_ft, exp_lr_scheduler, num_epochs=25)
  • 17. Source code of the project on : https://github.com/ankitAMD/1Ant_Bees_classification_Pytorch