Skip to content

ValueError: the input array must have size 3 along channel_axis, got (80, 512) #41

@chinmaysahu

Description

@chinmaysahu

~\Envs\Iris\lib\site-packages\imquality\brisque.py in score(image, kernel_size, sigma)
158
159 def score(image: PIL.Image.Image, kernel_size=7, sigma=7 / 6) -> float:
--> 160 scaled_features = calculate_features(image, kernel_size, sigma)
161 return predict(scaled_features)

~\Envs\Iris\lib\site-packages\imquality\brisque.py in calculate_features(image, kernel_size, sigma)
128
129 def calculate_features(image: PIL.Image, kernel_size, sigma) -> numpy.ndarray:
--> 130 brisque = Brisque(image, kernel_size=kernel_size, sigma=sigma)
131 # WARNING: The algorithm is very sensitive to rescale
132 # FIXME: this is empirically the best configuration; however, scikit-image warns about bi-quadratic implementation.

~\Envs\Iris\lib\site-packages\imquality\brisque.py in init(self, image, kernel_size, sigma)
43 ):
44 self.image = pil2ndarray(image)
---> 45 self.image = skimage.color.rgb2gray(self.image)
46 self.kernel_size = kernel_size
47 self.sigma = sigma

~\Envs\Iris\lib\site-packages\skimage_shared\utils.py in fixed_func(*args, **kwargs)
336
337 if channel_axis is None:
--> 338 return func(*args, **kwargs)
339
340 # TODO: convert scalars to a tuple in anticipation of eventually

~\Envs\Iris\lib\site-packages\skimage\color\colorconv.py in rgb2gray(rgb, channel_axis)
873 >>> img_gray = rgb2gray(img)
874 """
--> 875 rgb = _prepare_colorarray(rgb)
876 coeffs = np.array([0.2125, 0.7154, 0.0721], dtype=rgb.dtype)
877 return rgb @ coeffs

~\Envs\Iris\lib\site-packages\skimage\color\colorconv.py in _prepare_colorarray(arr, force_copy, channel_axis)
138 msg = (f'the input array must have size 3 along channel_axis, '
139 f'got {arr.shape}')
--> 140 raise ValueError(msg)
141
142 float_dtype = _supported_float_type(arr.dtype)

ValueError: the input array must have size 3 along channel_axis, got (80, 512)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions