remicres / otbtf

Deep learning with otb (mirror of https://forgemia.inra.fr/orfeo-toolbox/otbtf)
Apache License 2.0
161 stars 39 forks source link

TensorflowModelServe => Error : TensorflowModelServe: itk::ERROR: Region ImageRegion (0x7ffc24758230) when no projection information in input image, or exotic pixel spacing in input image #66

Closed FlorianeSchreiber closed 3 years ago

FlorianeSchreiber commented 3 years ago

Hello Rémi,

First of all, thank you for this great toolbox. After following the tutorial, "An introduction to deep learning on remote sensing images", I am trying to reproduce it, with other remote sensing image. Here I use, "polarimetric RGB" SAR images. I did all the command lines, and it works well, but I have a problem in the last one, and I don't really understand what the error is, and mainly how to fix it.

My command lines are :

docker run -u otbuser -v "$(pwd):/home/otbuser" mdl4eo/otbtf2.4:cpu otbcli_TensorflowModelServe \ -source1.il subset_RGB.tif \ -source1.rfieldx 16 \ -source1.rfieldy 16 \ -source1.placeholder "x" \ -model.dir "data/results/SavedModel_cnn" \ -output.names "prediction" \ -out classif_model1.tif uint8

The error is :

2021-09-14 09:32:20 (FATAL) TensorflowModelServe: itk::ERROR: Region ImageRegion (0x7ffc24758230) Dimension: 2 Index: [0, 593] Size: [16, 16] is outside of buffered region ImageRegion (0x5586b9b484b0) Dimension: 2 Index: [0, 591] Size: [32, 17]

I understood the problem is at the line : "-out classif_model1.tif uint8". But now, I don't know what to do...

Thank you for your help !

Floriane

remicres commented 3 years ago

hi @FlorianeSchreiber ,

Can you paste the output of the following command:

gdalinfo subset_RGB.tif

Also, could you paste the entire log? especially the last lines

I'll take a look!

Thanks

FlorianeSchreiber commented 3 years ago

hi 👋 !

Thanks for your answer.

So, this is the output :

Driver: GTiff/GeoTIFF Files: subset_RGB_RGB.tif Size is 885, 608 Image Structure Metadata: INTERLEAVE=PIXEL Corner Coordinates: Upper Left ( 0.0, 0.0) Lower Left ( 0.0, 608.0) Upper Right ( 885.0, 0.0) Lower Right ( 885.0, 608.0) Center ( 442.5, 304.0) Band 1 Block=885x8 Type=Byte, ColorInterp=Red Mask Flags: PER_DATASET ALPHA Band 2 Block=885x8 Type=Byte, ColorInterp=Green Mask Flags: PER_DATASET ALPHA Band 3 Block=885x8 Type=Byte, ColorInterp=Blue Mask Flags: PER_DATASET ALPHA Band 4 Block=885x8 Type=Byte, ColorInterp=Alpha

and this is the entire log :

2021-09-14 13:09:08.950675: I tensorflow/cc/saved_model/reader.cc:32] Reading SavedModel from: data/results/SavedModel_cnn 2021-09-14 13:09:08.962911: I tensorflow/cc/saved_model/reader.cc:55] Reading meta graph with tags { serve } 2021-09-14 13:09:08.963824: I tensorflow/cc/saved_model/reader.cc:93] Reading SavedModel debug info (if present) from: data/results/SavedModel_cnn 2021-09-14 13:09:08.988848: I tensorflow/cc/saved_model/loader.cc:206] Restoring SavedModel bundle. 2021-09-14 13:09:08.996679: I tensorflow/core/platform/profile_utils/cpu_utils.cc:112] CPU Frequency: 2000000000 Hz 2021-09-14 13:09:09.030836: I tensorflow/core/profiler/lib/profiler_session.cc:136] Profiler session initializing. 2021-09-14 13:09:09.030930: I tensorflow/core/profiler/lib/profiler_session.cc:155] Profiler session started. 2021-09-14 13:09:09.042015: I tensorflow/core/profiler/lib/profiler_session.cc:172] Profiler session tear down. 2021-09-14 13:09:09.042886: I tensorflow/cc/saved_model/loader.cc:277] SavedModel load for tags { serve }; Status: success: OK. Took 92227 microseconds. 2021-09-14 13:09:08 (INFO) TensorflowModelServe: Default RAM limit for OTB is 256 MB 2021-09-14 13:09:08 (INFO) TensorflowModelServe: GDAL maximum cache size is 99 MB 2021-09-14 13:09:08 (INFO) TensorflowModelServe: OTB will use at most 4 threads 2021-09-14 13:09:09 (INFO) TensorflowModelServe: Source info : 2021-09-14 13:09:09 (INFO) TensorflowModelServe: Receptive field : [16, 16] 2021-09-14 13:09:09 (INFO) TensorflowModelServe: Placeholder name : x 2021-09-14 13:09:09 (INFO) TensorflowModelServe: Output spacing ratio: 1 2021-09-14 13:09:09 (INFO) TensorflowModelServe: Output field of expression: [1, 1] 2021-09-14 13:09:09 (INFO) TensorflowModelServe: Force tiling with squared tiles of [16, 16] 2021-09-14 13:09:09 (INFO): Estimated memory for full processing: 8.99779MB (avail.: 256 MB), optimal image partitioning: 1 blocks 2021-09-14 13:09:09 (INFO): File classif_model1.tif will be written in 1 blocks of 870x593 pixels 2021-09-14 13:09:09 (FATAL) TensorflowModelServe: itk::ERROR: Region ImageRegion (0x7fff0bd39f20) Dimension: 2 Index: [0, 593] Size: [16, 16] is outside of buffered region ImageRegion (0x563116828ad0) Dimension: 2 Index: [0, 591] Size: [32, 17]

Thank you :) :)

remicres commented 3 years ago

Your input image has no coordinate reference system. Could you past as well the output of otbcli_ReadImageInfo -in subset_RGB.tif ? Also, can you give a try with otbcli_TensorflowModelServe ... -out "classif_model1.tif?&box=0:0:869:592 ? Does it work?

My guess is that the missing coordinate system cause a bug, but not sure yet.

remicres commented 3 years ago

I can reproduce the bug with a dummy 4-band, 885x608, no projection information.

This confirms my first guess. It looks like a small bug, we will correct it for the (incoming!) next release...

remicres commented 3 years ago

The bug is identified and occurs in the following cases:

remicres commented 3 years ago

The bug is fixed in this pending PR (#67).

You can test the fix using the instructions mentioned in the PR, if you have the docker-image with development files (I believe in OTBTF2.4, the gpu docker image is development-ready)

FlorianeSchreiber commented 3 years ago

ok thank you very much, i will test it :)