How to match the image parameters before feeding them in Feedforward learner (Classification)?

Greetings.

I am being greeted by this error,

“ERROR DL4J Feedforward Learner (Classification) 4:14 Execute failed: Error in row Tumor12_T2.nii.gz_Row119 : Length of current input does not match expected length. Possible images or collections may not be of same size.”

The problem here is images may not have same sizes as they will be of different patients, does this refers to images not having same dimensions. I am not getting the cause of this error. Also is there a way I could know what are bad images which I can correct or exclude from analysis? l mean is there a way of knowing “bad image data”?

With regards,
Akshaykumar

Hi @Akshaykumar,

in order to make sure that all images have the same size you could do one of the following:

  • Filter out all images which have a different size: With the ‘Image Properties’ node you can append a column with the size in each dimension by choosing ‘Dimensions’ in the Features tab. This will give you a collection column contain the size in each dimension. Then you could split the collection and use a ‘Row Filter’ node to filter out the images which have a different size.
  • Resize the images: You could use a ‘Image Resizer’ node which resizes every image to the same size. Here, you could enter the most frequent size of your images in the configuration. Thereby, the images which have this size will stay the same, but all other will be resized to the configured size. However, this possibly deforms the images if they do not all have the same aspect ratio.

I hope that helps.

Cheers
David

1 Like

Hi,
I tried to follow the steps.
I have problem in configuring Row Filter.
I tried to manually put size int Image resize but it is not working “ERROR Image Resizer 0:21 Execute failed: java.lang.RuntimeException: Number of elements in Container too big, use for example CellContainer instead: 7188656947200 > 2147483647”

Btw I am using heap memory of 12 GB as it was saying insufficient memory even at 4GB.
I have NVIDIA GPU of 4 GB

With regards
Akshaykumar

Hi @Akshaykumar,
This error indicates that you are dealing with very large images, which do not fit into an ArrayImg. Did you maybe enter the desired absolute size, but still have Relative Scaling Factor selected? I am guessing this as your error indicates the output image from the resizer would contain over 7 Trillion pixels :open_mouth:

If this is the case, just select Absolute Image Size in the drop-down marked with orange box in the screenshot.
best,
Gabriel

1 Like

Dear Gabriel,
It worked!
I have put dimensions of 256 x 256 x 30 but some images have 256 x 256 x 90
anyway I wanted to say thank you.
But unfortunately I still could not make my Deep Learning Network work because of this error
“ERROR DL4J Feedforward Learner (Classification) 0:14 Execute failed: org.nd4j.linalg.exception.ND4JIllegalStateException: Failed to allocate [810024960] bytes”
It looks like as soon I overcome one obstacle another is just waiting there for me to discover.
That’s what makes it more fun and challenging though.

With regards
Akshaykumar