remicres / sr4rs

Super resolution for remote sensing
MIT License
168 stars 19 forks source link

No module named otbApplication #46

Open MattiaMartinelliGeo opened 2 years ago

MattiaMartinelliGeo commented 2 years ago

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

remicres commented 2 years ago

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
MattiaMartinelliGeo commented 2 years ago

@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

remicres commented 2 years ago

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)

MattiaMartinelliGeo commented 2 years ago

@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

remicres commented 2 years ago

Hi @MattiaMartinelliGeo

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

River-Zhang commented 2 years ago

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?

remicres commented 2 years ago

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.

River-Zhang commented 2 years ago

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.

River-Zhang commented 2 years ago

16 bits images, TOC (Level 2A) reflectance

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

River-Zhang commented 2 years ago

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!

River-Zhang commented 2 years ago

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