remicres/sr4rs

No module named otbApplication

Opened this issue · 11 comments

Good morning,
thank you very much for this great work.
I am trying to run your model on a Sentinel 2 image.
However, I receive this error message ModuleNotFoundError: No module named 'otbApplication'.
Can you help me to solve this issue?

Thank you very much

Hello @MattiaMartinelliGeo

You need Tensorflow installed with the libtensorflow_cc and libtensorflow_framework libraries, and Orfeo ToolBox compiled with the otbtf remote module. It is a bit technical to setup (you can take a look in the Dockerfile to see how it is done for Ubuntu 20.04).

I recommend you to use the mdl4eo/otbtf3.1:cpu-basic docker image:

From linux/mac commandline after installing docker:

docker run -ti mdl4eo/otbtf3.1:cpu-basic bash

Windows users usually employ docker for windows.
You can take a look in the OTBTF documentation.

Then from inside the started docker container you can use sr4rs:

git clone https://github.com/remicres/sr4rs.git
python sr4rs/code/sr.py --help

@remicres Thank you very much for your quick reply, now it works.
I have another question. The LR image can be located on my local desktop? or should it be located in a particular folder?
If I run this command:
python sr4rs/code/sr.py --savedmodel sr4rs_sentinel2_bands4328_france2020_savedmodel --input C:/Users/mattia.martinelli/Desktop/Test_SR4RS/Clipped_SR4.tif --output test.tif

It says that C:/Users/mattia.martinelli/Desktop/Test_SR4RS/Clipped_SR4.tif doesn't exist even if I know it is located in that folder.

Thank you very much

Yes, you have to mount the path you want access in the container (see the docker documentation: in command line append the -v /local/path:/docker/path, for docker desktop I don't know)

@remicres thank you very much again for your quick help. I managed to mounth the path and to run the script. I used Sentinel 2 image downloaded from EO browser and as suggested I stacked Bands 4,3,2 and 8. Unfortunately, the output is quit strange (as you see in the attached pictures). Am I doing something wrong? Than
Error
k you very much

Hi @MattiaMartinelliGeo

My guess is that there is something strange with your input image pixels values.
What gdal_stats --stats raster.tif shows?

Hi @MattiaMartinelliGeo

My guess is that there is something strange with your input image pixels values. What gdal_stats --stats raster.tif shows?

Hi, I also encountered this problem. My sentinel-2 image was downloaded from GEE and the output image from the pretrained model is also strange like this friend MattiaMartinelliGeo's. Is there any solution?

The model was trained from 16 bits images, TOC (Level 2A) reflectance.
It works on Sentinel-2 images from THEIA, ESA, etc. at 10m spacing resolution.
I don't know for GEE images.

The model was trained from 16 bits images, TOC (Level 2A) reflectance. It works on Sentinel-2 images from THEIA, ESA, etc. at 10m spacing resolution. I don't know for GEE images.

Thanks very much I‘ll try again.

16 bits images, TOC (Level 2A) reflectance

I find that my image bit depth is 128 bit. That's strange.

The model was trained from 16 bits images, TOC (Level 2A) reflectance. It works on Sentinel-2 images from THEIA, ESA, etc. at 10m spacing resolution. I don't know for GEE images.

Could you please send me an image just for test? That would be of great help orz!

It works but the image is not quite clear and the color changed. It's strange. The first is the output and the second is the input.
image
image