Skip to content
Snippets Groups Projects
Commit 3c3eddd1 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

app added

parent f3c26934
No related branches found
No related tags found
1 merge request!4Dimensionality reduction algorithms
......@@ -3,3 +3,4 @@ cmake_minimum_required(VERSION 2.8.9)
project(CbDimensionalityReduction)
#set(CbDimensionalityReduction_LIBRARIES CbDimensionalityReduction)
otb_module_impl()
OTB_CREATE_APPLICATION(NAME CbDimensionalityReductionTrainer
OTB_CREATE_APPLICATION(
NAME CbDimensionalityReductionTrainer
SOURCES cbDimensionalityReductionTrainer.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES}
)
OTB_CREATE_APPLICATION(
NAME CbDimensionalityReduction
SOURCES cbDimensionalityReduction.cxx
LINK_LIBRARIES ${${otb-module}_LIBRARIES} ${OTBCommon_LIBRARIES} ${OTBITK_LIBRARIES} ${OTBBoost_LIBRARIES} ${OTBShark_LIBRARIES}
)
#include "otbWrapperApplication.h"
#include "otbWrapperApplicationFactory.h"
#include "otbWrapperChoiceParameter.h"
#include <iostream>
#include "otbImage.h"
//#include "otbVectorImage.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include <shark/Models/Autoencoder.h>//normal autoencoder model
#include <shark/Models/TiedAutoencoder.h>//autoencoder with tied weights
#include <shark/Models/Normalizer.h>
#include "encode_filter.h"
namespace otb
{
namespace Wrapper
{
class CbDimensionalityReduction : public otb::Wrapper::Application
{
......@@ -13,6 +34,19 @@ private:
{
SetName("CbDimensionalityReduction");
SetDescription("Perform dimensionality reduction on the input image");
AddParameter(ParameterType_InputImage, "in", "Input Image");
SetParameterDescription( "in", "The input image to perform dimensionality reduction on.");
AddParameter(ParameterType_InputFilename, "model", "Model file");
SetParameterDescription("model", "A model file (produced by the cbDimensionalityReductionTrainer application).");
AddParameter(ParameterType_InputFilename, "normalizer", "Normalizer model file");
SetParameterDescription("normalizer", "A normalizer model file (produced by the cbDimensionalityReductionTrainer application).");
AddParameter(ParameterType_OutputImage, "out", "Output Image");
SetParameterDescription("out", "Output image");
AddRAMParameter();
}
......@@ -22,10 +56,36 @@ private:
void DoExecute()
{
typedef shark::TiedAutoencoder< shark::TanhNeuron, shark::LinearNeuron> AutoencoderType;
using image_type = otb::VectorImage<double, 2>;
using FilterType = EncodeFilter<image_type, AutoencoderType, shark::Normalizer<shark::RealVector>> ;
std::cout << "Appli !" << std::endl;
int ThisDoesNothing = 0;
FloatVectorImageType::Pointer inImage = GetParameterImage("in");
std::string encoderPath = GetParameterString("model");
std::string normalizerPath = GetParameterString("normalizer");
//inImage->UpdateOutputInformation();
using ReaderType = otb::ImageFileReader<image_type>;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName("/mnt/data/home/vincenta/features_2014/SL_MultiTempGapF_Brightness_NDVI_NDWI__.tif");
FilterType::Pointer filter = FilterType::New();
filter->SetAutoencoderModel(encoderPath);
filter->SetNormalizerModel(normalizerPath);
filter->SetInput(reader->GetOutput());
//filter->SetInput(inImage);
filter->UpdateOutputInformation();
SetParameterOutputImage("out", filter->GetOutput());
}
};
OTB_APPLICATION_EXPORT(CbDimensionalityReduction)
}
}
OTB_APPLICATION_EXPORT(otb::Wrapper::CbDimensionalityReduction)
......@@ -13,6 +13,7 @@ private:
{
SetName("CbDimensionalityReductionTrainer");
SetDescription("Trainer for the dimensionality reduction algorithms used in the cbDimensionalityReduction application.");
AddRAMParameter();
}
void DoUpdateParameters()
......@@ -20,7 +21,8 @@ private:
}
void DoExecute()
{
{
std::cout << "Appli !" << std::endl;
int ThisDoesNothing = 0;
}
......
......@@ -3,7 +3,9 @@ otb_module(CbDimensionalityReduction
DEPENDS
OTBCommon
OTBApplicationEngine
OTBITK
OTBShark
OTBBoost
DESCRIPTION
"${DOCUMENTATION}"
)
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