Error data shape

when I tested this code:

import numpy as np
from scipy import ndimage as img
from scipy import io as sio
import matplotlib.pyplot as plt
import pyshearlab
from os.path import dirname, join as pjoin
import as sio
import  torch

sigma = 30
scales = 3
thresholdingFactor = 3

imd = pjoin('./data/', 'image.mat')
X = sio.loadmat(imd)

shearletSystem = pyshearlab.SLgetShearletSystem2D(0,X.shape[0], X.shape[1], scales)

AttributeError: ‘dict’ object has no attribute ‘shape’

I don’t recognize all of these libraries but your variable X is a dict.

And dicts have no .shape attribute. So calling X.shape throws an error.

Try to print(X) or print(X.keys()) to see what X holds. Maybe one of the .values of X is a numpy.array or torch.tensor which both have the .shape attribute.

@ZimoNitrome thanks for reply, but

mat = pjoin('./sample_data/', 'gt.mat')
X1 = sio.loadmat(mat)

loading image…
<built-in method keys of dict object at 0x7efe869a8c30>

you forgot the parentheses:

mat = pjoin('./sample_data/', 'gt.mat')
X1 = sio.loadmat(mat)

Try reading up on how to use and index dictionaries. Some of your error messages can probably be found through a simple google search.