Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Cresson Remi
LSGRM
Commits
2d62784a
Commit
2d62784a
authored
Mar 21, 2021
by
Gaetano Raffaele
Browse files
ENH: Reworking resume option
parent
5156e977
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/otbLSGRM.cxx
View file @
2d62784a
...
...
@@ -120,9 +120,9 @@ private:
AddParameter
(
ParameterType_Int
,
"resumetilecol"
,
"Starting tile column in resume mode"
);
SetDefaultParameterInt
(
"resumetilerow"
,
0
);
SetDefaultParameterInt
(
"resumetilecol"
,
0
);
//
MandatoryOff("resume");
//
MandatoryOff("resume
.
tile
x
");
//
MandatoryOff("resume
.
tile
y
");
MandatoryOff
(
"resume"
);
MandatoryOff
(
"resumetile
row
"
);
MandatoryOff
(
"resumetile
col
"
);
}
void
DoUpdateParameters
()
...
...
include/lsgrmController.txx
View file @
2d62784a
...
...
@@ -95,7 +95,6 @@ void Controller<TSegmenter>::RunSegmentation()
// temp. patch, maybe calculate real current memory after resuming graphs.
long long unsigned int accumulatedMemory = 2 * m_Memory;
if (!m_Resuming) {
accumulatedMemory = RunFirstPartialSegmentation<TSegmenter>(
m_InputImage,
m_SpecificParameters,
...
...
@@ -107,10 +106,8 @@ void Controller<TSegmenter>::RunSegmentation()
m_NbTilesY,
m_TileWidth,
m_TileHeight,
isFusion);
} else {
isFusion = true;
}
isFusion,
m_Resuming);
#ifdef OTB_USE_MPI
GatherUsefulVariables(accumulatedMemory, isFusion);
...
...
include/lsgrmGraphOperations.txx
View file @
2d62784a
...
...
@@ -2,11 +2,18 @@
#define __LSGRM_GRAPH_OPERATIONS_TXX
//#include "lsgrmGraphOperations.h"
//#include <unistd.h>
#include <fstream>
#include <cstdio>
namespace lsgrm
{
bool file_exists(const std::string& fileName)
{
std::ifstream infile(fileName.c_str());
return infile.good();
}
template<class TSegmenter>
typename TSegmenter::ImageType::Pointer ReadImageRegion(
typename TSegmenter::ImageType * inputPtr,
...
...
@@ -640,7 +647,8 @@ long long unsigned int RunFirstPartialSegmentation(
const unsigned int nbTilesY,
const unsigned int tileWidth,
const unsigned int tileHeight,
bool& isFusion)
bool& isFusion,
bool resume)
{
using ImageType = typename TSegmenter::ImageType;
...
...
@@ -664,6 +672,19 @@ long long unsigned int RunFirstPartialSegmentation(
{
// Reading images
ProcessingTile currentTile = tiles[row*nbTilesX + col];
if (resume && file_exists(currentTile.nodeFileName) && file_exists(currentTile.edgeFileName))
{
std::cout << "\tResuming graph..." << std::endl;
TSegmenter segmenter;
ReadGraph<TSegmenter>(segmenter.m_Graph, currentTile.nodeFileName, currentTile.edgeFileName);
// Retrieve the amount of memory to store this graph
std::cout << "\tGet graph memory..." << std::endl;
accumulatedMemory += segmenter.GetGraphMemory();
if(segmenter.GetComplete() == false)
isFusion = true;
continue;
}
std::cout << "Processing tile " << (row*nbTilesX + col) << " / " << (nbTilesX*nbTilesY) <<
" (" << col << ", " << row << ")" <<
...
...
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