FeatureLearningRotNet icon indicating copy to clipboard operation
FeatureLearningRotNet copied to clipboard

Problem in data transformations

Open rabiaali95 opened this issue 6 years ago • 1 comments

In dataloader.py when preparing rotated images rotated_imgs = [

                self.transform(img0),
                self.transform(rotate_img(img0,  90)),
                self.transform(rotate_img(img0, 180)),
                self.transform(rotate_img(img0, 270))
            ]

the following error arises. ValueError: some of the strides of a given numpy array are negative. This is currently not supported, but will be added in future releases.

How to solve this error?

rabiaali95 avatar Oct 14 '19 04:10 rabiaali95

Hi, a simple solution would be to add a .copy() to all of the output of rotate_img

From https://github.com/gidariss/FeatureLearningRotNet/blob/817342ba8521ef709467c8bb7e3ec157969c1145/dataloader.py#L216-L226

To return np.flipud(...),copy() return np.fliplr(...).copy() return np.transpose(...).copy()

For more details of this problem, you can check this thread from the pytorch form

rxqy avatar Oct 23 '19 02:10 rxqy