Views
No views yet
| Layer (Type) | Output Shape | Parameters |
|---|---|---|
| Conv2d-1 | [-1, 32, 224, 224] | 896 |
| ReLU-2 | [-1, 32, 224, 224] | 0 |
| BatchNorm2d-3 | [-1, 32, 224, 224] | 64 |
| Conv2d-4 | [-1, 32, 224, 224] | 9,248 |
| ReLU-5 | [-1, 32, 224, 224] | 0 |
| BatchNorm2d-6 | [-1, 32, 224, 224] | 64 |
| MaxPool2d-7 | [-1, 32, 112, 112] | 0 |
| Conv2d-8 | [-1, 64, 112, 112] | 18,496 |
| ReLU-9 | [-1, 64, 112, 112] | 0 |
| BatchNorm2d-10 | [-1, 64, 112, 112] | 128 |
| Conv2d-11 | [-1, 64, 112, 112] | 36,928 |
| ReLU-12 | [-1, 64, 112, 112] | 0 |
| BatchNorm2d-13 | [-1, 64, 112, 112] | 128 |
| MaxPool2d-14 | [-1, 64, 56, 56] | 0 |
| Conv2d-15 | [-1, 128, 56, 56] | 73,856 |
| ReLU-16 | [-1, 128, 56, 56] | 0 |
| BatchNorm2d-17 | [-1, 128, 56, 56] | 256 |
| Conv2d-18 | [-1, 128, 56, 56] | 147,584 |
| ReLU-19 | [-1, 128, 56, 56] | 0 |
| BatchNorm2d-20 | [-1, 128, 56, 56] | 256 |
| MaxPool2d-21 | [-1, 128, 28, 28] | 0 |
| Conv2d-22 | [-1, 256, 28, 28] | 295,168 |
| ReLU-23 | [-1, 256, 28, 28] | 0 |
| BatchNorm2d-24 | [-1, 256, 28, 28] | 512 |
| Conv2d-25 | [-1, 256, 28, 28] | 590,080 |
| ReLU-26 | [-1, 256, 28, 28] | 0 |
| BatchNorm2d-27 | [-1, 256, 28, 28] | 512 |
| MaxPool2d-28 | [-1, 256, 14, 14] | 0 |
| Dropout-29 | [-1, 50176] | 0 |
| Linear-30 | [-1, 1024] | 51,381,248 |
| ReLU-31 | [-1, 1024] | 0 |
| Dropout-32 | [-1, 1024] | 0 |
| Linear-33 | [-1, 39] | 39,975 |
1import torch
2
3# Load the model (assuming the model file is `plant_disease_model.pth`)
4model = torch.load('plant_disease_model.pth')
5model.eval()
6
7# Example usage with a sample image
8from PIL import Image
9from torchvision import transforms
10
11# Preprocess the image
12transform = transforms.Compose([
13 transforms.Resize((224, 224)),
14 transforms.ToTensor(),
15 transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
16])
17
18image = Image.open('sample_leaf.jpg')
19input_tensor = transform(image).unsqueeze(0) # Add batch dimension
20
21# Make prediction
22with torch.no_grad():
23 output = model(input_tensor)
24 predicted_class = output.argmax(dim=1).item()
25
26print(f"Predicted Class: {predicted_class}")
27
28
29**Web**: [Link](https://plant-dd-co9k.onrender.com)