diff --git a/app/otbImageClassifierFromDeepFeatures.cxx b/app/otbImageClassifierFromDeepFeatures.cxx index b699a02726ec5411a82bb622b25cbea51ac38603..5f76322d3690ac8bbb9af2e70e5625ad15a8ca58 100644 --- a/app/otbImageClassifierFromDeepFeatures.cxx +++ b/app/otbImageClassifierFromDeepFeatures.cxx @@ -92,9 +92,11 @@ private: ShareParameter("deepmodel", "tfmodel.model", "Deep net model parameters", "Deep net model parameters"); ShareParameter("output", "tfmodel.output", - "Deep net outputs parameters", "Deep net outputs parameters"); - ShareParameter("finetuning", "tfmodel.finetuning", - "Deep net fine tuning parameters","Deep net fine tuning parameters"); + "Deep net outputs parameters", + "Deep net outputs parameters"); + ShareParameter("optim", "tfmodel.optim", + "This group of parameters allows optimization of processing time", + "This group of parameters allows optimization of processing time"); // Classify shared parameters ShareParameter("model" , "classif.model" , "Model file" , "Model file" ); diff --git a/app/otbTensorflowModelServe.cxx b/app/otbTensorflowModelServe.cxx index 14d0d7cb88314613ff9e92ce9471e9bfd5b4a281..84cc692d1fae246d070967195ba4af3b2b11819d 100644 --- a/app/otbTensorflowModelServe.cxx +++ b/app/otbTensorflowModelServe.cxx @@ -106,14 +106,14 @@ public: // Parameter group keys ss_key_in << ss_key_group.str() << ".il"; - ss_key_dims_x << ss_key_group.str() << ".fovx"; - ss_key_dims_y << ss_key_group.str() << ".fovy"; + ss_key_dims_x << ss_key_group.str() << ".rfieldx"; + ss_key_dims_y << ss_key_group.str() << ".rfieldy"; ss_key_ph << ss_key_group.str() << ".placeholder"; // Parameter group descriptions ss_desc_in << "Input image (or list to stack) for source #" << inputNumber; - ss_desc_dims_x << "Field of view width for source #" << inputNumber; - ss_desc_dims_y << "Field of view height for source #" << inputNumber; + ss_desc_dims_x << "Input receptive field (width) for source #" << inputNumber; + ss_desc_dims_y << "Input receptive field (height) for source #" << inputNumber; ss_desc_ph << "Name of the input placeholder for source #" << inputNumber; // Populate group @@ -182,22 +182,22 @@ public: MandatoryOn ("output.names"); // Output Field of Expression - AddParameter(ParameterType_Int, "output.foex", "The output field of expression (x)"); - SetMinimumParameterIntValue ("output.foex", 1); - SetDefaultParameterInt ("output.foex", 1); - MandatoryOn ("output.foex"); - AddParameter(ParameterType_Int, "output.foey", "The output field of expression (y)"); - SetMinimumParameterIntValue ("output.foey", 1); - SetDefaultParameterInt ("output.foey", 1); - MandatoryOn ("output.foey"); + AddParameter(ParameterType_Int, "output.efieldx", "The output expression field (width)"); + SetMinimumParameterIntValue ("output.efieldx", 1); + SetDefaultParameterInt ("output.efieldx", 1); + MandatoryOn ("output.efieldx"); + AddParameter(ParameterType_Int, "output.efieldy", "The output expression field (height)"); + SetMinimumParameterIntValue ("output.efieldy", 1); + SetDefaultParameterInt ("output.efieldy", 1); + MandatoryOn ("output.efieldy"); // Fine tuning - AddParameter(ParameterType_Group, "finetuning" , "Fine tuning performance or consistency parameters"); - AddParameter(ParameterType_Bool, "finetuning.disabletiling", "Disable tiling"); - MandatoryOff ("finetuning.disabletiling"); - AddParameter(ParameterType_Int, "finetuning.tilesize", "Tile width used to stream the filter output"); - SetMinimumParameterIntValue ("finetuning.tilesize", 1); - SetDefaultParameterInt ("finetuning.tilesize", 16); + AddParameter(ParameterType_Group, "optim" , "This group of parameters allows optimization of processing time"); + AddParameter(ParameterType_Bool, "optim.disabletiling", "Disable tiling"); + MandatoryOff ("optim.disabletiling"); + AddParameter(ParameterType_Int, "optim.tilesize", "Tile width used to stream the filter output"); + SetMinimumParameterIntValue ("optim.tilesize", 1); + SetDefaultParameterInt ("optim.tilesize", 16); // Output image AddParameter(ParameterType_OutputImage, "out", "output image"); @@ -205,8 +205,8 @@ public: // Example SetDocExampleParameterValue("source1.il", "spot6pms.tif"); SetDocExampleParameterValue("source1.placeholder", "x1"); - SetDocExampleParameterValue("source1.fovx", "16"); - SetDocExampleParameterValue("source1.fovy", "16"); + SetDocExampleParameterValue("source1.rfieldx", "16"); + SetDocExampleParameterValue("source1.rfieldy", "16"); SetDocExampleParameterValue("model.dir", "/tmp/my_saved_model/"); SetDocExampleParameterValue("model.userplaceholders", "is_training=false dropout=0.0"); SetDocExampleParameterValue("output.names", "out_predict1 out_proba1"); @@ -286,10 +286,10 @@ public: otbAppLogINFO("Output field of expression: " << m_TFFilter->GetOutputExpressionFields()[0]); // Streaming - if (GetParameterInt("finetuning.disabletiling")!=1) + if (GetParameterInt("optim.disabletiling")!=1) { // Get the tile size - const unsigned int tileSize = GetParameterInt("finetuning.tilesize"); + const unsigned int tileSize = GetParameterInt("optim.tilesize"); otbAppLogINFO("Force tiling with squared tiles of " << tileSize) // Update the TF filter to get the output image size diff --git a/app/otbTensorflowModelTrain.cxx b/app/otbTensorflowModelTrain.cxx index e6c979e136812e7b248c22f0bce35b80b1fb94bc..9adf498f1dae2e461a1a762ad455ddac4734d879 100644 --- a/app/otbTensorflowModelTrain.cxx +++ b/app/otbTensorflowModelTrain.cxx @@ -130,8 +130,8 @@ public: // Parameter group descriptions ss_desc_tr_in << "Input image (or list to stack) for source #" << inputNumber << " (training)"; ss_desc_val_in << "Input image (or list to stack) for source #" << inputNumber << " (validation)"; - ss_desc_dims_x << "Field of view width for source #" << inputNumber; - ss_desc_dims_y << "Field of view height for source #" << inputNumber; + ss_desc_dims_x << "Patch size (x) for source #" << inputNumber; + ss_desc_dims_y << "Patch size (y) for source #" << inputNumber; ss_desc_tr_ph << "Name of the input placeholder for source #" << inputNumber << " (training)"; ss_desc_val_ph << "Name of the input placeholder " "or output tensor for source #" << inputNumber << " (validation)"; diff --git a/app/otbTrainClassifierFromDeepFeatures.cxx b/app/otbTrainClassifierFromDeepFeatures.cxx index e54d572374ecaec68faccaf988fefcad99080b9f..d1377e82e005250d2b9e50ea2fc84df33f7356b0 100644 --- a/app/otbTrainClassifierFromDeepFeatures.cxx +++ b/app/otbTrainClassifierFromDeepFeatures.cxx @@ -63,7 +63,6 @@ private: } - void DoInit() { @@ -91,7 +90,7 @@ private: } ShareParameter("model", "tfmodel.model", "Deep net model parameters", "Deep net model parameters"); ShareParameter("output", "tfmodel.output", "Deep net outputs parameters", "Deep net outputs parameters"); - ShareParameter("finetuning", "tfmodel.finetuning", "Deep net fine tuning parameters", "Deep net fine tuning parameters"); + ShareParameter("optim", "tfmodel.optim", "This group of parameters allows optimization of processing time", "This group of parameters allows optimization of processing time"); // Train shared parameters ShareParameter("vd" , "train.io.vd" , "Input vector data list" , "Input vector data list" ); diff --git a/include/otbTensorflowMultisourceModelValidate.hxx b/include/otbTensorflowMultisourceModelValidate.hxx index 31047f36279c96113c5af45f7014768bc51537f7..a8b5a32d107e89dbf748f35ae355ee3be2aacf3a 100644 --- a/include/otbTensorflowMultisourceModelValidate.hxx +++ b/include/otbTensorflowMultisourceModelValidate.hxx @@ -30,36 +30,35 @@ TensorflowMultisourceModelValidate<TInputImage> { Superclass::GenerateOutputInformation(); - ////////////////////////////////////////////////////////////////////////////////////////// - // Check the references - ////////////////////////////////////////////////////////////////////////////////////////// - + // Check that there is some reference const unsigned int nbOfRefs = m_References.size(); if (nbOfRefs == 0) { itkExceptionMacro("No reference is set"); } - SizeListType outputEFSizes = this->GetOutputExpressionFields(); - if (nbOfRefs != outputEFSizes.size()) + + // Check the number of references + SizeListType outputPatchSizes = this->GetOutputExpressionFields(); + if (nbOfRefs != outputPatchSizes.size()) { - itkExceptionMacro("There is " << nbOfRefs << " but only " << - outputEFSizes.size() << " field of expression sizes"); + itkExceptionMacro("There is " << nbOfRefs << " references but only " << + outputPatchSizes.size() << " output patch sizes"); } // Check reference image infos - for (unsigned int i = 0 ;i < nbOfRefs ; i++) + for (unsigned int i = 0 ; i < nbOfRefs ; i++) { - const SizeType outputFOESize = outputEFSizes[i]; + const SizeType outputPatchSize = outputPatchSizes[i]; const RegionType refRegion = m_References[i]->GetLargestPossibleRegion(); - if (refRegion.GetSize(0) != outputFOESize[0]) + if (refRegion.GetSize(0) != outputPatchSize[0]) { itkExceptionMacro("Reference image " << i << " width is " << refRegion.GetSize(0) << - " but field of expression width is " << outputFOESize[0]); + " but patch size (x) is " << outputPatchSize[0]); } - if (refRegion.GetSize(1) / outputFOESize[1] != this->GetNumberOfSamples()) + if (refRegion.GetSize(1) != this->GetNumberOfSamples() * outputPatchSize[1]) { itkExceptionMacro("Reference image " << i << " height is " << refRegion.GetSize(1) << - " but field of expression width is " << outputFOESize[1] << + " but patch size (y) is " << outputPatchSize[1] << " which is not consistent with the number of samples (" << this->GetNumberOfSamples() << ")"); } }