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
PDF
Tensorflowv5.0
PDF
DATA VISUALIZATION USING MATPLOTLIB (PYTHON)
PDF
TensorFlow and Keras: An Overview
PPTX
Daniel Shank, Data Scientist, Talla at MLconf SF 2016
PDF
Erin LeDell, Machine Learning Scientist, H2O.ai at MLconf ATL 2016
PDF
1645 goldenberg using our laptop
PPTX
Deep learning with Tensorflow in R
Introduction To TensorFlow
Tensorflowv5.0
DATA VISUALIZATION USING MATPLOTLIB (PYTHON)
TensorFlow and Keras: An Overview
Daniel Shank, Data Scientist, Talla at MLconf SF 2016
Erin LeDell, Machine Learning Scientist, H2O.ai at MLconf ATL 2016
1645 goldenberg using our laptop
Deep learning with Tensorflow in R

What's hot (20)

PDF
Transformers in 2021
PDF
Machine learning-course- feb-2017
PDF
Distributed deep learning optimizations
PPTX
TensorFlow in Context
PPTX
Deep learning with tensorflow
PDF
Deep Learning libraries and first experiments with Theano
PDF
Persian MNIST in 5 Minutes
PPTX
TensorFlow Tutorial Part1
PDF
Open-Source Frameworks for Deep Learning: an Overview
PDF
TensorFlow
PDF
Neural Turing Machines
PDF
FreddyAyalaTorchDomineering
PDF
Large Scale Deep Learning with TensorFlow
PDF
AI & The Virtuous Cycle of Compute
PPTX
A closer look in scipy
PDF
Hussein Mehanna, Engineering Director, ML Core - Facebook at MLconf ATL 2016
PDF
Nikhil Garg, Engineering Manager, Quora at MLconf SF 2016
PPTX
Deep Learning: Chapter 11 Practical Methodology
PPTX
[DL輪読会]Pay Attention to MLPs (gMLP)
PPTX
Deep Learning with Microsoft R Open
Transformers in 2021
Machine learning-course- feb-2017
Distributed deep learning optimizations
TensorFlow in Context
Deep learning with tensorflow
Deep Learning libraries and first experiments with Theano
Persian MNIST in 5 Minutes
TensorFlow Tutorial Part1
Open-Source Frameworks for Deep Learning: an Overview
TensorFlow
Neural Turing Machines
FreddyAyalaTorchDomineering
Large Scale Deep Learning with TensorFlow
AI & The Virtuous Cycle of Compute
A closer look in scipy
Hussein Mehanna, Engineering Director, ML Core - Facebook at MLconf ATL 2016
Nikhil Garg, Engineering Manager, Quora at MLconf SF 2016
Deep Learning: Chapter 11 Practical Methodology
[DL輪読会]Pay Attention to MLPs (gMLP)
Deep Learning with Microsoft R Open
Ad

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

PDF
Pytorch A Detailed Overview Agladze Mikhail
PDF
PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...
PDF
Deep-Learning-with-PydddddddddddddTorch.pdf
PPTX
Demystifying-AI-Frameworks-TensorFlow-PyTorch-JAX-and-More (1).pptx
PPTX
Python - Deep Learning library-PyTorch.pptx
PDF
TensorFlow meetup: Keras - Pytorch - TensorFlow.js
PDF
Scaling Up AI Research to Production with PyTorch and MLFlow
PPTX
python_libraries_for_artificial_intelligence.pptx
PPTX
Machine Learning Toolssssssssssssss.pptx
PPTX
Automatic Attendace using convolutional neural network Face Recognition
PDF
PyTorch Deep Learning Framework | USDSI®
PDF
pytdddddddddddddddddddddddddddddddddorch.pdf
PDF
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
PDF
Python for Image Understanding: Deep Learning with Convolutional Neural Nets
PDF
Pytorch for tf_developers
PDF
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
PPTX
hpcpp.pptx
PDF
1-pytorch-CNN-RNN.pdf
PDF
Machine learning with py torch
PDF
3_Transfer_Learning.pdf
 
Pytorch A Detailed Overview Agladze Mikhail
PyTorch Python Tutorial | Deep Learning Using PyTorch | Image Classifier Usin...
Deep-Learning-with-PydddddddddddddTorch.pdf
Demystifying-AI-Frameworks-TensorFlow-PyTorch-JAX-and-More (1).pptx
Python - Deep Learning library-PyTorch.pptx
TensorFlow meetup: Keras - Pytorch - TensorFlow.js
Scaling Up AI Research to Production with PyTorch and MLFlow
python_libraries_for_artificial_intelligence.pptx
Machine Learning Toolssssssssssssss.pptx
Automatic Attendace using convolutional neural network Face Recognition
PyTorch Deep Learning Framework | USDSI®
pytdddddddddddddddddddddddddddddddddorch.pdf
"PyTorch Deep Learning Framework: Status and Directions," a Presentation from...
Python for Image Understanding: Deep Learning with Convolutional Neural Nets
Pytorch for tf_developers
A Tale of Three Deep Learning Frameworks: TensorFlow, Keras, & PyTorch with B...
hpcpp.pptx
1-pytorch-CNN-RNN.pdf
Machine learning with py torch
3_Transfer_Learning.pdf
 
Ad

More from Ankit Gupta (20)

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

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
A Presentation on Artificial Intelligence
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Review of recent advances in non-invasive hemoglobin estimation
Big Data Technologies - Introduction.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
NewMind AI Monthly Chronicles - July 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Per capita expenditure prediction using model stacking based on satellite ima...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
A Presentation on Artificial Intelligence
The AUB Centre for AI in Media Proposal.docx
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Unlocking AI with Model Context Protocol (MCP)
Diabetes mellitus diagnosis method based random forest with bat algorithm
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Review of recent advances in non-invasive hemoglobin estimation

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