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

No module named otbApplication #46

Open
MattiaMartinelliGeo opened this issue May 20, 2022 · 11 comments
Open

No module named otbApplication #46

MattiaMartinelliGeo opened this issue May 20, 2022 · 11 comments
Labels
docker related to docker use question Further information is requested

Comments

@MattiaMartinelliGeo
Copy link

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
Copy link
Owner

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 remicres added question Further information is requested docker related to docker use labels May 20, 2022
@MattiaMartinelliGeo
Copy link
Author

@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
Copy link
Owner

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
Copy link
Author

@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
Copy link
Owner

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
Copy link

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
Copy link
Owner

remicres commented Jul 2, 2022

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
Copy link

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
Copy link

16 bits images, TOC (Level 2A) reflectance

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

@River-Zhang
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker related to docker use question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants