Process results into files
This commit is contained in:
+25
-2
@@ -196,11 +196,34 @@ multiset<pair<unsigned long long, string>> DescriptorManager::rankMutations(stri
|
||||
//Needs to be called after Init().
|
||||
//Takes all the calculated features and rankes
|
||||
void DescriptorManager::runExperiments() {
|
||||
fs::ofstream ofs;
|
||||
for (int i = 0; i < numDescriptors; i++) {
|
||||
for (map<string, bitset<64>>::iterator it = features[i].begin(); it != features[i].end(); ++it) {
|
||||
cout << "=== " << descriptor_types[i]->ToString() << ": " << it->first << " ===" << endl;
|
||||
//cout << "=== " << descriptor_types[i]->ToString() << ": " << it->first << " ===" << endl;
|
||||
rankImages(it->first, i);
|
||||
rankMutations(it->first, i);
|
||||
multiset<pair<unsigned long long, string>> local_distance = rankMutations(it->first, i);
|
||||
|
||||
//Now we can draw some conclusions from the received data:
|
||||
//Put all results in some useful files in the results directory:
|
||||
fs::path resultFolder("results" / descriptor_types[i]->ToPath());
|
||||
if (!fs::is_directory(resultFolder)) //TODO: Create all folders in Init()
|
||||
fs::create_directory(resultFolder);
|
||||
for (int i = 0; i < numMutations; i++) {
|
||||
int j = 0;
|
||||
fs::path resultPath(resultFolder / mutators[i]->ToPath());
|
||||
ofs.open(resultPath, ofstream::out | ofstream::app);
|
||||
for (std::multiset<pair<unsigned long long, string>>::iterator it = local_distance.begin(); it != local_distance.end(); ++it) {
|
||||
if (it->second == mutators[i]->ToString()) {
|
||||
double percentile = (j + 1) / (double)(numImages+numMutations);
|
||||
|
||||
ofs << (int)(percentile*100) << endl;
|
||||
//cout << "(" << it->first << ", " << it->second << ")" << endl;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
ofs.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user