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