Using Predefined and Pretrained CNNs in PyTorch

Tutorial with Code

Rachel Draelos, MD, PhD
Towards Data Science
9 min readDec 8, 2020

--

This is a photo of Habitat 67 from Wikimedia Commons (license: CC)

At the end of this tutorial you should be able to:

  • Load randomly initialized or pre-trained CNNs with PyTorch torchvision.models (ResNet, VGG, etc.)
  • Select out only part of a pre-trained CNN, e.g. only the convolutional feature extractor
  • Automatically calculate the number of…

--

--

CEO at Cydoc | Physician Scientist | MD + Computer Science PhD | AI/ML Innovator