Apply convolutional neural network (SavedModel format) for asbestos-cement roofing identification
Hello,
When I load a convolutional neural network in eCognition, which was created in RStudio and then exported in SavedModel format, and then is applied to a new project consisting of a 4 band aerial image (RGB + NIR) to predict different roof types (containing asbestos or not), I have the following error: "Incorrect input tensor shape. Required 4 dimensions: (-1, 30, 30, 4), but the input tensor has 4 dimensions (-1, 30, 30, 10). An image containing the error is attached.
Please let me know if there is any kind of solution you can help me with.
Was this article helpful?
4 comments
Hi Anthony!
If you trained on an image with 4 bands (RGB+NIR), the model produced will then also only work on images with the same format (4 bands).
Once you edit the input data down to the four bands, it should work then work.
best,
Mike
Hello Michael,
I also trained on an image with 4 bands (RGB + NIR), and I encounter the same error. I attached the image with the error. As you can see, there is a problem with the tensor dimensions, even though the images used for training and the model are set to 4 dimensions.
Hi again Mike,
I just want to share a few more details about this model. This is a CNN model created in RStudio for asbestos-cement roofing identification. To train this model a number of images (with a size of 15x15 and 30x30 pixels) were generated from a 4 band aerial image (RGB + NIR). There are two different classes (images containing asbestos-cement roofing and images containing other roof types).
My objective is to generate a heat map from an aerial image with 4 bands in eCognition. So the model was exported in SavedModel format and then loaded in eCognition, but when the model is appled I find this problem about the tensor dimensions, as I said on my previos message.
Best,
Anthony
Hi Anthony,
sorry for the delayed response, I had been out due to an illness.
eCognition can be very particular about they model it takes, not only should the input data be correct, the model should also have the correct output. When creating and training your model, you must make sure that you model's input and output tensors matches with what eCognition will expect.
In this case, the input tensor must be in this format [-1, Tile width, Tile height, Num of layers]. I think you have this already configured correctly, but you have to make sure you only use four layers.
The output tensor must be [-1, Tile width, Tile height, Num of predicted classes]. Here I think you are missing the Tile width and height still. You will have to configure this in RStudio where you created and trained the model.
More details about this can be found here: https://docs.ecognition.com/v10.2.1/Default.htm#cshid=579
Hope this helps.
best,
Mike