00001 #ifndef Impala_Core_ImageSet_ComputeKernelData_h
00002 #define Impala_Core_ImageSet_ComputeKernelData_h
00003
00004 #include "Core/ImageSet/Reporter.h"
00005 #include "Core/Training/PrecomputeTask.h"
00006
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace ImageSet
00012 {
00013
00014 class ComputeKernelData : public Listener
00015 {
00016 public:
00017
00018 typedef Persistency::KernelMatrixLocator KernelMatrixLocator;
00019
00020 ComputeKernelData(Reporter* reporter, CmdOptions& options)
00021 {
00022 if (options.GetNrArg() < 5)
00023 {
00024 ILOG_ERROR("Missing argument");
00025 return;
00026 }
00027 String name2 = options.GetArg(2);
00028 mDevelSet = Database::MakeRawDataSet(name2, true);
00029 mModel = options.GetArg(3);
00030 mKernelMatrixName = options.GetArg(4);
00031 mFeatureIndexCat = options.GetString("featureIndexCat");
00032 KernelMatrixLocator loc(mDevelSet->GetLocator(), true, "", "",
00033 mModel, mKernelMatrixName, "");
00034 loc.SetFeatureIndexCat(mFeatureIndexCat);
00035 loc.SetStartNode(0);
00036 loc.SetNodeCount(Link::Mpi::NrProcs());
00037 loc.SetDoParts(0);
00038 mDA = Persistency::DistributedAccessRepository().Get(loc);
00039 }
00040
00041 virtual
00042 ~ComputeKernelData()
00043 {
00044 delete mDA;
00045 delete mDevelSet;
00046 }
00047
00048 virtual void
00049 HandleNewWalk(ImageSet* is, String walkType)
00050 {
00051 mWalkType = walkType;
00052 }
00053
00054 virtual void
00055 HandleDoneDir(ImageSet* is, int dirId)
00056 {
00057 Training::PrecomputeTask::ComputeTestKernel
00058 (is->GetLocator(), mWalkType, is->GetContainer(dirId), mDevelSet,
00059 mDA, mFeatureIndexCat, mModel, mKernelMatrixName);
00060 }
00061
00062 private:
00063
00064 Database::RawDataSet* mDevelSet;
00065 String mWalkType;
00066 String mFeatureIndexCat;
00067 String mModel;
00068 String mKernelMatrixName;
00069 Matrix::DistributedAccess* mDA;
00070
00071 ILOG_VAR_DEC;
00072 };
00073
00074 ILOG_VAR_INIT(ComputeKernelData, Impala.Core.ImageSet);
00075
00076 }
00077 }
00078 }
00079
00080 #endif