imatge-upc/salgan

Error converting raw image to PKL format data

rainbowbird07 opened this issue · 1 comments

Dear author:
When I run the code 'python 01-data_preprocessing.py', I always meet this mistake:

File "****/saliency-salgan-2017-master/scripts/eliaLib/dataRepresentation.py", line 49, in load

self.data = (scipy.io.loadmat(self.filePath)['I']).astype(np.uint8)

KeyError: 'I'

 I was miserable. Eager for your help!
 Thank you very much anyway!
 Best!

I solved this issue knowing that i converted the saliency maps from jpg to mat file just to suit the requirement of the data preprocessing code that the saliency map must be in mat file. When i changed the jpg to mat file, the variable that i used for the image was im i.e. im = imread('saliencymap.jpg'); . So when I saved it as xxxx.mat file and load it again, it becomes struct that contains the variable im.

In short, change 'I' to the container that you used when you saved the image as mat file. In my case, I changed 'I' to 'im'.