Project import generated by Copybara.

PiperOrigin-RevId: 267274408
This commit is contained in:
MediaPipe Team
2019-09-04 19:00:29 -07:00
committed by jqtang
parent 731d2b9536
commit af67642055
80 changed files with 3181 additions and 0 deletions
+8
View File
@@ -139,7 +139,11 @@ mediapipe_cc_proto_library(
":stream_handler_cc_proto",
"@com_google_protobuf//:cc_wkt_protos",
],
<<<<<<< HEAD
visibility = ["//mediapipe:__subpackages__"],
=======
visibility = ["//visibility:public"],
>>>>>>> Project import generated by Copybara.
deps = [":calculator_proto"],
)
@@ -155,7 +159,11 @@ mediapipe_cc_proto_library(
mediapipe_cc_proto_library(
name = "calculator_options_cc_proto",
srcs = ["calculator_options.proto"],
<<<<<<< HEAD
visibility = ["//mediapipe:__subpackages__"],
=======
visibility = ["//visibility:public"],
>>>>>>> Project import generated by Copybara.
deps = [":calculator_options_proto"],
)
+19
View File
@@ -32,6 +32,15 @@ proto_library(
)
proto_library(
<<<<<<< HEAD
=======
name = "classification_proto",
srcs = ["classification.proto"],
visibility = ["//mediapipe:__subpackages__"],
)
proto_library(
>>>>>>> Project import generated by Copybara.
name = "image_format_proto",
srcs = ["image_format.proto"],
visibility = ["//mediapipe:__subpackages__"],
@@ -64,6 +73,16 @@ mediapipe_cc_proto_library(
)
mediapipe_cc_proto_library(
<<<<<<< HEAD
=======
name = "classification_cc_proto",
srcs = ["classification.proto"],
visibility = ["//mediapipe:__subpackages__"],
deps = [":classification_proto"],
)
mediapipe_cc_proto_library(
>>>>>>> Project import generated by Copybara.
name = "image_format_cc_proto",
srcs = ["image_format.proto"],
visibility = [
@@ -0,0 +1,35 @@
// Copyright 2019 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// A protocol buffer encoding one or several classifications in an image. A
// classification is defined by label and corresponding score, representing the
// classifier confidence for the label.
syntax = "proto2";
package mediapipe;
message Classification {
// The index of the class in the corresponding label map.
optional int32 index = 1;
// The probability score for this class.
optional float score = 2;
// Label or name of the class.
optional string label = 3;
}
// Group of Classification protos.
message ClassificationList {
repeated Classification classification = 1;
}
@@ -32,7 +32,11 @@ namespace mediapipe {
namespace {
// Shows validation success for a graph and a subgraph.
<<<<<<< HEAD
TEST(ValidatedGraphConfigTest, InitilizeGraphFromProtos) {
=======
TEST(ValidatedGraphConfigTest, InitializeGraphFromProtos) {
>>>>>>> Project import generated by Copybara.
auto config_1 = ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
type: "PassThroughGraph"
input_stream: "INPUT:stream_1"
@@ -102,7 +106,11 @@ TEST(ValidatedGraphConfigTest, InitilizeGraphFromProtos) {
}
// Shows validation failure due to an unregistered subgraph.
<<<<<<< HEAD
TEST(ValidatedGraphConfigTest, InitilizeGraphFromLinker) {
=======
TEST(ValidatedGraphConfigTest, InitializeGraphFromLinker) {
>>>>>>> Project import generated by Copybara.
EXPECT_FALSE(SubgraphRegistry::IsRegistered("DubQuadTestSubgraph"));
ValidatedGraphConfig builder_1;
::mediapipe::Status status_1 =
@@ -114,7 +122,11 @@ TEST(ValidatedGraphConfigTest, InitilizeGraphFromLinker) {
}
// Shows validation success for a graph and a template subgraph.
<<<<<<< HEAD
TEST(ValidatedGraphConfigTest, InitilizeTemplateFromProtos) {
=======
TEST(ValidatedGraphConfigTest, InitializeTemplateFromProtos) {
>>>>>>> Project import generated by Copybara.
mediapipe::tool::TemplateParser::Parser parser;
CalculatorGraphTemplate config_1;
CHECK(parser.ParseFromString(R"(
@@ -520,7 +520,11 @@ class OstreamStream : public proto_ns::io::ZeroCopyOutputStream {
return WriteBuffer();
}
void BackUp(int count) override { buffer_used_ -= count; }
<<<<<<< HEAD
proto_int64 ByteCount() const override { return position_; }
=======
int64_t ByteCount() const override { return position_; }
>>>>>>> Project import generated by Copybara.
private:
// Writes the buffer to the ostream.
@@ -108,10 +108,25 @@ class FixedSizeInputStreamHandler : public DefaultInputStreamHandler {
}
// Returns the lowest timestamp of a packet ready to process.
<<<<<<< HEAD
Timestamp MinTimestampOrBound() {
Timestamp min_bound = Timestamp::Done();
for (const auto& stream : input_stream_managers_) {
min_bound = std::min(min_bound, stream->MinTimestampOrBound(nullptr));
=======
Timestamp MinTimestampToProcess() {
Timestamp min_bound = Timestamp::Done();
for (const auto& stream : input_stream_managers_) {
bool empty;
Timestamp stream_timestamp = stream->MinTimestampOrBound(&empty);
// If we're using the stream's *bound*, we only want to process up to the
// packet *before* the bound, because a packet may still arrive at that
// time.
if (empty) {
stream_timestamp = PreviousAllowedInStream(stream_timestamp);
}
min_bound = std::min(min_bound, stream_timestamp);
>>>>>>> Project import generated by Copybara.
}
return min_bound;
}
@@ -199,7 +214,11 @@ class FixedSizeInputStreamHandler : public DefaultInputStreamHandler {
}
// input_timestamp is recalculated here to process the most recent packets.
EraseSurplusPackets(true);
<<<<<<< HEAD
input_timestamp = MinTimestampOrBound();
=======
input_timestamp = MinTimestampToProcess();
>>>>>>> Project import generated by Copybara.
DefaultInputStreamHandler::FillInputSet(input_timestamp, input_set);
pending_ = false;
}