00001 #include "Basis/CmdOptions.h"
00002 #include "Core/Training/Tester.h"
00003 #include "Core/VideoSet/MakeVideoSet.h"
00004
00005
00006 #include "Link/Svm/LinkSvm.cpp"
00007
00008 namespace Impala
00009 {
00010 namespace Application
00011 {
00012
00013 const String cSetName("test.txt");
00020 Core::VideoSet::VideoSet* MakeVideoSet(String directory,
00021 Core::VideoSet::VideoSet* indexSrc)
00022 {
00023 Util::Database* db = new Util::Database;
00024 db->SetDataPath(directory);
00025 Core::VideoSet::VideoSet* ret;
00026 if(indexSrc)
00027 {
00028 ret = new Core::VideoSet::VideoSet(db, cSetName, false);
00029 ret->CopyIndex(indexSrc);
00030 }
00031 else
00032 ret = new Core::VideoSet::VideoSet(db, cSetName, true);
00033 return ret;
00034 }
00035
00036 Core::VideoSet::VideoSet* MakeVideoSet(String directory)
00037 {
00038
00039 return MakeVideoSet(directory, 0);
00040 }
00041
00042 int
00043 main(int argc, char** argv)
00044 {
00045 CmdOptions& options = CmdOptions::GetInstance();
00046 options.Initialise(false, false, true);
00047 options.AddOption(0, "create-reference", "", "");
00048 String usage = String() + "inputpath referencepath outputpath\n" +
00049 "All arguments are paths to a videoset (only videosets for now). " +
00050 "Please note that reference- and outputset don't have to be proper " +
00051 "sets. Their index is not read but taken from inputset instead. " +
00052 "The paths do not necessarily have to be distinct. In order to create "+
00053 "the reference set, pass the same path as 2nd and 3rd argument.\n" +
00054 "In the inputset the following should be present:\n" +
00055 " 1. \"VideoSet/test.txt\"\n"+
00056 " 2. \"Annotation/test.txt\"\n"+
00057 " 3. vissem_proto_annotation_nrScales_2_nrRects_130 feature data for" +
00058 " the videos defined in 1.\n";
00059 if (!options.ParseArgs(argc, argv, usage, 3))
00060 return 1;
00061
00062 Core::VideoSet::VideoSet* input = MakeVideoSet(options.GetArg(0));
00063 Core::VideoSet::VideoSet* reference = MakeVideoSet(options.GetArg(1), input);
00064 Core::VideoSet::VideoSet* output = MakeVideoSet(options.GetArg(2), input);
00065 Core::Feature::FeatureDefinition feat
00066 ("vissem_proto_annotation_nrScales_2_nrRects_130");
00067 Core::DataFactory* factory =
00068 new Core::DataFactory(input, input->GetDatabase(), QUID_CLASS_FRAME,
00069 "test.txt", "test", feat, "testsingle", 0, 1);
00070 if(Link::Mpi::MyId() == 0)
00071 {
00072 Core::Training::Tester tester(factory, reference, output);
00073 if(Link::Mpi::NrProcs() > 1)
00074 tester.TestMpi();
00075 else
00076 tester.Test();
00077 }
00078 else
00079 factory->ServeDistributedAccess();
00080
00081 delete factory;
00082 delete output;
00083 delete reference;
00084 delete input;
00085 return 0;
00086 }
00087
00088 }
00089 }
00090
00091 int
00092 main(int argc, char* argv[])
00093 {
00094 Impala::Link::Mpi::Init(&argc,&argv);
00095 int ret = Impala::Application::main(argc, argv);
00096 Impala::Link::Mpi::Finalize();
00097 return ret;
00098 }