Skip to content

This repo describes how to train the LeNet CNN model using Pytorch

Notifications You must be signed in to change notification settings

vanhao-le/LeNet-Pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CNN-Pytorch

How to train a CNN network with Pytorch

  1. Project structure

project structure

We have 4 python files here:

  • /model/LeNet.py: This is our model architecture based on the LeNet model.
  • /chip/config.py: The script uses for configuration.
  • train.py: Trains our model on the KMINIT dataset using PyTorch. The trained model will be saved in the /output/model.pth directory.
  • inference.py: loads our model and makes predictions on testing images.
  1. The pipeline to train the CNN model

2.1. Define our model architechture

2.2. Load the dataset from disk

2.3. Loop over epochs and batches

2.4. Train the model with a forward() step

2.5. Reset gradient zero_gradient(), perform backward() propagation and update the parameters.

The results after 5 epochs training with batch_size 16.

Alt text

About

This repo describes how to train the LeNet CNN model using Pytorch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages