How to increase the accuracy of model from chapter 04. PyTorch Custom Datasets #1317
Unanswered
nabeelalikhan0
asked this question in
Q&A
Replies: 1 comment
-
|
Hi @nabeelalikhan0 , What does your dataset look like? Can you share some example images? Have you tried increasing the size of the network? (e.g. adding more layers) If that doesn't work you could try to use transfer learning and see if that helps: https://www.learnpytorch.io/06_pytorch_transfer_learning/ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I tried many regularization techniques to fix this but...
Epoch: 50 | Train Loss: 0.5506 | Train Acc: 0.8003 | Test Loss: 1.6564 | Test Acc: 0.1875
Total training time: 44.556 seconds
that's the max i got
`
class Model_1(nn.Module):
def init(self,input_shape:int,hidden_units:int,output_shape:int):
super().init()
self.block_1 = nn.Sequential(
nn.Conv2d(input_shape,hidden_units,3,1,1),
nn.BatchNorm2d(hidden_units),
nn.ReLU(),
nn.Conv2d(hidden_units,hidden_units,3,1,1),
nn.BatchNorm2d(hidden_units),
nn.ReLU(),
nn.Conv2d(hidden_units,hidden_units,3,1,1),
nn.BatchNorm2d(hidden_units),
nn.ReLU(),
nn.MaxPool2d(2,2)
)
torch.manual_seed(42)
model = Model_1(3,10,len(classes_names)).to(device)
model
`
And this is my dataset
(Dataset ImageFolder Number of datapoints: 349 Root location: data\images\train StandardTransform Transform: Compose( Resize(size=(96, 96), interpolation=bilinear, max_size=None, antialias=True) TrivialAugmentWide(num_magnitude_bins=31, interpolation=InterpolationMode.NEAREST, fill=None) ToTensor() ), Dataset ImageFolder Number of datapoints: 100 Root location: data\images\test StandardTransform Transform: Compose( Resize(size=(96, 96), interpolation=bilinear, max_size=None, antialias=True) ToTensor() ))Thankyou!
Beta Was this translation helpful? Give feedback.
All reactions