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

PatchesExtraction: sampler go through features with empty class field #81

Closed
viennois opened this issue May 30, 2022 · 10 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@viennois
Copy link

Hi
When I run the command otbcli_PatchesExtraction, i have this error message :
Sampling patches: 100% [**************************************************]2022-05-30 14:05:39 (FATAL) PatchesExtraction: itk::ERROR: Region ImageRegion (0x7fff99fb0650)
Dimension: 2
Index: [0, 187216]
Size: [16, 16]
is outside of buffered region ImageRegion (0x55d38b9f0ef0)
Dimension: 2
Index: [0, 0]
Size: [16, 187216]
Can you help me please ?
Thanks
Gaëlle

@remicres
Copy link
Owner

Hi, could you provide the full command line, with gdalinfo output for your input raster(s)?
Wich version are you using ?

@viennois
Copy link
Author

here, is the command line :
otbcli_PatchesExtraction -source1.il mosaicOverLand_8bits_hillshade_nodata.tif -source1.patchsizex 16 -source1.patchsizey 16 -source1.out train_mosafinale17classes02032022_Patcheschgtdate_OL.tif -vec Train_Mosa2018_Hansen_Mask.shp -field "Num_class" -outlabels train_mosafinale17classes02032022_Labelschgtdate_OL.tif uint8

@viennois
Copy link
Author

I used otbtf2.5:cpu

@remicres remicres reopened this May 30, 2022
@remicres
Copy link
Owner

remicres commented May 30, 2022

Could you please paste the output of gdalinfo for mosaicOverLand_8bits_hillshade_nodata.tif ?
Thanks

@remicres
Copy link
Owner

remicres commented May 30, 2022

I have a possible explanation, but not sure if it is the good one. Forget the gdal_info output.

If you take a look in the otbTensorflowSampler code, you can notice that the number of Geometries is counted, only when the geometry has a field "Num_class". However, when the patches are extracted, all geometries are walked (hence the count could be greater than the geometries with "Num_class" field). This is a design flaw, and it will be corrected in future release. Still, this would imply that there is a missing "Num_class" field in some of the geometries of your "Train_Mosa2018_Hansen_Mask.shp" vector file.

Can you confirm that there are some undefined "Num_class" field for one or multiple geometries? (you can check that in QGIS
if you check the attributes table, you should see some NULL value(s) in your "Num_class" field)

@viennois
Copy link
Author

Yes, in the "Num_class" field, i have the Null Values
So, i will replace this value by one

@remicres remicres changed the title erro message with the command otbcli_PatchesExtraction PatchesExtraction: sampler go through features with empty class field May 31, 2022
@remicres remicres added the bug Something isn't working label May 31, 2022
@remicres remicres self-assigned this May 31, 2022
@remicres
Copy link
Owner

Fixed in the source code here.

We will draft a new release with docker images soon

@viennois
Copy link
Author

viennois commented Jun 1, 2022

thanks

@viennois
Copy link
Author

viennois commented Jun 1, 2022

I will wait our new docker images to classify my images

@remicres
Copy link
Owner

remicres commented Jun 1, 2022

you can use the last docker images available here (we have not published the images on dockerhub for now)

@remicres remicres closed this as completed Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants