randino
(randino)
November 23, 2021, 8:00pm
1
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 scipy.io as sio
import torch
tic()
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)
error:
AttributeError: ‘dict’ object has no attribute ‘shape’
I don’t recognize all of these libraries but your variable X
is a dict
.
And dict
s 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.
randino
(randino)
November 23, 2021, 9:06pm
3
@ZimoNitrome thanks for reply, but
mat = pjoin('./sample_data/', 'gt.mat')
X1 = sio.loadmat(mat)
print(X1.keys)
–SLExampleImageDenoising
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)
print(X1.keys())
Try reading up on how to use and index dictionaries. Some of your error messages can probably be found through a simple google search.
python