int main( void ) { int i; if( ( i = testInt( ) ) ) return i; if( ( i = testStr( ) ) ) return i; if( ( i = testParse( ) ) ) return i; if( ( i = testJSON( ) ) ) return i; #ifndef WIN32 i = testStackSmash( 1000000 ); #else i = testStackSmash( 100000 ); #endif if( i ) return i; return 0; }
void TR_charsImp::loadDatasetSplit(const string &path, int number) { train.push_back(vector< Ptr<Object> >()); test.push_back(vector< Ptr<Object> >()); validation.push_back(vector< Ptr<Object> >()); vector<int> allLabels, trainSet, testSet, validationSet; vector<string> allNames; ifstream infile((path + "list_English_Img.m").c_str()); string line; bool labels = false, names = false, isTrain = false, isTest = false, isValidation = false; while (getline(infile, line)) { size_t pos = line.find("];"); if (string::npos != pos) { labels = false; names = false; isTrain = false; isTest = false; isValidation = false; } string slabels("list.ALLlabels = ["); pos = line.find(slabels); if (string::npos != pos) { labels = true; string s(line.substr(pos+slabels.length())); allLabels.push_back(atoi(s.c_str())); } else if (labels) { allLabels.push_back(atoi(line.c_str())); } string snames("list.ALLnames = ["); pos = line.find(snames); if (string::npos != pos) { names = true; size_t start = pos+snames.length(); string s(line.substr(start+1, line.length()-start-2)); allNames.push_back(s); } else if (names) { string s(line.substr(1, line.length()-2)); allNames.push_back(s); } string trainStr("list.TRNind = ["); parseSet(line, trainStr, isTrain, trainSet, number); string testStr("list.TSTind = ["); parseSet(line, testStr, isTest, testSet, number); string validationStr("list.VALind = ["); parseSet(line, validationStr, isValidation, validationSet, number); /*"list.classlabels = [" "list.classnames = [" "list.NUMclasses = 62;" "list.TXNind = ["*/ } convert(trainSet, train.back(), allLabels, allNames); convert(testSet, test.back(), allLabels, allNames); convert(validationSet, validation.back(), allLabels, allNames); }