Is KotlinDL planning to add a normalize `transform...
# kotlindl
a
Is KotlinDL planning to add a normalize
transformTensor
op that could be done after the rescale for instance ? I can contribute but want to know if you already did it for 0.4 first.
j
a
Awesome, we'll upgrade to use 0.4 alpha then! Is the format BGR for the mean and std arrays? so index 0 = Blue ?
j
The format of the mean and std arrays should be the same as in the input image. If image is BGR, then the arrays should be in BGR.
a
Perfect thank you and is the image type from buffered image type the right place to check if the image is BGR? In my case I have an RGB image but when I do getImage and check the type it's BGR so I suppose Java/kotlin opens images in BGR by default?
Copy code
ImageConverter.toBufferedImage(File(imagePath).inputStream()).type
j
Hmm, no, as far as I know, it's not supposed to change the format.
is the image type from buffered image type the right place to check if the image is BGR?
Yes. Btw, KotlinDL now also has a
convert
image preprocessor to convert image format (currently, between rgb, bgr and grayscale).
a
That's awesome, I'll make use of the
convert
preprocessor, Thanks a lot @Julia Beliaeva !!
j
Sorry, it seems that I was wrong. It looks like jpeg images read by
ImageIO
always have BGR order. It's controlled by this constant
com.sun.imageio.plugins.jpeg.JPEG#bOffsRGB
which is set to
{ 2, 1, 0 }
.
👍 2
a
Hey just a feedback, last week I used the alpha (0.4.3) and added
normalize
and
convert
ops to our existing kotlinDL preprocessing and it worked amazingly well. Thanks again for your reply. @Julia Beliaeva @zaleslaw Keep up the good work on KotlinDL we're in love with the lib so far.
🙏 2