From 74a81c581c1f7218d00ca3d4d1a3d4ccf3f06860 Mon Sep 17 00:00:00 2001 From: dom607 Date: Thu, 2 Jul 2020 15:12:43 +0900 Subject: [PATCH] Add comment. --- .../util/counting_vector_size_calculator.h | 27 ++++++++++++------- .../examples/desktop/demo_run_graph_main.cc | 1 - .../face_landmark_front_cpu.pbtxt | 3 ++- .../face_landmark_front_gpu.pbtxt | 2 ++ 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/mediapipe/calculators/util/counting_vector_size_calculator.h b/mediapipe/calculators/util/counting_vector_size_calculator.h index 7b49750b4..f882b3296 100644 --- a/mediapipe/calculators/util/counting_vector_size_calculator.h +++ b/mediapipe/calculators/util/counting_vector_size_calculator.h @@ -20,19 +20,28 @@ namespace mediapipe { -// A calculator that count input landmarksList size. +// A calculator that counts the size of the input vector. It was created to +// aid in polling packets in the output stream synchronously. If there is +// a clock stream, it will output a value of 0 even if the input vector stream +// is empty. If not, it will output some value only if there is an input vector. +// The clock stream has the same time stamp as the input time stamp, and +// it must be a stream where packets must be transmitted during graph operation. +// (e.g. Any input stream of graph) // -// Count input landmark(std::vector) and return this -// value to ouput_stream. Input IMAGE has no effect on calculation, but is used to -// ensure that the calculator works even when the landmark is empty. And if the -// input landmark is empty, the number of faces found is zero. +// It is designed to be used like: // // Example config: // node { -// calculator: "CountingVectorSizeCalculator" -// input_stream: "IMAGE:input_image" -// input_stream: "LANDMARKS:multi_face_landmarks" -// output_stream: "COUNT:face_count" +// calculator: "CountingWithVectorSizeCalculator" +// input_stream: "CLOCK:triger_signal" +// input_stream: "VECTOR:input_vector" +// output_stream: "COUNT:vector_count" +// } +// +// node { +// calculator: "CountingWithVectorSizeCalculator" +// input_stream: "VECTOR:input_vector" +// output_stream: "COUNT:vector_count" // } template diff --git a/mediapipe/examples/desktop/demo_run_graph_main.cc b/mediapipe/examples/desktop/demo_run_graph_main.cc index 3176c393c..7d03172e6 100644 --- a/mediapipe/examples/desktop/demo_run_graph_main.cc +++ b/mediapipe/examples/desktop/demo_run_graph_main.cc @@ -27,7 +27,6 @@ #include "mediapipe/framework/port/parse_text_proto.h" #include "mediapipe/framework/port/status.h" - constexpr char kInputStream[] = "input_video"; constexpr char kOutputImageStream[] = "output_video"; constexpr char kOutputFaceCountStream[] = "face_count"; diff --git a/mediapipe/modules/face_landmark/face_landmark_front_cpu.pbtxt b/mediapipe/modules/face_landmark/face_landmark_front_cpu.pbtxt index 573737d52..815fa8ca6 100644 --- a/mediapipe/modules/face_landmark/face_landmark_front_cpu.pbtxt +++ b/mediapipe/modules/face_landmark/face_landmark_front_cpu.pbtxt @@ -191,6 +191,8 @@ node { output_stream: "ITERABLE:multi_face_landmarks" } +# Counting a multi_faceLandmarks vector size. The image stream is only used to +# make the calculator work even when there is no input vector. node { calculator: "CountingNormalizedLandmarkListVectorSizeCalculator" input_stream: "CLOCK:image" @@ -198,7 +200,6 @@ node { output_stream: "COUNT:face_count" } - # Collects a NormalizedRect for each face into a vector. Upon receiving the # BATCH_END timestamp, outputs the vector of NormalizedRect at the BATCH_END # timestamp. diff --git a/mediapipe/modules/face_landmark/face_landmark_front_gpu.pbtxt b/mediapipe/modules/face_landmark/face_landmark_front_gpu.pbtxt index dde7048e2..3426919d5 100644 --- a/mediapipe/modules/face_landmark/face_landmark_front_gpu.pbtxt +++ b/mediapipe/modules/face_landmark/face_landmark_front_gpu.pbtxt @@ -191,6 +191,8 @@ node { output_stream: "ITERABLE:multi_face_landmarks" } +# Counting a multi_faceLandmarks vector size. The image stream is only used to +# make the calculator work even when there is no input vector. node { calculator: "CountingNormalizedLandmarkListVectorSizeCalculator" input_stream: "CLOCK:image"