Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Lozac'h Loic
otbtf
Commits
37510b4d
Commit
37510b4d
authored
May 10, 2019
by
Cresson Remi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop'
parents
4267592c
49148d2f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
176 additions
and
4 deletions
+176
-4
app/otbLabelImageSampleSelection.cxx
app/otbLabelImageSampleSelection.cxx
+2
-1
include/otbTensorflowMultisourceModelFilter.hxx
include/otbTensorflowMultisourceModelFilter.hxx
+2
-2
include/otbTensorflowMultisourceModelLearningBase.h
include/otbTensorflowMultisourceModelLearningBase.h
+1
-0
include/otbTensorflowMultisourceModelLearningBase.hxx
include/otbTensorflowMultisourceModelLearningBase.hxx
+1
-1
tools/dockerfiles/bionic.tf-r1.14.otb-develop/Dockerfile
tools/dockerfiles/bionic.tf-r1.14.otb-develop/Dockerfile
+170
-0
No files found.
app/otbLabelImageSampleSelection.cxx
View file @
37510b4d
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
// image utils
// image utils
#include "otbTensorflowCommon.h"
#include "otbTensorflowCommon.h"
#include <algorithm>
namespace
otb
namespace
otb
{
{
...
@@ -211,7 +212,7 @@ public:
...
@@ -211,7 +212,7 @@ public:
// Check the smallest number of samples amongst classes
// Check the smallest number of samples amongst classes
IndexValueType
min_elem_in_class
=
itk
::
NumericTraits
<
IndexValueType
>::
max
();
IndexValueType
min_elem_in_class
=
itk
::
NumericTraits
<
IndexValueType
>::
max
();
for
(
LabelImageType
::
InternalPixelType
classIdx
=
0
;
classIdx
<
number_of_classes
;
classIdx
++
)
for
(
LabelImageType
::
InternalPixelType
classIdx
=
0
;
classIdx
<
number_of_classes
;
classIdx
++
)
min_elem_in_class
=
vcl_
min
(
min_elem_in_class
,
number_of_samples
[
classIdx
]);
min_elem_in_class
=
std
::
min
(
min_elem_in_class
,
number_of_samples
[
classIdx
]);
// If one class is empty, throw an error
// If one class is empty, throw an error
if
(
min_elem_in_class
==
0
)
if
(
min_elem_in_class
==
0
)
...
...
include/otbTensorflowMultisourceModelFilter.hxx
View file @
37510b4d
...
@@ -224,8 +224,8 @@ TensorflowMultisourceModelFilter<TInputImage, TOutputImage>
...
@@ -224,8 +224,8 @@ TensorflowMultisourceModelFilter<TInputImage, TOutputImage>
}
}
// Set final size
// Set final size
m_OutputSize
[
0
]
=
vcl_
floor
(
(
extentSup
[
0
]
-
extentInf
[
0
])
/
vcl_
abs
(
m_OutputSpacing
[
0
])
)
+
1
;
m_OutputSize
[
0
]
=
std
::
floor
(
(
extentSup
[
0
]
-
extentInf
[
0
])
/
std
::
abs
(
m_OutputSpacing
[
0
])
)
+
1
;
m_OutputSize
[
1
]
=
vcl_
floor
(
(
extentSup
[
1
]
-
extentInf
[
1
])
/
vcl_
abs
(
m_OutputSpacing
[
1
])
)
+
1
;
m_OutputSize
[
1
]
=
std
::
floor
(
(
extentSup
[
1
]
-
extentInf
[
1
])
/
std
::
abs
(
m_OutputSpacing
[
1
])
)
+
1
;
// Set final origin
// Set final origin
m_OutputOrigin
[
0
]
=
extentInf
[
0
];
m_OutputOrigin
[
0
]
=
extentInf
[
0
];
...
...
include/otbTensorflowMultisourceModelLearningBase.h
View file @
37510b4d
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
#include "itkProcessObject.h"
#include "itkProcessObject.h"
#include "itkNumericTraits.h"
#include "itkNumericTraits.h"
#include "itkSimpleDataObjectDecorator.h"
#include "itkSimpleDataObjectDecorator.h"
#include <algorithm>
// Base
// Base
#include "otbTensorflowMultisourceModelBase.h"
#include "otbTensorflowMultisourceModelBase.h"
...
...
include/otbTensorflowMultisourceModelLearningBase.hxx
View file @
37510b4d
...
@@ -124,7 +124,7 @@ TensorflowMultisourceModelLearningBase<TInputImage>
...
@@ -124,7 +124,7 @@ TensorflowMultisourceModelLearningBase<TInputImage>
{
{
// Batches loop
// Batches loop
const
IndexValueType
nBatches
=
vcl_
ceil
(
m_NumberOfSamples
/
m_BatchSize
);
const
IndexValueType
nBatches
=
std
::
ceil
(
m_NumberOfSamples
/
m_BatchSize
);
const
IndexValueType
rest
=
m_NumberOfSamples
%
m_BatchSize
;
const
IndexValueType
rest
=
m_NumberOfSamples
%
m_BatchSize
;
itk
::
ProgressReporter
progress
(
this
,
0
,
nBatches
);
itk
::
ProgressReporter
progress
(
this
,
0
,
nBatches
);
...
...
tools/dockerfiles/bionic.tf-r1.14.otb-develop/Dockerfile
0 → 100644
View file @
37510b4d
FROM
ubuntu:18.04
MAINTAINER
Remi Cresson <remi.cresson[at]irstea[dot]fr>
RUN
apt-get update
-y
\
&&
apt-get upgrade
-y
\
&&
apt-get
install
-y
--no-install-recommends
\
ca-certificates
\
curl
\
make
\
cmake
\
g++
\
gcc
\
git
\
libtool
\
swig
\
xvfb
\
wget
\
autoconf
\
automake
\
pkg-config
\
zip
\
zlib1g-dev
\
unzip
\
&&
rm
-rf
/var/lib/apt/lists/
*
# ----------------------------------------------------------------------------
# OTB and TensorFlow dependencies
# ----------------------------------------------------------------------------
RUN
apt-get update
-y
\
&&
apt-get upgrade
-y
\
&&
apt-get
install
-y
--no-install-recommends
\
freeglut3-dev
\
libboost-date-time-dev
\
libboost-filesystem-dev
\
libboost-graph-dev
\
libboost-program-options-dev
\
libboost-system-dev
\
libboost-thread-dev
\
libcurl4-gnutls-dev
\
libexpat1-dev
\
libfftw3-dev
\
libgdal-dev
\
libgeotiff-dev
\
libglew-dev
\
libglfw3-dev
\
libgsl-dev
\
libinsighttoolkit4-dev
\
libkml-dev
\
libmuparser-dev
\
libmuparserx-dev
\
libopencv-core-dev
\
libopencv-ml-dev
\
libopenthreads-dev
\
libossim-dev
\
libpng-dev
\
libqt5opengl5-dev
\
libqwt-qt5-dev
\
libsvm-dev
\
libtinyxml-dev
\
qtbase5-dev
\
qttools5-dev
\
default-jdk
\
python3-pip
\
python3-dev
\
python3-mock
\
python3-numpy
\
python3-gdal
\
python3-setuptools
\
libxmu-dev
\
libxi-dev
\
qttools5-dev-tools
\
&&
rm
-rf
/var/lib/apt/lists/
*
\
&&
ln
-s
/usr/bin/python3 /usr/bin/python
\
&&
pip3
install
pip six numpy wheel mock keras
# ----------------------------------------------------------------------------
# Build TensorFlow
# ----------------------------------------------------------------------------
RUN
export
TF_ROOT
=
/work/tf
\
&&
mkdir
-p
${
TF_ROOT
}
/bazel
\
&&
cd
${
TF_ROOT
}
/bazel
\
&&
wget https://github.com/bazelbuild/bazel/releases/download/0.24.1/bazel-0.24.1-installer-linux-x86_64.sh
\
&&
chmod
+x bazel-0.24.1-installer-linux-x86_64.sh
\
&&
./bazel-0.24.1-installer-linux-x86_64.sh
\
&&
export
PATH
=
"
$PATH
:
$HOME
/bin"
\
&&
cd
$TF_ROOT
\
&&
git clone https://github.com/tensorflow/tensorflow.git
\
&&
cd
tensorflow
\
&&
git checkout r1.14
\
&&
echo
"
\n\n\n\n\n\n\n\n\n
"
| ./configure
\
&&
bazel build //tensorflow:libtensorflow_framework.so //tensorflow:libtensorflow_cc.so //tensorflow/tools/pip_package:build_pip_package
\
&&
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
\
&&
pip3
install
$(
find /tmp/tensorflow_pkg/
-type
f
-iname
"tensorflow*.whl"
)
\
&&
./tensorflow/contrib/makefile/build_all_linux.sh
\
&&
mkdir
-p
/work/tf/installdir/lib
\
&&
mkdir
-p
/work/tf/installdir/include
\
&&
cp
-v
bazel-bin/tensorflow/libtensorflow_cc.so /work/tf/installdir/lib
\
&&
cp
-v
bazel-bin/tensorflow/libtensorflow_framework.so /work/tf/installdir/lib
\
&&
cp
-v
tensorflow/contrib/makefile/gen/protobuf/lib/libprotobuf.a /work/tf/installdir/lib
\
&&
cp
-v
tensorflow/contrib/makefile/downloads/nsync/builds/default.linux.c++11/
*
.a /work/tf/installdir/lib
\
&&
cp
-rv
bazel-genfiles/
*
/work/tf/installdir/include/
\
&&
cp
-rv
tensorflow/cc /work/tf/installdir/include/tensorflow/
\
&&
cp
-rv
tensorflow/core /work/tf/installdir/include/tensorflow/
\
&&
cp
-rv
third_party /work/tf/installdir/include/
\
&&
cp
-rv
tensorflow/contrib/makefile/gen/protobuf/include/
*
/work/tf/installdir/include/
\
&&
cp
-rv
tensorflow/contrib/makefile/downloads/eigen/Eigen /work/tf/installdir/include/
\
&&
cp
-rv
tensorflow/contrib/makefile/downloads/eigen/unsupported /work/tf/installdir/include/
\
&&
cp
-rv
tensorflow/contrib/makefile/downloads/eigen/signature_of_eigen3_matrix_library /work/tf/installdir/include/
\
&&
cd
${
TF_ROOT
}
/tensorflow/tensorflow/contrib/makefile/downloads/absl
\
&&
find absl/
-name
'*.h'
-exec
cp
--parents
\{\}
/work/tf/installdir/include/
\;
\
&&
find absl/
-name
'*.inc'
-exec
cp
--parents
\{\}
/work/tf/installdir/include/
\;
\
&&
find /work/tf/installdir/
-name
"*.cc"
-type
f
-delete
# ----------------------------------------------------------------------------
# Build OTB
# ----------------------------------------------------------------------------
RUN
mkdir
-p
/work/otb/build
\
&&
cd
/work/otb
\
&&
git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb.git otb
\
&&
cd
otb
\
&&
git checkout 0df44b312d64d6c3890b65d3790d4a17d0fd5f23
\
&&
cd
/work/otb/build
\
&&
cmake /work/otb/otb/SuperBuild
\
-DUSE_SYSTEM_BOOST
=
ON
\
-DUSE_SYSTEM_CURL
=
ON
\
-DUSE_SYSTEM_EXPAT
=
ON
\
-DUSE_SYSTEM_FFTW
=
ON
\
-DUSE_SYSTEM_FREETYPE
=
ON
\
-DUSE_SYSTEM_GDAL
=
ON
\
-DUSE_SYSTEM_GEOS
=
ON
\
-DUSE_SYSTEM_GEOTIFF
=
ON
\
-DUSE_SYSTEM_GLEW
=
ON
\
-DUSE_SYSTEM_GLFW
=
ON
\
-DUSE_SYSTEM_GLUT
=
ON
\
-DUSE_SYSTEM_GSL
=
ON
\
-DUSE_SYSTEM_ITK
=
ON
\
-DUSE_SYSTEM_LIBKML
=
ON
\
-DUSE_SYSTEM_LIBSVM
=
ON
\
-DUSE_SYSTEM_MUPARSER
=
ON
\
-DUSE_SYSTEM_MUPARSERX
=
ON
\
-DUSE_SYSTEM_OPENCV
=
ON
\
-DUSE_SYSTEM_OPENTHREADS
=
ON
\
-DUSE_SYSTEM_OSSIM
=
ON
\
-DUSE_SYSTEM_PNG
=
ON
\
-DUSE_SYSTEM_QT5
=
ON
\
-DUSE_SYSTEM_QWT
=
ON
\
-DUSE_SYSTEM_TINYXML
=
ON
\
-DUSE_SYSTEM_ZLIB
=
ON
\
&&
cd
/work/otb/otb/Modules/Remote
\
&&
git clone https://github.com/remicres/otbtf.git
\
&&
cd
/work/otb/build/OTB/build
\
&&
cmake /work/otb/otb
\
-DModule_Mosaic
=
ON
\
-DModule_OTBTensorflow
=
ON
\
-DOTB_USE_TENSORFLOW
=
ON
\
-Dopencv_INCLUDE_DIR
=
/usr/include
\
-DTENSORFLOW_CC_LIB
=
/work/tf/installdir/lib/libtensorflow_cc.so
\
-DTENSORFLOW_FRAMEWORK_LIB
=
/work/tf/installdir/lib/libtensorflow_framework.so
\
-Dtensorflow_include_dir
=
/work/tf/installdir/include/
\
&&
cd
/work/otb/build/
\
&&
make
-j
$(
grep
-c
^processor /proc/cpuinfo
)
RUN
echo
"Create symlinks for tensorflow libs"
\
&&
ln
-s
/work/tf/installdir/lib/libtensorflow_cc.so /work/tf/installdir/lib/libtensorflow_cc.so.1
\
&&
ln
-s
/work/tf/installdir/lib/libtensorflow_framework.so /work/tf/installdir/lib/libtensorflow_framework.so.1
ENV
PATH "$PATH:/work/otb/superbuild_install/bin/"
ENV
LD_LIBRARY_PATH "$LD_LIBRARY_PATH:/work/otb/superbuild_install/lib/:/work/tf/installdir/lib/"
ENV
PYTHONPATH "$PYTHONPATH:/work/otb/superbuild_install/lib/otb/python/"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment