I am new to pytorch, and am trying to extract feature of given image using a pretrained model.
Below is the code I am using, on printing the output I observe that are only 1000 values but these are both positive and negative values, and so I am asuming the 1*1000 feature vector as the feature vector. I am right with this assumption.
inception_v3 = models.resnet18(pretrained=True)
data_transform = transforms.Compose([transforms.Resize((224,224)), transforms.RandomHorizontalFlip(), transforms.ToTensor()])
prid_dataset = datasets.ImageFolder(root=’/Users/prateek/8thSem/datasets/PRID2011/multi_shot/cam_a/’,transform=data_transform)
dataset_loader = torch.utils.data.DataLoader(prid_dataset, batch_size=1, shuffle=False)
for i, (images,labels) in enumerate(dataset_loader):
images = Variable(images)
output = inception_v3(images)
print output