Image resizing does not work correctly

I have an image that is stored in INDArray. I use this method

Nd4j.image (). imageResize (image, Nd4j.createFromArray (2, 2), ImageResizeMethod.ResizeBicubic);

and I get in place of this

[[[[ 167.0000, 153.0000],
[ 175.0000, 229.0000]],

[[ 158.0000, 146.0000],
[ 170.0000, 229.0000]],

[[ 150.0000, 139.0000],
[ 164.0000, 226.0000]]]]

this

[[[[ 247.0000, 248.0000, 251.0000, 251.0000, 244.0000],
[ 248.5000, 203.0000, 149.0000, 243.5000, 221.5000]],

[[ 251.0000, 252.5000, 252.5000, 251.0000, 246.0000],
[ 250.2500, 194.7500, 135.7500, 245.5000, 219.2500]]]]

what could be wrong?

@Kazimir1994 can you please the NativeImageLoader? That’s going to be better for your use case. deeplearning4j/NativeImageLoader.java at master · eclipse/deeplearning4j · GitHub

Beyond that, please file an issue at Issues · eclipse/deeplearning4j · GitHub with an example I can use standalone to reproduce.

NativeImageLoader will not work because my image comes through rtsp after which I convert the entire frame (org.bytedeco.javacv.Frame) into INDArray and cut out the areas of interest to me from it.

Link to question ImageResize it works incorrectly · Issue #9269 · eclipse/deeplearning4j · GitHub

As you are already working with JavaCV, I’d suggest using that for the resizing as a workaround, while we figure out what is broken with ImageResize.

Thank you very much for paying attention to my question.I look forward to solving this problem :)))

You can use subsampling layer or operation. 100x100 image with kernel 2x2 will be subsampled into 50x50 image. You can only subsample with some kernel this way and could not resize 100x100 image into 99x99 image this way.

1 Like

Do you really think it is a solution?