Skip to content
Snippets Groups Projects
Commit e222d4b6 authored by Cresson Remi's avatar Cresson Remi
Browse files

Merge branch 'develop' into 'master'

Release 4.2.1

See merge request remi.cresson/otbtf!102
parents a8c84a52 73a03d4a
No related branches found
No related tags found
1 merge request!102Release 4.2.1
Pipeline #191660 passed with warnings
variables:
OTBTF_VERSION: 4.2.0
OTBTF_VERSION: 4.2.1
OTB_BUILD: /src/otb/build/OTB/build # Local OTB build directory
OTBTF_SRC: /src/otbtf # Local OTBTF source directory
OTB_TEST_DIR: $OTB_BUILD/Testing/Temporary # OTB testing directory
......@@ -282,6 +282,7 @@ deploy_gpu:
IMAGE_GPUOPTDEV: $CI_REGISTRY_PUBIMG-gpu-opt-dev
DOCKERHUB_GPU: $DOCKERHUB_IMAGE_BASE-gpu
DOCKERHUB_GPUDEV: $DOCKERHUB_IMAGE_BASE-gpu-dev
DOCKERHUB_GPULATEST: $DOCKERHUB_BASE:latest-gpu
script:
# gpu-opt
- docker build --build-arg BZL_OPTIONS="--remote_cache=$BAZELCACHE" --tag $IMAGE_GPUOPT --build-arg BASE_IMG=$GPU_BASE_IMG .
......@@ -301,5 +302,7 @@ deploy_gpu:
- docker push $DOCKERHUB_GPU
- docker tag $IMAGE_GPUDEV $DOCKERHUB_GPUDEV
- docker push $DOCKERHUB_GPUDEV
# latest-gpu = gpu image
- docker tag $IMAGE_GPU $DOCKERHUB_GPULATEST
- docker push $DOCKERHUB_GPULATEST
......@@ -98,7 +98,7 @@ RUN cd tensorflow \
### OTB
ARG GUI=false
ARG OTB=5086d7601d80f2427f4d4d7f2398ec46e7efa300
ARG OTB=8.1.2
ARG OTBTESTS=false
RUN mkdir /src/otb
......
......@@ -33,8 +33,8 @@ The documentation is available on [otbtf.readthedocs.io](https://otbtf.readthedo
You can use our latest GPU enabled docker images.
```bash
docker run --runtime=nvidia -ti mdl4eo/otbtf:4.2.0-gpu otbcli_PatchesExtraction
docker run --runtime=nvidia -ti mdl4eo/otbtf:4.2.0-gpu python -c "import otbtf"
docker run --runtime=nvidia -ti mdl4eo/otbtf:latest-gpu otbcli_PatchesExtraction
docker run --runtime=nvidia -ti mdl4eo/otbtf:latest-gpu python -c "import otbtf"
```
You can also build OTBTF from sources (see the documentation)
......
Version 4.2.1 (5 oct 2023)
----------------------------------------------------------------
* Fix a bug occuring when input images origins were not sharing the same pixel grid
* CI to push "latest-gpu" tag on dockerhub
* Move to OTB 8.2.1
Version 4.2.0 (12 sep 2023)
----------------------------------------------------------------
* Add new python modules: `otbtf.layers` (with new classes `DilatedMask`, `ApplyMask`, `ScalarsTile`, `ArgMax`, `Max`) and `otbtf.ops` (`one_hot()`)
......
......@@ -5,13 +5,13 @@ We recommend to use OTBTF from official docker images.
Latest CPU-only docker image:
```commandline
docker pull mdl4eo/otbtf:4.2.0-cpu
docker pull mdl4eo/otbtf:latest
```
Latest GPU-ready docker image:
```commandline
docker pull mdl4eo/otbtf:4.2.0-gpu
docker pull mdl4eo/otbtf:latest-gpu
```
Read more in the following sections.
......@@ -25,12 +25,12 @@ Since OTBTF >= 3.2.1 you can find the latest docker images on
| Name | Os | TF | OTB | Description | Dev files | Compute capability |
|------------------------------------------------------------------------------------| ------------- |-------|-------| ---------------------- | --------- | ------------------ |
| **mdl4eo/otbtf:4.2.0-cpu** | Ubuntu Jammy | r2.12 | 8.1.0 | CPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6|
| **mdl4eo/otbtf:4.2.0-cpu-dev** | Ubuntu Jammy | r2.12 | 8.1.0 | CPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6|
| **mdl4eo/otbtf:4.2.0-gpu** | Ubuntu Jammy | r2.12 | 8.1.0 | GPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6|
| **mdl4eo/otbtf:4.2.0-gpu-dev** | Ubuntu Jammy | r2.12 | 8.1.0 | GPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6|
| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.0-gpu-opt** | Ubuntu Jammy | r2.12 | 8.1.0 | GPU with opt. | no | 5.2,6.1,7.0,7.5,8.6|
| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.0-gpu-opt-dev** | Ubuntu Jammy | r2.12 | 8.1.0 | GPU with opt. (dev) | yes | 5.2,6.1,7.0,7.5,8.6|
| **mdl4eo/otbtf:4.2.1-cpu** | Ubuntu Jammy | r2.12 | 8.1.2 | CPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6|
| **mdl4eo/otbtf:4.2.1-cpu-dev** | Ubuntu Jammy | r2.12 | 8.1.2 | CPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6|
| **mdl4eo/otbtf:4.2.1-gpu** | Ubuntu Jammy | r2.12 | 8.1.2 | GPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6|
| **mdl4eo/otbtf:4.2.1-gpu-dev** | Ubuntu Jammy | r2.12 | 8.1.2 | GPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6|
| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.1-gpu-opt** | Ubuntu Jammy | r2.12 | 8.1.2 | GPU with opt. | no | 5.2,6.1,7.0,7.5,8.6|
| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.1-gpu-opt-dev** | Ubuntu Jammy | r2.12 | 8.1.2 | GPU with opt. (dev) | yes | 5.2,6.1,7.0,7.5,8.6|
The list of older releases is available [here](#older-images).
......@@ -51,13 +51,13 @@ You can then use the OTBTF `gpu` tagged docker images with the **NVIDIA runtime*
With Docker version earlier than 19.03 :
```bash
docker run --runtime=nvidia -ti mdl4eo/otbtf:4.2.0-gpu bash
docker run --runtime=nvidia -ti mdl4eo/otbtf:latest-gpu bash
```
With Docker version including and after 19.03 :
```bash
docker run --gpus all -ti mdl4eo/otbtf:4.2.0-gpu bash
docker run --gpus all -ti mdl4eo/otbtf:latest-gpu bash
```
You can find some details on the **GPU docker image** and some **docker tips
......@@ -80,7 +80,7 @@ See here how to install docker on Ubuntu
1. Install [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install-win10#manual-installation-steps) (Windows Subsystem for Linux)
2. Install [docker desktop](https://www.docker.com/products/docker-desktop)
3. Start **docker desktop** and **enable WSL2** from *Settings* > *General* then tick the box *Use the WSL2 based engine*
3. Open a **cmd.exe** or **PowerShell** terminal, and type `docker create --name otbtf-cpu --interactive --tty mdl4eo/otbtf:4.2.0-cpu`
3. Open a **cmd.exe** or **PowerShell** terminal, and type `docker create --name otbtf-cpu --interactive --tty mdl4eo/otbtf:latest`
4. Open **docker desktop**, and check that the docker is running in the **Container/Apps** menu
![Docker desktop, after the docker image is downloaded and ready to use](images/docker_desktop_1.jpeg)
5. From **docker desktop**, click on the icon highlighted as shown below, and use the bash terminal that should pop up!
......@@ -172,4 +172,10 @@ Here you can find the list of older releases of OTBTF:
| **mdl4eo/otbtf:4.1.0-gpu-dev** | Ubuntu Jammy | r2.12 | 8.1.0 | GPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6|
| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.1.0-gpu-opt** | Ubuntu Jammy | r2.12 | 8.1.0 | GPU with opt. | no | 5.2,6.1,7.0,7.5,8.6|
| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.1.0-gpu-opt-dev** | Ubuntu Jammy | r2.12 | 8.1.0 | GPU with opt. (dev) | yes | 5.2,6.1,7.0,7.5,8.6|
| **mdl4eo/otbtf:4.2.0-cpu** | Ubuntu Jammy | r2.12 | 8.1.0 | CPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6|
| **mdl4eo/otbtf:4.2.0-cpu-dev** | Ubuntu Jammy | r2.12 | 8.1.0 | CPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6|
| **mdl4eo/otbtf:4.2.0-gpu** | Ubuntu Jammy | r2.12 | 8.1.0 | GPU, no optimization | no | 5.2,6.1,7.0,7.5,8.6|
| **mdl4eo/otbtf:4.2.0-gpu-dev** | Ubuntu Jammy | r2.12 | 8.1.0 | GPU, no optimization (dev) | yes | 5.2,6.1,7.0,7.5,8.6|
| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.0-gpu-opt** | Ubuntu Jammy | r2.12 | 8.1.0 | GPU with opt. | no | 5.2,6.1,7.0,7.5,8.6|
| **gitlab.irstea.fr/remi.cresson/otbtf/container_registry/otbtf:4.2.0-gpu-opt-dev** | Ubuntu Jammy | r2.12 | 8.1.0 | GPU with opt. (dev) | yes | 5.2,6.1,7.0,7.5,8.6|
......@@ -204,6 +204,24 @@ TensorflowMultisourceModelFilter<TInputImage, TOutputImage>::GenerateOutputInfor
m_OutputSpacing[0] *= m_OutputSpacingScale;
m_OutputSpacing[1] *= m_OutputSpacingScale;
// Check that inputs are aligned
if (m_FullyConvolutional)
{
for (unsigned int dim = 0; dim < OutputImageType::ImageDimension; ++dim)
{
const float ref_spc = this->GetInput(0)->GetSpacing()[dim];
const float ref = this->GetInput(0)->GetOrigin()[dim] - 0.5 * ref_spc;
for (unsigned int imageIndex = 1; imageIndex < this->GetNumberOfInputs(); imageIndex++)
{
const float orig = this->GetInput(imageIndex)->GetOrigin()[dim] - 0.5 * this->GetInput(imageIndex)->GetSpacing()[dim];
if (ref != orig)
otbLogMacro(Warning, << "Input #" << imageIndex << " origin does not match reference (first) input");
if (std::fmod(ref - orig, ref_spc) != 0.0)
otbLogMacro(Warning, << "Input #" << imageIndex << " pixels are not aligned with reference (first) input");
} // next input
} // next dim
}
// Compute the extent of each input images and update the extent or the output image.
// The extent of the output image is the intersection of all input images extents.
PointType extentInf, extentSup;
......@@ -226,6 +244,28 @@ TensorflowMultisourceModelFilter<TInputImage, TOutputImage>::GenerateOutputInfor
}
}
if (m_FullyConvolutional)
{
// Align extent over inputs pixel grid, so that the extent lies on the
// common pixel grid of all inputs.
// When this can't be done (i.e. shifted origins), a bug is likely to occur.
// However the warning issued previously should give a hint about the issue.
PointType alignedExtentInf, alignedExtentSup;
alignedExtentSup.Fill(itk::NumericTraits<double>::max());
alignedExtentInf.Fill(itk::NumericTraits<double>::NonpositiveMin());
for (unsigned int imageIndex = 0; imageIndex < this->GetNumberOfInputs(); imageIndex++)
for (unsigned int dim = 0; dim < OutputImageType::ImageDimension; ++dim)
{
const double spc = this->GetInput(imageIndex)->GetSpacing()[dim];
const double ref = this->GetInput(imageIndex)->GetOrigin()[dim] - 0.5 * spc;
const double alignedInf = std::ceil((extentInf[dim] - ref) / spc) * spc + ref;
const double alignedSup = std::floor((extentSup[dim] - ref) / spc) * spc + ref;
alignedExtentInf[dim] = vnl_math_max(alignedInf, alignedExtentInf[dim]);
alignedExtentSup[dim] = vnl_math_min(alignedSup, alignedExtentSup[dim]);
}
extentInf = alignedExtentInf;
extentSup = alignedExtentSup;
}
// Set final origin, aligned to the reference image grid.
// Here we simply get back to the center of the pixel (extents are pixels corners coordinates)
......
......@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
setuptools.setup(
name="otbtf",
version="4.2.0",
version="4.2.1",
author="Remi Cresson",
author_email="remi.cresson@inrae.fr",
description="OTBTF: Orfeo ToolBox meets TensorFlow",
......
......@@ -17,3 +17,12 @@
-DUSE_SYSTEM_TINYXML=ON
-DUSE_SYSTEM_ZLIB=ON
-DUSE_SYSTEM_SWIG=ON
-DOTB_USE_QT=OFF
-DOTB_USE_OPENGL=OFF
-DOTB_USE_GLUT=OFF
-DOTB_USE_GLEW=OFF
-DOTB_USE_GLFW=OFF
-DGDAL_SB_EXTRA_OPTIONS=--with-geos
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment