Commit 694a3826d0d03713b2070c40431f8ecf3d0b3663

Authored by Josh Klontz
1 parent 3fdc911d

introduced BR_DISABLE_ALGORITHMS to ship a limited version of br command line

app/CMakeLists.txt
1 # Build the command line interface 1 # Build the command line interface
  2 +add_subdirectory(br)
  3 +
2 if(NOT BR_PACKAGE_THIRDPARTY) 4 if(NOT BR_PACKAGE_THIRDPARTY)
3 if(NOT BR_EMBEDDED) 5 if(NOT BR_EMBEDDED)
4 - add_subdirectory(br)  
5 -  
6 # Build examples/tests 6 # Build examples/tests
7 add_subdirectory(examples) 7 add_subdirectory(examples)
8 8
app/br/CMakeLists.txt
@@ -2,6 +2,10 @@ if(UNIX) @@ -2,6 +2,10 @@ if(UNIX)
2 find_package(Threads REQUIRED) 2 find_package(Threads REQUIRED)
3 endif() 3 endif()
4 4
  5 +if(BR_DISABLE_ALGORITHMS)
  6 + add_definitions(-DBR_DISABLE_ALGORITHMS)
  7 +endif()
  8 +
5 add_executable(br br.cpp ${BR_RESOURCES}) 9 add_executable(br br.cpp ${BR_RESOURCES})
6 target_link_libraries(br openbr ${CMAKE_THREAD_LIBS_INIT}) 10 target_link_libraries(br openbr ${CMAKE_THREAD_LIBS_INIT})
7 qt5_use_modules(br ${QT_DEPENDENCIES}) 11 qt5_use_modules(br ${QT_DEPENDENCIES})
app/br/br.cpp
@@ -90,6 +90,7 @@ public: @@ -90,6 +90,7 @@ public:
90 argv = &argv[parc+1]; 90 argv = &argv[parc+1];
91 91
92 // Core Tasks 92 // Core Tasks
  93 +#ifndef BR_DISABLE_ALGORITHMS
93 if (!strcmp(fun, "train")) { 94 if (!strcmp(fun, "train")) {
94 check(parc >= 1, "Insufficient parameter count for 'train'."); 95 check(parc >= 1, "Insufficient parameter count for 'train'.");
95 br_train_n(parc == 1 ? 1 : parc-1, parv, parc == 1 ? "" : parv[parc-1]); 96 br_train_n(parc == 1 ? 1 : parc-1, parv, parc == 1 ? "" : parv[parc-1]);
@@ -100,7 +101,9 @@ public: @@ -100,7 +101,9 @@ public:
100 } else if (!strcmp(fun, "compare")) { 101 } else if (!strcmp(fun, "compare")) {
101 check((parc >= 2) && (parc <= 3), "Incorrect parameter count for 'compare'."); 102 check((parc >= 2) && (parc <= 3), "Incorrect parameter count for 'compare'.");
102 br_compare(parv[0], parv[1], parc == 3 ? parv[2] : ""); 103 br_compare(parv[0], parv[1], parc == 3 ? parv[2] : "");
103 - } else if (!strcmp(fun, "eval")) { 104 + } else
  105 +#endif // !BR_DISABLE_ALGORITHMS
  106 + if (!strcmp(fun, "eval")) {
104 check((parc >= 1) && (parc <= 4), "Incorrect parameter count for 'eval'."); 107 check((parc >= 1) && (parc <= 4), "Incorrect parameter count for 'eval'.");
105 if (parc == 1) { 108 if (parc == 1) {
106 br_eval(parv[0], "", "", 0); 109 br_eval(parv[0], "", "", 0);
@@ -192,7 +195,9 @@ public: @@ -192,7 +195,9 @@ public:
192 } else if (!strcmp(fun, "plotKNN")) { 195 } else if (!strcmp(fun, "plotKNN")) {
193 check(parc >=2, "Incorrect parameter count for 'plotKNN'."); 196 check(parc >=2, "Incorrect parameter count for 'plotKNN'.");
194 br_plot_knn(parc-1, parv, parv[parc-1], true); 197 br_plot_knn(parc-1, parv, parv[parc-1], true);
195 - } else if (!strcmp(fun, "project")) { 198 + }
  199 +#ifndef BR_DISABLE_ALGORITHMS
  200 + else if (!strcmp(fun, "project")) {
196 check(parc == 2, "Insufficient parameter count for 'project'."); 201 check(parc == 2, "Insufficient parameter count for 'project'.");
197 br_project(parv[0], parv[1]); 202 br_project(parv[0], parv[1]);
198 } else if (!strcmp(fun, "deduplicate")) { 203 } else if (!strcmp(fun, "deduplicate")) {
@@ -202,6 +207,7 @@ public: @@ -202,6 +207,7 @@ public:
202 check(parc == 3, "Incorrect parameter count for 'likely'."); 207 check(parc == 3, "Incorrect parameter count for 'likely'.");
203 br_likely(parv[0], parv[1], parv[2]); 208 br_likely(parv[0], parv[1], parv[2]);
204 } 209 }
  210 +#endif // !BR_DISABLE_ALGORITHMS
205 211
206 // Miscellaneous 212 // Miscellaneous
207 else if (!strcmp(fun, "help")) { 213 else if (!strcmp(fun, "help")) {
@@ -271,9 +277,11 @@ private: @@ -271,9 +277,11 @@ private:
271 printf("<arg> = Input; {arg} = Output; [arg] = Optional; (arg0|...|argN) = Choice\n" 277 printf("<arg> = Input; {arg} = Output; [arg] = Optional; (arg0|...|argN) = Choice\n"
272 "\n" 278 "\n"
273 "==== Core Commands ====\n" 279 "==== Core Commands ====\n"
  280 +#ifndef BR_DISABLE_ALGORITHMS
274 "-train <gallery> ... <gallery> [{model}]\n" 281 "-train <gallery> ... <gallery> [{model}]\n"
275 "-enroll <input_gallery> ... <input_gallery> {output_gallery}\n" 282 "-enroll <input_gallery> ... <input_gallery> {output_gallery}\n"
276 "-compare <target_gallery> <query_gallery> [{output}]\n" 283 "-compare <target_gallery> <query_gallery> [{output}]\n"
  284 +#endif // !BR_DISABLE_ALGORITHMS
277 "-eval <simmat> [<mask>] [{csv}] [{matches}]\n" 285 "-eval <simmat> [<mask>] [{csv}] [{matches}]\n"
278 "-plot <csv> ... <csv> {destination}\n" 286 "-plot <csv> ... <csv> {destination}\n"
279 "\n" 287 "\n"
@@ -298,9 +306,11 @@ private: @@ -298,9 +306,11 @@ private:
298 "-plotLandmarking <file> ... <file> {destination}\n" 306 "-plotLandmarking <file> ... <file> {destination}\n"
299 "-plotMetadata <file> ... <file> <columns>\n" 307 "-plotMetadata <file> ... <file> <columns>\n"
300 "-plotKNN <file> ... <file> {destination}\n" 308 "-plotKNN <file> ... <file> {destination}\n"
  309 +#ifndef BR_DISABLE_ALGORITHMS
301 "-project <input_gallery> {output_gallery}\n" 310 "-project <input_gallery> {output_gallery}\n"
302 "-deduplicate <input_gallery> <output_gallery> <threshold>\n" 311 "-deduplicate <input_gallery> <output_gallery> <threshold>\n"
303 "-likely <input_type> <output_type> <output_likely_source>\n" 312 "-likely <input_type> <output_type> <output_likely_source>\n"
  313 +#endif // !BR_DISABLE_ALGORITHMS
304 "-getHeader <matrix>\n" 314 "-getHeader <matrix>\n"
305 "-setHeader {<matrix>} <target_gallery> <query_gallery>\n" 315 "-setHeader {<matrix>} <target_gallery> <query_gallery>\n"
306 "-<key> <value>\n" 316 "-<key> <value>\n"