Project import generated by Copybara.
GitOrigin-RevId: 6a704ded0bf489614797082e7e7cda1068477ef5
This commit is contained in:
@@ -111,7 +111,7 @@ TEST(SignalFusingCalculatorTest, TwoInputNoTracking) {
|
||||
|
||||
auto input_face =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.5
|
||||
signal_type: { standard: FACE_FULL }
|
||||
@@ -120,14 +120,14 @@ TEST(SignalFusingCalculatorTest, TwoInputNoTracking) {
|
||||
score: 0.3
|
||||
signal_type: { standard: FACE_FULL }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(1).packets.push_back(
|
||||
Adopt(input_face.release()).At(Timestamp(0)));
|
||||
|
||||
auto input_ocr =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.3
|
||||
signal_type: { standard: TEXT }
|
||||
@@ -136,7 +136,7 @@ TEST(SignalFusingCalculatorTest, TwoInputNoTracking) {
|
||||
score: 0.9
|
||||
signal_type: { standard: TEXT }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(2).packets.push_back(
|
||||
Adopt(input_ocr.release()).At(Timestamp(0)));
|
||||
@@ -165,7 +165,7 @@ TEST(SignalFusingCalculatorTest, TwoInputShotLabeledTags) {
|
||||
|
||||
auto input_face =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.5
|
||||
signal_type: { standard: FACE_FULL }
|
||||
@@ -174,7 +174,7 @@ TEST(SignalFusingCalculatorTest, TwoInputShotLabeledTags) {
|
||||
score: 0.3
|
||||
signal_type: { standard: FACE_FULL }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()
|
||||
->Get("SIGNAL", 0)
|
||||
@@ -182,7 +182,7 @@ TEST(SignalFusingCalculatorTest, TwoInputShotLabeledTags) {
|
||||
|
||||
auto input_ocr =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.3
|
||||
signal_type: { standard: TEXT }
|
||||
@@ -191,7 +191,7 @@ TEST(SignalFusingCalculatorTest, TwoInputShotLabeledTags) {
|
||||
score: 0.9
|
||||
signal_type: { standard: TEXT }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()
|
||||
->Get("SIGNAL", 1)
|
||||
@@ -216,7 +216,7 @@ TEST(SignalFusingCalculatorTest, TwoInputNoShotLabeledTags) {
|
||||
|
||||
auto input_face =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.5
|
||||
signal_type: { standard: FACE_FULL }
|
||||
@@ -225,7 +225,7 @@ TEST(SignalFusingCalculatorTest, TwoInputNoShotLabeledTags) {
|
||||
score: 0.3
|
||||
signal_type: { standard: FACE_FULL }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()
|
||||
->Get("SIGNAL", 0)
|
||||
@@ -233,7 +233,7 @@ TEST(SignalFusingCalculatorTest, TwoInputNoShotLabeledTags) {
|
||||
|
||||
auto input_ocr =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.3
|
||||
signal_type: { standard: TEXT }
|
||||
@@ -242,7 +242,7 @@ TEST(SignalFusingCalculatorTest, TwoInputNoShotLabeledTags) {
|
||||
score: 0.9
|
||||
signal_type: { standard: TEXT }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()
|
||||
->Get("SIGNAL", 1)
|
||||
@@ -272,7 +272,7 @@ TEST(SignalFusingCalculatorTest, ThreeInputTracking) {
|
||||
// Time zero.
|
||||
auto input_face_0 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.2
|
||||
signal_type: { standard: FACE_FULL }
|
||||
@@ -287,32 +287,32 @@ TEST(SignalFusingCalculatorTest, ThreeInputTracking) {
|
||||
score: 0.1
|
||||
signal_type: { standard: FACE_FULL }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(1).packets.push_back(
|
||||
Adopt(input_face_0.release()).At(Timestamp(0)));
|
||||
|
||||
auto input_ocr_0 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.2
|
||||
signal_type: { custom: "text" }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(2).packets.push_back(
|
||||
Adopt(input_ocr_0.release()).At(Timestamp(0)));
|
||||
|
||||
auto input_agn_0 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.3
|
||||
signal_type: { standard: LOGO }
|
||||
tracking_id: 0
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(3).packets.push_back(
|
||||
Adopt(input_agn_0.release()).At(Timestamp(0)));
|
||||
@@ -324,7 +324,7 @@ TEST(SignalFusingCalculatorTest, ThreeInputTracking) {
|
||||
|
||||
auto input_face_1 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.7
|
||||
signal_type: { standard: FACE_FULL }
|
||||
@@ -339,32 +339,32 @@ TEST(SignalFusingCalculatorTest, ThreeInputTracking) {
|
||||
score: 0.2
|
||||
signal_type: { standard: FACE_FULL }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(1).packets.push_back(
|
||||
Adopt(input_face_1.release()).At(Timestamp(1)));
|
||||
|
||||
auto input_ocr_1 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.3
|
||||
signal_type: { custom: "text" }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(2).packets.push_back(
|
||||
Adopt(input_ocr_1.release()).At(Timestamp(1)));
|
||||
|
||||
auto input_agn_1 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.3
|
||||
signal_type: { standard: LOGO }
|
||||
tracking_id: 0
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(3).packets.push_back(
|
||||
Adopt(input_agn_1.release()).At(Timestamp(1)));
|
||||
@@ -376,7 +376,7 @@ TEST(SignalFusingCalculatorTest, ThreeInputTracking) {
|
||||
|
||||
auto input_face_2 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.8
|
||||
signal_type: { standard: FACE_FULL }
|
||||
@@ -391,32 +391,32 @@ TEST(SignalFusingCalculatorTest, ThreeInputTracking) {
|
||||
score: 0.3
|
||||
signal_type: { standard: FACE_FULL }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(1).packets.push_back(
|
||||
Adopt(input_face_2.release()).At(Timestamp(2)));
|
||||
|
||||
auto input_ocr_2 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.3
|
||||
signal_type: { custom: "text" }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(2).packets.push_back(
|
||||
Adopt(input_ocr_2.release()).At(Timestamp(2)));
|
||||
|
||||
auto input_agn_2 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.9
|
||||
signal_type: { standard: LOGO }
|
||||
tracking_id: 0
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(3).packets.push_back(
|
||||
Adopt(input_agn_2.release()).At(Timestamp(2)));
|
||||
@@ -428,7 +428,7 @@ TEST(SignalFusingCalculatorTest, ThreeInputTracking) {
|
||||
|
||||
auto input_face_3 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.2
|
||||
signal_type: { standard: FACE_FULL }
|
||||
@@ -443,32 +443,32 @@ TEST(SignalFusingCalculatorTest, ThreeInputTracking) {
|
||||
score: 0.4
|
||||
signal_type: { standard: FACE_FULL }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(1).packets.push_back(
|
||||
Adopt(input_face_3.release()).At(Timestamp(3)));
|
||||
|
||||
auto input_ocr_3 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.5
|
||||
signal_type: { custom: "text" }
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(2).packets.push_back(
|
||||
Adopt(input_ocr_3.release()).At(Timestamp(3)));
|
||||
|
||||
auto input_agn_3 =
|
||||
absl::make_unique<DetectionSet>(ParseTextProtoOrDie<DetectionSet>(
|
||||
R"(
|
||||
R"pb(
|
||||
detections {
|
||||
score: 0.6
|
||||
signal_type: { standard: LOGO }
|
||||
tracking_id: 0
|
||||
}
|
||||
)"));
|
||||
)pb"));
|
||||
|
||||
runner->MutableInputs()->Index(3).packets.push_back(
|
||||
Adopt(input_agn_3.release()).At(Timestamp(3)));
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace {
|
||||
TEST(VisualScorerTest, ScoresArea) {
|
||||
cv::Mat image_mat(200, 200, CV_8UC3);
|
||||
SalientRegion region = ParseTextProtoOrDie<SalientRegion>(
|
||||
R"(location { x: 10 y: 10 width: 100 height: 100 })");
|
||||
R"pb(location { x: 10 y: 10 width: 100 height: 100 })pb");
|
||||
|
||||
VisualScorerOptions options = ParseTextProtoOrDie<VisualScorerOptions>(
|
||||
R"(area_weight: 1.0 sharpness_weight: 0 colorfulness_weight: 0)");
|
||||
R"pb(area_weight: 1.0 sharpness_weight: 0 colorfulness_weight: 0)pb");
|
||||
VisualScorer scorer(options);
|
||||
float score = 0.0;
|
||||
MP_EXPECT_OK(scorer.CalculateScore(image_mat, region, &score));
|
||||
@@ -39,10 +39,10 @@ TEST(VisualScorerTest, ScoresArea) {
|
||||
|
||||
TEST(VisualScorerTest, ScoresSharpness) {
|
||||
SalientRegion region = ParseTextProtoOrDie<SalientRegion>(
|
||||
R"(location { x: 10 y: 10 width: 100 height: 100 })");
|
||||
R"pb(location { x: 10 y: 10 width: 100 height: 100 })pb");
|
||||
|
||||
VisualScorerOptions options = ParseTextProtoOrDie<VisualScorerOptions>(
|
||||
R"(area_weight: 0 sharpness_weight: 1.0 colorfulness_weight: 0)");
|
||||
R"pb(area_weight: 0 sharpness_weight: 1.0 colorfulness_weight: 0)pb");
|
||||
VisualScorer scorer(options);
|
||||
|
||||
// Compute the score of an empty image and an image with a rectangle.
|
||||
@@ -55,10 +55,10 @@ TEST(VisualScorerTest, ScoresSharpness) {
|
||||
|
||||
TEST(VisualScorerTest, ScoresColorfulness) {
|
||||
SalientRegion region = ParseTextProtoOrDie<SalientRegion>(
|
||||
R"(location { x: 10 y: 10 width: 50 height: 150 })");
|
||||
R"pb(location { x: 10 y: 10 width: 50 height: 150 })pb");
|
||||
|
||||
VisualScorerOptions options = ParseTextProtoOrDie<VisualScorerOptions>(
|
||||
R"(area_weight: 0 sharpness_weight: 0 colorfulness_weight: 1.0)");
|
||||
R"pb(area_weight: 0 sharpness_weight: 0 colorfulness_weight: 1.0)pb");
|
||||
VisualScorer scorer(options);
|
||||
|
||||
// Compute the scores of images with 1, 2 and 3 colors.
|
||||
|
||||
@@ -23,20 +23,21 @@ namespace mediapipe {
|
||||
|
||||
absl::Status PrintHelloWorld() {
|
||||
// Configures a simple graph, which concatenates 2 PassThroughCalculators.
|
||||
CalculatorGraphConfig config = ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
|
||||
input_stream: "in"
|
||||
output_stream: "out"
|
||||
node {
|
||||
calculator: "PassThroughCalculator"
|
||||
input_stream: "in"
|
||||
output_stream: "out1"
|
||||
}
|
||||
node {
|
||||
calculator: "PassThroughCalculator"
|
||||
input_stream: "out1"
|
||||
output_stream: "out"
|
||||
}
|
||||
)");
|
||||
CalculatorGraphConfig config =
|
||||
ParseTextProtoOrDie<CalculatorGraphConfig>(R"pb(
|
||||
input_stream: "in"
|
||||
output_stream: "out"
|
||||
node {
|
||||
calculator: "PassThroughCalculator"
|
||||
input_stream: "in"
|
||||
output_stream: "out1"
|
||||
}
|
||||
node {
|
||||
calculator: "PassThroughCalculator"
|
||||
input_stream: "out1"
|
||||
output_stream: "out"
|
||||
}
|
||||
)pb");
|
||||
|
||||
CalculatorGraph graph;
|
||||
MP_RETURN_IF_ERROR(graph.Initialize(config));
|
||||
|
||||
Reference in New Issue
Block a user