YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Simple MNIST CNN Model (Single FC Layer) This is a PyTorch CNN model with a single Fully Connected layer for MNIST digit classification. Model Details
Dataset: MNIST (28x28 grayscale digit images) Architecture: 2 Conv2d layers, 2 MaxPooling layers, 1 FC layer Accuracy: ~97-98% on test set File: mnist_cnn_single_fc.pth (model weights)
Usage import torch import torch.nn as nn
class SimpleCNN(nn.Module): def init(self): super(SimpleCNN, self).init() self.conv1 = nn.Conv2d(1, 32, kernel_size=3, padding=1) self.pool1 = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(32, 64, kernel_size=3, padding=1) self.pool2 = nn.MaxPool2d(2, 2) self.fc = nn.Linear(64 * 7 * 7, 10)
def forward(self, x):
x = torch.relu(self.conv1(x))
x = self.pool1(x)
x = torch.relu(self.conv2(x))
x = self.pool2(x)
x = x.view(-1, 64 * 7 * 7)
x = self.fc(x)
return x
model = SimpleCNN() model.load_state_dict(torch.load('mnist_cnn_single_fc.pth')) model.eval()