makes rankMutations return a value
Class state-machine isn't working very well
This commit is contained in:
@@ -162,24 +162,23 @@ void DescriptorManager::rankImages(string image_name, int method) {
|
|||||||
//Adds mutated descriptors of a given image to a copy of the distances array.
|
//Adds mutated descriptors of a given image to a copy of the distances array.
|
||||||
//It inserts these mutated descriptors in a sorted way
|
//It inserts these mutated descriptors in a sorted way
|
||||||
//Assumes the distances array is filled with the normal distances
|
//Assumes the distances array is filled with the normal distances
|
||||||
void DescriptorManager::rankMutations(string image_name, int method) {
|
multiset<pair<unsigned long long, string>> DescriptorManager::rankMutations(string image_name, int method) {
|
||||||
bitset<64> target;
|
bitset<64> target;
|
||||||
if (features[method].count(image_name) && initialized) { //if we have image
|
if (features[method].count(image_name) && initialized) { //this should always be the case
|
||||||
target = features[method][image_name];
|
target = features[method][image_name];
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//cout << "Finding hits for " << image_name << " which has feature-number " << target.to_ullong() << endl;
|
//cout << "Finding hits for " << image_name << " which has feature-number " << target.to_ullong() << endl;
|
||||||
multiset<pair<unsigned long long, string> > local_distance = distances; //get our local copy of the distances.
|
multiset<pair<unsigned long long, string>> local_distance = distances; //get our local copy of the distances.
|
||||||
for (int i = 0; i < numMutations; i++) {
|
for (int i = 0; i < numMutations; i++) {
|
||||||
bitset<64> b1 = mutatedFeatures[method][i][image_name];
|
bitset<64> b1 = mutatedFeatures[method][i][image_name];
|
||||||
unsigned long long d = descriptor_types[method]->distance(target, b1);
|
unsigned long long d = descriptor_types[method]->distance(target, b1);
|
||||||
pair<unsigned long long, string> p(d, mutators[i]->ToString());
|
pair<unsigned long long, string> p(d, mutators[i]->ToString());
|
||||||
local_distance.insert(p);
|
local_distance.insert(p);
|
||||||
upper_bound
|
//upper_bound
|
||||||
}
|
}
|
||||||
|
return local_distance;
|
||||||
|
/*
|
||||||
//cout << "..." << endl;
|
//cout << "..." << endl;
|
||||||
for (int i = 0; i < numMutations; i++) {
|
for (int i = 0; i < numMutations; i++) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
@@ -191,7 +190,7 @@ void DescriptorManager::rankMutations(string image_name, int method) {
|
|||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//Needs to be called after Init().
|
//Needs to be called after Init().
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ public:
|
|||||||
~DescriptorManager();
|
~DescriptorManager();
|
||||||
void Init();
|
void Init();
|
||||||
void rankImages(string image_name, int method);
|
void rankImages(string image_name, int method);
|
||||||
void rankMutations(string image_name, int method);
|
multiset<pair<unsigned long long, string>> rankMutations(string image_name, int method);
|
||||||
void runExperiments();
|
void runExperiments();
|
||||||
void outputMap(int a);
|
void outputMap(int a);
|
||||||
void outputMap();
|
void outputMap();
|
||||||
|
|||||||
Reference in New Issue
Block a user