Image Mode not Accepted w/ Integrated Gradients

I’m working with the integrated gradients notebook sourced from here:(Model Understanding with Captum — PyTorch Tutorials 2.2.0+cu121 documentation)

  • “Download the notebook and corresponding files here.”

I’m unable to run this line img = resize(test_img). I’ve attached a screenshot of the error message below

The file I’m using is a .tif file in the ‘I;16’ format which isn’t being accepted. My questions are

  1. What are the accepted image formats for this notebook?
  2. Does anyone have any experience converting I;16 format files into a different image format that would be accepted?

Thank you in advance!

Your image is probably not an image…

Hi @harpone , thanks for your response! I believe the .tif file is a type of image (specifically, a 16-bit unsigned integer image based on what I’m seeing online)

OK I think it could be a good idea to go to line 3 with a debugger and compare to loading a regular jpeg… if you’re using PIL to open the image, then maybe also use .convert("RGB") to make sure it’s RGB etc. But not really sure, haven’t worked with TIFFs a lot.