Skip to content

Noise2Void shape broadcast error during prediction #83

Description

@astronerdF

I have followed the 293_denoising_RGB_images_using_deep_learning.ipynb and everything seemed fine except while trying to predict.

This is the error that I get:
`pred = model.predict(img, axes='YXC')


ValueError Traceback (most recent call last)
Cell In[26], line 5
1 # Here we denoise the image (predict)
2 # The parameter 'n_tiles' can be used if images are to big for the GPU memory.
3 # If we do not provide the n_tiles' parameter the system will automatically try to find an appropriate tiling.
4 # This can take longer.
----> 5 pred = model.predict(img, axes='YXC')

File ~/Desktop/N2VTensorFlow/n2vTF/lib/python3.8/site-packages/n2v/models/n2v_standard.py:382, in N2V.predict(self, img, axes, resizer, n_tiles, tta)
380 if n_tiles:
381 new_n_tiles = tuple([n_tiles[axes.index(c)] for c in axes if c != 'C']) + (n_tiles[axes.index('C')],)
--> 382 normalized = self.normalize(np.moveaxis(img, axes.index('C'), -1), means, stds)
383 else:
384 normalized = self.normalize(img[..., np.newaxis], means, stds)

File ~/Desktop/N2VTensorFlow/n2vTF/lib/python3.8/site-packages/n2v/models/n2v_standard.py:341, in N2V.normalize(self, data, means, stds)
340 def normalize(self, data, means, stds):
--> 341 return (data - means) / stds

ValueError: operands could not be broadcast together with shapes (359,497,4) (1,1,3)`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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