| license: mit | |
| ## Introduction | |
| MNIST_LeNet is a CNN model used for handwriting recognization. | |
| This model is trained with traditional MNIST dataset, which is included in PyTorch as default. | |
| As a result, it could achieve 99.5% accuracy among handwriting recognization tasks. | |
| ## Hands on | |
| ```python3 | |
| import torch | |
| LeNet = torch.load('path/to/model/mnist_lenet.pt') | |
| LeNet.eval() | |
| # config preprocessor for your data | |
| transform = ... | |
| # load data | |
| input_data = transform(open('path/to/your/data')) | |
| # predict with our model | |
| with torch.no_grad(): | |
| output = LeNet(input_data) | |
| # explain results | |
| prob = torch.nn.functional.softmax(output[0], dim=0) | |
| ... | |
| ``` | |
| ## Reference | |
| - [LeNet Paper: GradientBased Learning Applied to Document | |
| Recognition(1998)](http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf) | |