Get same output with different image on pre-trained ResNet18

I used torchvision.model.resnet18 to classify images, but it seems output same result with different input.
Here is my test code

res_model = torchvision.models.resnet18(pretrained=True)
normalize = transforms.Compose([
    transforms.Resize((224, 224)),
        mean=[0.485, 0.456, 0.406],
        std=[0.229, 0.224, 0.225]
def predict_image(image_path, model):
    image =
    image_tensor = normalize(image).float()
    image_tensor = image_tensor.unsqueeze_(0)
    image_tensor =
    output = model(image_tensor)
    output_c = output.cpu()
    index =   
    return index

Here are some test case with different images and the same output


Though I don’t know what the index means, I think the same index means the same category.

Did I do something wrong?

Thanks in advance.

Try to set your model to evaluation using model.eval() before testing your images.

It works! Thanks a lot!

But it seems the same category input can produce different category index. Where can I find the map of index and categories?

I just found the file of ImageNet labels,.
Thanks again.