deeplearning4j: Convert Mat image to INDArray, When trying to convert Mat image to INDArray it is returning me INDArray null

I have this code and I do not understand why my IDNarray image is returning me null when I try convert Mat in INDArray. I using the android sutdio 3.0.1.

//************************* Digit classification *******************************************************************
        for (int i = 0; i < rects.size() ; i++) {
            Rect rect = rects.get(i);
            digit = inverted.submat(rect.y, rect.y + rect.height, rect.x, rect.x + rect.width);
            Imgproc.resize(digit, digit, new Size(28, 28));

                NativeImageLoader nativeImageLoader = new NativeImageLoader(digit.height(), digit.width(), digit.channels());//Use the nativeImageLoader to convert to numerical matrix
                INDArray image = nativeImageLoader.asMatrix(digit);//put image into INDArray

            System.out.println("carregar modelo matrixes  " + image);
 }

output: carregar modelo matrixes NULL

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 76 (38 by maintainers)

Most upvoted comments

@sshepel It’s usually OK, it just happens sometimes.

@saudet Thanks so much for that and now it works!

Thanks, now it work.