import numpyimport torchvisionfrom PIL import Imagefrom torchvision import transforms


mobile_net=torchvision.models.mobilenet_v2(pretrained=True)image=Image.open("/home/chenyang/PycharmProjects/Attention_analysis_system/timg.jpeg").convert('RGB')normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                 std=[0.229, 0.224, 0.225])input_size = 224t=transforms.Compose([
        transforms.RandomResizedCrop(input_size, scale=(0.2, 1.0)),
        transforms.RandomHorizontalFlip(),
        transforms.ToTensor(),
        normalize,
    ])image=t(image)if __name__ == '__main__':
    result=mobile_net(image.view(-1,3,224, 224))
    result=numpy.argmax(result.data[0].numpy())
    print(result)