-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
67 lines (57 loc) · 2.71 KB
/
Copy pathmain.cpp
File metadata and controls
67 lines (57 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "functions.h"
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
int main() {
// Object folders (update paths if needed)
std::vector<std::string> object_folders = {
"004_sugar_box",
"006_mustard_bottle",
"035_power_drill"
};
// Best configuration tracking
double best_miou = 0.0;
std::tuple<int, float, int, int, int> best_params; // nfeatures, scaleFactor, nlevels, edgeThreshold, fastThreshold
// Search space
std::vector<int> nfeatures_list = {500, 750, 1000, 1250, 1500};
std::vector<float> scaleFactors = {1.1f, 1.2f, 1.3f, 1.4f};
std::vector<int> nlevels_list = {6, 8, 10};
std::vector<int> edgeThresholds = {15, 20, 31};
std::vector<int> fastThresholds = {10, 20, 30};
for (int nfeatures : nfeatures_list) {
for (float scaleFactor : scaleFactors) {
for (int nlevels : nlevels_list) {
for (int edgeThreshold : edgeThresholds) {
for (int fastThreshold : fastThresholds) {
std::cout << "\nTesting configuration: "
<< "nfeatures=" << nfeatures
<< ", scaleFactor=" << scaleFactor
<< ", nlevels=" << nlevels
<< ", edgeThreshold=" << edgeThreshold
<< ", fastThreshold=" << fastThreshold
<< std::endl;
// Call the modified process_all_orb() with these parameters
double miou = process_all_orb(object_folders, nfeatures, scaleFactor, nlevels, edgeThreshold, fastThreshold);
std::cout << " --> Resulting MIoU: " << miou << std::endl;
// Update best if needed
if (miou > best_miou) {
best_miou = miou;
best_params = {nfeatures, scaleFactor, nlevels, edgeThreshold, fastThreshold};
}
}
}
}
}
}
// Print best result
auto [best_nfeatures, best_scaleFactor, best_nlevels, best_edgeThreshold, best_fastThreshold] = best_params;
std::cout << "\nBest configuration found:" << std::endl;
std::cout << "nfeatures = " << best_nfeatures << std::endl;
std::cout << "scaleFactor = " << best_scaleFactor << std::endl;
std::cout << "nlevels = " << best_nlevels << std::endl;
std::cout << "edgeThreshold = " << best_edgeThreshold << std::endl;
std::cout << "fastThreshold = " << best_fastThreshold << std::endl;
std::cout << "Achieved Mean IoU (MIoU): " << best_miou << std::endl;
return 0;
}