Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error TensorflowModelTrain with path of dimension 48 instead of 16 #88

Open
viennois opened this issue Aug 18, 2022 · 2 comments
Open
Labels
good first issue Good for newcomers question Further information is requested

Comments

@viennois
Copy link

HI,
I extract patches of dimension 48 instead of 16
Here, my line of code :
"otbcli_PatchesExtraction -source1.il Mosa_8B_Projet_Pheno_24022022_hillshade.tif -source1.patchsizex 48 -source1.patchsizey 48 -source1.out train_mosafinale17classes_Patches48.tif -vec Training_17classes02032022.shp -field "Num_class" -outlabels train_mosafinale17classes_Labels48.tif uint8".

And when I run otbcli_TensorflowModelTrain \ with -training.source1.patchsizex 48
-training.source1.patchsizey 48
I have this error message :

"wModelTrain: itk::ERROR: TensorflowMultisourceModelTrain(0x564fdea48c70): Can't run the tensorflow session !
Tensorflow error message:
Invalid argument: logits and labels must have the same first dimension, got logits shape [8100,18] and labels shape [100]
[[{{node sparse_softmax_cross_entropy_loss/xentropy/xentropy}}]]
OTB Filter debug message:
Output image buffered region: ImageRegion (0x7ffe967afb80)
Dimension: 2
Index: [0, 0]
Size: [1, 1]

Input #0:
Requested region: ImageRegion (0x7ffe967afbb0)
Dimension: 2
Index: [0, 0]
Size: [48, 4270176]

Tensor shape ("x": {100, 48, 48, 11}
Input #1:
Requested region: ImageRegion (0x7ffe967afbb0)
Dimension: 2
Index: [0, 0]
Size: [1, 88962]

Tensor shape ("y": {100, 1, 1, 1}

So my question : Do I have any parameters to modify in the python script?

Thanks for your help

@remicres
Copy link
Owner

Hi @viennois
This message comes from tensorflow.
It says that the number of labels is wrong.
Here I see 8100 values (instead of 100) which is 81 times greater than it should.
Maybe you have 9x9 labels outputs, instead of 1x1.
You have either to shrink this output or add convolutions to match 1x1

@remicres remicres added question Further information is requested good first issue Good for newcomers labels Aug 22, 2022
@viennois
Copy link
Author

I have 18 classes and i try to use patches of 48*48.
I 'm just user of our application and I don't know how to use tensorflow
How shrink the output or add convolutions to match 1x1?
Thanks for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants