Using datavec’s NativeImageLoader’s asMatrix , when I convert any PNG image to an INDArray, the INDArray is entirely filled with value 6418. That seems wrong! If instead convert a JPG image to INDArray, the INDARRAY looks more reasonable, but there are still a lot of 6148s and other large values, and the values don’t match what I see when I look at the pixels in the BufferedImage. Is the Alpha channel affecting the values ? The documentation on asMatrix is sketchy. Is there someplace that explains the conversion? A requirements doc?
Using org.datavec.image.loader.ImageLoader
seems to work better:
public static BufferedImage toImage(final INDArray features) {
final INDArray slicedTransposedFeatures = features.slice(0).slice(0).transpose();
return ImageLoader.toImage(slicedTransposedFeatures);
}
@DonaldAlan mind filing an issue with a reproducer so we can look at this thanks!
I was unable to reproduce this in a simple test case. (And I noticed that jpgs are lossy, while pngs retain exact values, as expected).