This is probably a human error but i would like to note down accuracy of AlexNet with already trained networks and then replace conv layers with my custom layers and note down results again.
I can find AlexNet and pre_trained weights here [AlexNet] 6
The Datasets are downloaded from here [AT] 8
Main Folder Name : imagenet2012
Sub Folder 1:  ILSVRC2012_img_train Contains different folder (n01443537,n01484850… 15 of them with images inside)
Sub Folder 2: ILSVRC2012_img_val (ILSVRC2012_val_00000001.JPEG etc…Contains all images)
import torch.nn as nn
from torch.hub import load_state_dict_from_url
import torchvision
from torchvision import transforms
from torch.utils import data
from torchvision.datasets import ImageFolder
import torch
__all__ = ['AlexNet', 'alexnet']


data_transforms = transforms.Compose([
    transforms.Resize(256),
    transforms.CenterCrop(224),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])


data_dir = "/home/Sami/Documents/imagenet2012/"

model_urls = {
    'alexnet': 'https://download.pytorch.org/models/alexnet-owt-4df8aa71.pth',
}

train_dataset = torchvision.datasets.ImageFolder(root=val_dir, transform=data_transforms, target_transform=None, is_valid_file=None)
test_dataset  = torchvision.datasets.ImageFolder(root=val_dir, transform=data_transforms, is_valid_file=None)

test_loader = torch.utils.data.DataLoader(dataset=test_dataset,  batch_size=100, shuffle=True)
test_ds  = torch.utils.data.Subset(test_loader.dataset, range(0,50))
test_loader_1 = torch.utils.data.DataLoader(dataset=test_ds,  batch_size=100, shuffle=True)




class AlexNet(nn.Module):

    def __init__(self, num_classes=1000):
        super(AlexNet, self).__init__()
        self.features = nn.Sequential(
            nn.Conv2d(3, 64, kernel_size=11, stride=4, padding=2),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=3, stride=2),
            nn.Conv2d(64, 192, kernel_size=5, padding=2),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=3, stride=2),
            nn.Conv2d(192, 384, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(384, 256, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(kernel_size=3, stride=2),
        )
        self.avgpool = nn.AdaptiveAvgPool2d((6, 6))
        self.classifier = nn.Sequential(
            nn.Dropout(),
            nn.Linear(256 * 6 * 6, 4096),
            nn.ReLU(inplace=True),
            nn.Dropout(),
            nn.Linear(4096, 4096),
            nn.ReLU(inplace=True),
            nn.Linear(4096, num_classes),
        )

    def forward(self, x):
        x = self.features(x)
        x = self.avgpool(x)
        x = torch.flatten(x, 1)
        x = self.classifier(x)
        return x

model = AlexNet()
state_dict = load_state_dict_from_url(model_urls['alexnet'],  progress=True)
model.load_state_dict(state_dict)
print(model)



with torch.no_grad():
    correct = 0
    total = 0
    
    for images,labels in test_loader_1:
        out = model(images)
        _,predicted = torch.max(out.data,1)
        total += labels.size(0)
        correct += (predicted==labels).sum().item()
    
    
print('Accuracy of the network on the 50 test images: {} %'.format(100 * correct / total))


But the accuracy stays 0.0 something like that.