MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / main

Function main

tensorflow/examples/multibox_detector/main.cc:331–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331int main(int argc, char* argv[]) {
332 // These are the command-line flags the program can understand.
333 // They define where the graph and input data is located, and what kind of
334 // input the model expects. If you train your own model, or use something
335 // other than multibox_model you'll need to update these.
336 string image =
337 "tensorflow/examples/multibox_detector/data/surfers.jpg";
338 string graph =
339 "tensorflow/examples/multibox_detector/data/"
340 "multibox_model.pb";
341 string box_priors =
342 "tensorflow/examples/multibox_detector/data/"
343 "multibox_location_priors.txt";
344 int32 input_width = 224;
345 int32 input_height = 224;
346 int32 input_mean = 128;
347 int32 input_std = 128;
348 int32 num_detections = 5;
349 int32 num_boxes = 784;
350 string input_layer = "ResizeBilinear";
351 string output_location_layer = "output_locations/Reshape";
352 string output_score_layer = "output_scores/Reshape";
353 string root_dir = "";
354 string image_out = "";
355
356 std::vector<Flag> flag_list = {
357 Flag("image", &image, "image to be processed"),
358 Flag("image_out", &image_out,
359 "location to save output image, if desired"),
360 Flag("graph", &graph, "graph to be executed"),
361 Flag("box_priors", &box_priors, "name of file containing box priors"),
362 Flag("input_width", &input_width, "resize image to this width in pixels"),
363 Flag("input_height", &input_height,
364 "resize image to this height in pixels"),
365 Flag("input_mean", &input_mean, "scale pixel values to this mean"),
366 Flag("input_std", &input_std, "scale pixel values to this std deviation"),
367 Flag("num_detections", &num_detections,
368 "number of top detections to return"),
369 Flag("num_boxes", &num_boxes,
370 "number of boxes defined by the location file"),
371 Flag("input_layer", &input_layer, "name of input layer"),
372 Flag("output_location_layer", &output_location_layer,
373 "name of location output layer"),
374 Flag("output_score_layer", &output_score_layer,
375 "name of score output layer"),
376 Flag("root_dir", &root_dir,
377 "interpret image and graph file names relative to this directory"),
378 };
379
380 string usage = tensorflow::Flags::Usage(argv[0], flag_list);
381 const bool parse_result = tensorflow::Flags::Parse(&argc, argv, flag_list);
382 if (!parse_result) {
383 LOG(ERROR) << usage;
384 return -1;
385 }
386
387 // We need to call this to set up global state for TensorFlow.
388 tensorflow::port::InitMain(argv[0], &argc, &argv);

Callers

nothing calls this directly

Calls 10

UsageFunction · 0.85
ParseFunction · 0.85
PrintTopDetectionsFunction · 0.85
LoadGraphFunction · 0.70
ReadTensorFromImageFileFunction · 0.70
FlagClass · 0.50
InitMainFunction · 0.50
JoinPathFunction · 0.50
okMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected