assafshocher / ResizeRight

The correct way to resize images or tensors. For Numpy or Pytorch (differentiable).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

It can be applied to 1D data or non-image data?

ZDstandup opened this issue · comments

Hi, a great work!
Can this method process the 1D data or non-image data?

Thanks,
Shouldn't be a problem, RR works for any N-D tensor (including N=1), resizing along any M<=N choice of dims.

Hi@assafshocher, thanks for your reply!BTW, I have constructed a Resiser for a batch_size images (batchsizex3x256x256) with R1=Resizer(in_shape = (batchsize, 3, 256, 256),scale_factor=1/16). Now I am trying to process a batch_size 1D signal data with R2=Resizer(in_shape = (batchsize,1,256,1),scale_factor=1/16). However, it produces some errors,

"IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed"

Could you please give me some suggestions to help me? I really appreciate any help you can provide.

can you post the exact code that fails?

Also, @ZDstandup , note that (in_shape = (batchsize,1,256,1),scale_factor=1/16) means (according to the convention- please see the readme file in Usage area unde scale_factors), that what you are doing is trying to scale the last two dims.
I assume that you want to scale dim2, right?
Try scale_factors=(1, 1, 1/16, 1)

Hi, @assafshocher, according to your suggestion, now I have succeeded. Thank you very much!
Many thanks again!