Can you check my cifar10 pytorch tranning?

username: Sangwon_Jake
cooked: <p>when I submit my final submission file to the kaggle it only get 10%<br>
but my validation accuracy is over 90 %</p>
<p>I’m quite new to pytorch so I want check is there something wrong <br><br>
I got final submission code score around 10% <br></p>
<p>here is my code <br></p>
<pre><code>train_transform = transforms.Compose([
    transforms.Resize(224),
    transforms.RandomHorizontalFlip(p=.40),
    transforms.RandomRotation(30),
    transforms.ToTensor(),
    transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])

test_transform = transforms.Compose([
    transforms.Resize(224),
    transforms.ToTensor(),
    transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])

traindata = torchvision.datasets.CIFAR10(root='/mnt/3CE35B99003D727B/input/datasets/', train=True,download=False, transform=train_transform)
trainset,valset = random_split(traindata,[42000,8000])
trainloader = torch.utils.data.DataLoader(trainset, batch_size=batch_size,shuffle=True)
valloader = torch.utils.data.DataLoader(valset, batch_size=batch_size,shuffle=False)

testset = torchvision.datasets.CIFAR10(root='/mnt/3CE35B99003D727B/input/datasets/', train=False,download=False, transform=test_transform)
testloader = torch.utils.data.DataLoader(testset, batch_size=batch_size,shuffle=False)

device = 'cuda' if torch.cuda.is_available() else 'cpu'

torch.manual_seed(777)
if device =='cuda':
    torch.cuda.manual_seed_all(777)
device

class Model(nn.Module):
    def __init__(self):
        super().__init__()
        base = models.resnet18(pretrained=True)
        self.base = nn.Sequential(*list(base.children())[:-1])
        in_features = base.fc.in_features
        self.drop = nn.Dropout()
        self.final = nn.Linear(in_features,10)
    
    def forward(self,x):
        x = self.base(x)
        x = self.drop(x.view(-1,self.final.in_features))
        return self.final(x)
    
model = Model().cuda()
[x for x,y in model.named_children()]


criterion = nn.CrossEntropyLoss()
param_groups = [
    {'params':model.base.parameters(),'lr':.0001},
    {'params':model.final.parameters(),'lr':.001}
]
optimizer = Adam(param_groups)
lr_scheduler = lr_scheduler.StepLR(optimizer, step_size=1, gamma=0.1)
states = {}

%%time
best_val_acc = -1000
best_val_model = None
print("start")
for epoch in range(10):  
    model.train(True)
    running_loss = 0.0
    running_acc = 0
    
    
    for i, data in enumerate(trainloader, 0):
        inputs, labels = data
        inputs, labels = inputs.cuda(),labels.cuda()

        optimizer.zero_grad()
        outputs = model(inputs)
        loss = criterion(outputs, labels)
        loss.backward()
        optimizer.step()

        # print statistics
        running_loss += loss.item() * inputs.size(0)
        out = torch.argmax(outputs.detach(),dim=1)
        assert out.shape==labels.shape
        running_acc += (labels==out).sum().item()
    print(f"Train loss {epoch+1}: {running_loss/len(trainset)},Train Acc:{running_acc*100/len(trainset)}%")
    
    correct = 0
    model.train(False)
    with torch.no_grad():
        for inputs,labels in valloader:
            out = model(inputs.cuda()).cpu()
            out = torch.argmax(out,dim=1)
            acc = (out==labels).sum().item()
            correct += acc
    print(f"Val accuracy:{correct*100/len(valset)}%")
    if correct&gt;best_val_acc:
        best_val_acc = correct
        best_val_model = deepcopy(model.state_dict())
    lr_scheduler.step()
    
    torch.save(model.state_dict(), PATH)

print('Finished Training')

from torch.autograd import Variable
results = []
print("start")
i = 0
with torch.no_grad():
    model.eval()
    for num, data in enumerate(test_loader):
        imgs, label = data
        imgs,labels = imgs.to(device), label.to(device)
        output = model(imgs).cpu()
        _, preds_tensor = torch.max(output,dim=1)
        results += preds_tensor.tolist()
print('finish')
</code></pre>
<p>ans then my making submission code <br></p>
<blockquote>
<p><a href="https://www.kaggle.com/c/cifar-10/submit" class="inline-onebox" rel="noopener nofollow ugc">CIFAR-10 - Object Recognition in Images | Kaggle</a></p>
</blockquote>

username: ptrblck
cooked: <p>Most likely your model overfits to the training and validation set, and gives a bad test result.<br>
However, the decreases in accuracy is quite bad, so could you check the outputs for the test set?<br>
Is your model predicting only a single class?</p>