Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Modern Computer Vision with PyTorch

You're reading from   Modern Computer Vision with PyTorch Explore deep learning concepts and implement over 50 real-world image applications

Arrow left icon
Product type Paperback
Published in Nov 2020
Publisher Packt
ISBN-13 9781839213472
Length 824 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Yeshwanth Reddy Yeshwanth Reddy
Author Profile Icon Yeshwanth Reddy
Yeshwanth Reddy
V Kishore Ayyadevara V Kishore Ayyadevara
Author Profile Icon V Kishore Ayyadevara
V Kishore Ayyadevara
Arrow right icon
View More author details
Toc

Table of Contents (25) Chapters Close

Preface 1. Section 1 - Fundamentals of Deep Learning for Computer Vision
2. Artificial Neural Network Fundamentals FREE CHAPTER 3. PyTorch Fundamentals 4. Building a Deep Neural Network with PyTorch 5. Section 2 - Object Classification and Detection
6. Introducing Convolutional Neural Networks 7. Transfer Learning for Image Classification 8. Practical Aspects of Image Classification 9. Basics of Object Detection 10. Advanced Object Detection 11. Image Segmentation 12. Applications of Object Detection and Segmentation 13. Section 3 - Image Manipulation
14. Autoencoders and Image Manipulation 15. Image Generation Using GANs 16. Advanced GANs to Manipulate Images 17. Section 4 - Combining Computer Vision with Other Techniques
18. Training with Minimal Data Points 19. Combining Computer Vision and NLP Techniques 20. Combining Computer Vision and Reinforcement Learning 21. Moving a Model to Production 22. Using OpenCV Utilities for Image Analysis 23. Other Books You May Enjoy Appendix

Understanding the impact of varying the loss optimizer

So far, we have been optimizing loss based on the Adam optimizer. In this section, we will do the following:

  • Modify the optimizer so that it becomes a Stochastic Gradient Descent (SGD) optimizer
  • Revert to a batch size of 32 while fetching data in the DataLoader
  • Increase the number of epochs to 10 (so that we can compare the performance of SGD and Adam over a longer number of epochs)

Making these changes means that only one step in the Batch size of 32 section will change (since the batch size is already 32 in the Batch size of 32 section); that is, we will modify the optimizer so that it's the SGD optimizer.

Let's modify the get_model function in step 4 of the Batch size of 32 section in order to modify the optimzier so that we're using the SGD optimizer instead, as follows:

The following code is available as Varying_loss_optimizer.ipynb in the Chapter03 folder of this book's GitHub repository - https://tinyurl...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime