Deep Learning with PyTorch: Build, Train and Deploy an Image Classifier | Step-by-Step Tutorial
In this workshop, Alexey Grigorev, creator of the Machine Learning ZoomCamp, walks through how to build an image classification model in PyTorch from scratch using a fashion dataset as a real-world example. This session dives deep into the fundamentals of PyTorch, transfer learning, and model optimization, contrasting the framework’s flexibility and low-level control with the simplicity of Keras.
You’ll learn about:
– Setting up your PyTorch environment on Google Colab with GPU acceleration
– Loading and preprocessing images using Pillow, NumPy, and Torchvision
– Leveraging pretrained models (MobileNet V2) and applying transfer learning
– Writing a custom Dataset class and DataLoaders for batching and shuffling
– Building and training a 10-class image classifier from the MobileNet base
– Implementing checkpointing, dropout, and data augmentation to prevent overfitting
– Exporting the final model to ONNX format for serverless deployment
Links:
– Course: https://github.com/DataTalksClub/machine-learning-zoomcamp/
– Workshop: https://github.com/alexeygrigorev/workshops/tree/main/mlzoomcamp-deep-learning
– Colab: https://colab.research.google.com/
TIMESTAMPS:
00:00 Intro to PyTorch, Image Classification, and ML ZoomCamp
04:10 PyTorch vs Keras: Complexity and Popularity Explained
07:45 Loading Images and Converting to NumPy and Tensors
10:50 Using MobileNet V2 and ImageNet Pretrained Models
14:05 Image Preprocessing: Resize, Crop, and Normalize
17:10 Unsqueeze Explained: Prepping Inputs for Batching
21:00 From ImageNet to Fashion: Transfer Learning Setup
24:45 Building a Custom PyTorch Dataset Class
27:50 Creating DataLoaders for Batching and Shuffling
31:00 Freezing MobileNet and Adding a 10-Class Output Layer
34:30 Writing the PyTorch Training Loop vs model.fit
39:45 Running Validation and Measuring Model Accuracy
44:15 Tuning the Learning Rate for Better Training
48:40 Model V2: Adding an Inner Layer for Optimization
52:40 Saving Progress with Model Checkpointing
01:00:30 Regularization V3: Using Dropout to Prevent Overfitting
01:05:50 Regularization V4: Data Augmentation for More Training Data
01:10:25 Why Validation Data Shouldn’t Use Augmentation
01:17:00 Loading Checkpoints and Making Final Predictions
01:21:55 Exporting to ONNX for Serverless Model Deployment
This talk is ideal for data scientists, ML engineers, and AI enthusiasts eager to deepen their understanding of PyTorch and model deployment workflows. Whether you’re transitioning from Keras/TensorFlow or building production-ready models, this session provides practical, hands-on insights for mastering deep learning with PyTorch.
Connect with DataTalks.Club:
– Join the community – https://datatalks.club/slack.html
– Subscribe to our Google calendar to have all our events in your calendar – https://calendar.google.com/calendar/r?cid=ZjhxaWRqbnEwamhzY3A4ODA5azFlZ2hzNjBAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ
– Check other upcoming events – https://lu.ma/dtc-events
– GitHub: https://github.com/DataTalksClub
– LinkedIn – https://www.linkedin.com/company/datatalks-club/
– Twitter – https://twitter.com/DataTalksClub
– Website – https://datatalks.club/
Connect with Alexey
– Twitter – https://twitter.com/Al_Grigor
– Linkedin – https://www.linkedin.com/in/agrigorev/
Check our free online courses:
– ML Engineering course – http://mlzoomcamp.com
– Data Engineering course – https://github.com/DataTalksClub/data-engineering-zoomcamp
– MLOps course – https://github.com/DataTalksClub/mlops-zoomcamp
– LLM course – https://github.com/DataTalksClub/llm-zoomcamp
– Open-source LLM course: https://github.com/DataTalksClub/open-source-llm-zoomcamp
– AI Dev Tools course: https://github.com/DataTalksClub/ai-dev-tools-zoomcamp
👉🏼 Read about all our courses in one place – https://datatalks.club/blog/guide-to-free-online-courses-at-datatalks-club.html
👋🏼 Support/inquiries
If you want to support our community, use this link – https://github.com/sponsors/alexeygrigorev
If you’re a company, reach us at [email protected]
#PyTorch #MachineLearning #DeepLearning #ImageClassification #TransferLearning #MobileNetV2 #Torchvision #DataAugmentation #Dropout #Checkpointing #ONNX #AIEngineering #MLZoomCamp #GoogleColab #NeuralNetworks #ComputerVision #KerasVsPyTorch #ModelDeployment #DeepLearningTutorial #PyTorchTutorial
source
