Use ABSL_LOG in MediaPipe.

This is needed in Chrome builds to avoid collisions with its own LOG.

PiperOrigin-RevId: 561436864
This commit is contained in:
MediaPipe Team 2023-08-30 13:41:21 -07:00 committed by Copybara-Service
parent f60da2120d
commit c92570f844
243 changed files with 1396 additions and 1087 deletions

View File

@ -50,7 +50,7 @@ as the primary developer documentation site for MediaPipe as of April 3, 2023.*
3. The [`hello world`] example uses a simple MediaPipe graph in the 3. The [`hello world`] example uses a simple MediaPipe graph in the
`PrintHelloWorld()` function, defined in a [`CalculatorGraphConfig`] proto. `PrintHelloWorld()` function, defined in a [`CalculatorGraphConfig`] proto.
```C++ ```c++
absl::Status PrintHelloWorld() { absl::Status PrintHelloWorld() {
// Configures a simple graph, which concatenates 2 PassThroughCalculators. // Configures a simple graph, which concatenates 2 PassThroughCalculators.
CalculatorGraphConfig config = ParseTextProtoOrDie<CalculatorGraphConfig>(R"( CalculatorGraphConfig config = ParseTextProtoOrDie<CalculatorGraphConfig>(R"(
@ -126,7 +126,7 @@ as the primary developer documentation site for MediaPipe as of April 3, 2023.*
```c++ ```c++
mediapipe::Packet packet; mediapipe::Packet packet;
while (poller.Next(&packet)) { while (poller.Next(&packet)) {
LOG(INFO) << packet.Get<string>(); ABSL_LOG(INFO) << packet.Get<string>();
} }
``` ```

View File

@ -164,8 +164,8 @@ cc_library(
"//mediapipe/framework/formats:matrix", "//mediapipe/framework/formats:matrix",
"//mediapipe/framework/formats:time_series_header_cc_proto", "//mediapipe/framework/formats:time_series_header_cc_proto",
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging",
"//mediapipe/util:time_series_util", "//mediapipe/util:time_series_util",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_audio_tools//audio/dsp:resampler", "@com_google_audio_tools//audio/dsp:resampler",
"@com_google_audio_tools//audio/dsp:resampler_q", "@com_google_audio_tools//audio/dsp:resampler_q",
@ -295,6 +295,7 @@ cc_test(
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/util:time_series_test_util", "//mediapipe/util:time_series_test_util",
"@com_google_absl//absl/log:absl_log",
"@com_google_audio_tools//audio/dsp:number_util", "@com_google_audio_tools//audio/dsp:number_util",
"@eigen_archive//:eigen3", "@eigen_archive//:eigen3",
], ],
@ -346,6 +347,7 @@ cc_test(
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/util:time_series_test_util", "//mediapipe/util:time_series_test_util",
"@com_google_absl//absl/log:absl_log",
"@com_google_audio_tools//audio/dsp:window_functions", "@com_google_audio_tools//audio/dsp:window_functions",
"@eigen_archive//:eigen3", "@eigen_archive//:eigen3",
], ],

View File

@ -16,6 +16,7 @@
#include "mediapipe/calculators/audio/rational_factor_resample_calculator.h" #include "mediapipe/calculators/audio/rational_factor_resample_calculator.h"
#include "absl/log/absl_log.h"
#include "audio/dsp/resampler_q.h" #include "audio/dsp/resampler_q.h"
using audio_dsp::Resampler; using audio_dsp::Resampler;
@ -77,7 +78,7 @@ absl::Status RationalFactorResampleCalculator::Open(CalculatorContext* cc) {
r = ResamplerFromOptions(source_sample_rate_, target_sample_rate_, r = ResamplerFromOptions(source_sample_rate_, target_sample_rate_,
resample_options); resample_options);
if (!r) { if (!r) {
LOG(ERROR) << "Failed to initialize resampler."; ABSL_LOG(ERROR) << "Failed to initialize resampler.";
return absl::UnknownError("Failed to initialize resampler."); return absl::UnknownError("Failed to initialize resampler.");
} }
} }

View File

@ -27,7 +27,6 @@
#include "mediapipe/framework/formats/matrix.h" #include "mediapipe/framework/formats/matrix.h"
#include "mediapipe/framework/formats/time_series_header.pb.h" #include "mediapipe/framework/formats/time_series_header.pb.h"
#include "mediapipe/framework/port/integral_types.h" #include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/util/time_series_util.h" #include "mediapipe/util/time_series_util.h"
namespace mediapipe { namespace mediapipe {

View File

@ -22,6 +22,7 @@
#include <vector> #include <vector>
#include "Eigen/Core" #include "Eigen/Core"
#include "absl/log/absl_log.h"
#include "audio/dsp/number_util.h" #include "audio/dsp/number_util.h"
#include "mediapipe/calculators/audio/spectrogram_calculator.pb.h" #include "mediapipe/calculators/audio/spectrogram_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
@ -882,11 +883,11 @@ void BM_ProcessDC(benchmark::State& state) {
const CalculatorRunner::StreamContents& output = runner.Outputs().Index(0); const CalculatorRunner::StreamContents& output = runner.Outputs().Index(0);
const Matrix& output_matrix = output.packets[0].Get<Matrix>(); const Matrix& output_matrix = output.packets[0].Get<Matrix>();
LOG(INFO) << "Output matrix=" << output_matrix.rows() << "x" ABSL_LOG(INFO) << "Output matrix=" << output_matrix.rows() << "x"
<< output_matrix.cols(); << output_matrix.cols();
LOG(INFO) << "First values=" << output_matrix(0, 0) << ", " ABSL_LOG(INFO) << "First values=" << output_matrix(0, 0) << ", "
<< output_matrix(1, 0) << ", " << output_matrix(2, 0) << ", " << output_matrix(1, 0) << ", " << output_matrix(2, 0) << ", "
<< output_matrix(3, 0); << output_matrix(3, 0);
} }
BENCHMARK(BM_ProcessDC); BENCHMARK(BM_ProcessDC);

View File

@ -19,6 +19,7 @@
#include <vector> #include <vector>
#include "Eigen/Core" #include "Eigen/Core"
#include "absl/log/absl_log.h"
#include "audio/dsp/window_functions.h" #include "audio/dsp/window_functions.h"
#include "mediapipe/calculators/audio/time_series_framer_calculator.pb.h" #include "mediapipe/calculators/audio/time_series_framer_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
@ -186,11 +187,12 @@ class TimeSeriesFramerCalculatorTest
const int num_unique_output_samples = const int num_unique_output_samples =
round((output().packets.size() - 1) * frame_step_samples) + round((output().packets.size() - 1) * frame_step_samples) +
frame_duration_samples; frame_duration_samples;
LOG(INFO) << "packets.size()=" << output().packets.size() ABSL_LOG(INFO) << "packets.size()=" << output().packets.size()
<< " frame_duration_samples=" << frame_duration_samples << " frame_duration_samples=" << frame_duration_samples
<< " frame_step_samples=" << frame_step_samples << " frame_step_samples=" << frame_step_samples
<< " num_input_samples_=" << num_input_samples_ << " num_input_samples_=" << num_input_samples_
<< " num_unique_output_samples=" << num_unique_output_samples; << " num_unique_output_samples="
<< num_unique_output_samples;
const int num_padding_samples = const int num_padding_samples =
num_unique_output_samples - num_input_samples_; num_unique_output_samples - num_input_samples_;
if (options_.pad_final_packet()) { if (options_.pad_final_packet()) {

View File

@ -629,6 +629,7 @@ cc_library(
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
], ],
alwayslink = 1, alwayslink = 1,
) )
@ -776,10 +777,10 @@ cc_library(
"//mediapipe/framework/deps:random", "//mediapipe/framework/deps:random",
"//mediapipe/framework/formats:video_stream_header", "//mediapipe/framework/formats:video_stream_header",
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/tool:options_util", "//mediapipe/framework/tool:options_util",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
alwayslink = 1, alwayslink = 1,
@ -1022,6 +1023,7 @@ cc_library(
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/api2:node", "//mediapipe/framework/api2:node",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
], ],
alwayslink = 1, alwayslink = 1,
) )
@ -1060,6 +1062,7 @@ cc_test(
"//mediapipe/framework:calculator_runner", "//mediapipe/framework:calculator_runner",
"//mediapipe/framework/port:gtest_main", "//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:parse_text_proto", "//mediapipe/framework/port:parse_text_proto",
"@com_google_absl//absl/log:absl_log",
], ],
) )
@ -1106,6 +1109,7 @@ cc_library(
"//mediapipe/framework/api2:node", "//mediapipe/framework/api2:node",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
], ],
alwayslink = 1, alwayslink = 1,
) )

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "absl/log/absl_log.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/calculator_runner.h" #include "mediapipe/framework/calculator_runner.h"
#include "mediapipe/framework/port/gtest.h" #include "mediapipe/framework/port/gtest.h"
@ -356,18 +357,18 @@ TEST_F(GateCalculatorTest, AllowWithStateChangeNoDataStreams) {
RunTimeStepWithoutDataStream(kTimestampValue2, "ALLOW", true); RunTimeStepWithoutDataStream(kTimestampValue2, "ALLOW", true);
constexpr int64_t kTimestampValue3 = 45; constexpr int64_t kTimestampValue3 = 45;
RunTimeStepWithoutDataStream(kTimestampValue3, "ALLOW", false); RunTimeStepWithoutDataStream(kTimestampValue3, "ALLOW", false);
LOG(INFO) << "a"; ABSL_LOG(INFO) << "a";
const std::vector<Packet>& output = const std::vector<Packet>& output =
runner()->Outputs().Get("STATE_CHANGE", 0).packets; runner()->Outputs().Get("STATE_CHANGE", 0).packets;
LOG(INFO) << "s"; ABSL_LOG(INFO) << "s";
ASSERT_EQ(2, output.size()); ASSERT_EQ(2, output.size());
LOG(INFO) << "d"; ABSL_LOG(INFO) << "d";
EXPECT_EQ(kTimestampValue1, output[0].Timestamp().Value()); EXPECT_EQ(kTimestampValue1, output[0].Timestamp().Value());
EXPECT_EQ(kTimestampValue3, output[1].Timestamp().Value()); EXPECT_EQ(kTimestampValue3, output[1].Timestamp().Value());
LOG(INFO) << "f"; ABSL_LOG(INFO) << "f";
EXPECT_EQ(true, output[0].Get<bool>()); // Allow. EXPECT_EQ(true, output[0].Get<bool>()); // Allow.
EXPECT_EQ(false, output[1].Get<bool>()); // Disallow. EXPECT_EQ(false, output[1].Get<bool>()); // Disallow.
LOG(INFO) << "g"; ABSL_LOG(INFO) << "g";
} }
TEST_F(GateCalculatorTest, DisallowWithStateChange) { TEST_F(GateCalculatorTest, DisallowWithStateChange) {

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "absl/log/absl_log.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
@ -78,7 +79,7 @@ absl::Status ImmediateMuxCalculator::Process(CalculatorContext* cc) {
if (packet.Timestamp() >= cc->Outputs().Index(0).NextTimestampBound()) { if (packet.Timestamp() >= cc->Outputs().Index(0).NextTimestampBound()) {
cc->Outputs().Index(0).AddPacket(packet); cc->Outputs().Index(0).AddPacket(packet);
} else { } else {
LOG_FIRST_N(WARNING, 5) ABSL_LOG_FIRST_N(WARNING, 5)
<< "Dropping a packet with timestamp " << packet.Timestamp(); << "Dropping a packet with timestamp " << packet.Timestamp();
} }
if (cc->Outputs().NumEntries() >= 2) { if (cc->Outputs().NumEntries() >= 2) {

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "absl/log/absl_log.h"
#include "mediapipe/framework/api2/node.h" #include "mediapipe/framework/api2/node.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
@ -53,7 +54,7 @@ class MergeCalculator : public Node {
static absl::Status UpdateContract(CalculatorContract* cc) { static absl::Status UpdateContract(CalculatorContract* cc) {
RET_CHECK_GT(kIn(cc).Count(), 0) << "Needs at least one input stream"; RET_CHECK_GT(kIn(cc).Count(), 0) << "Needs at least one input stream";
if (kIn(cc).Count() == 1) { if (kIn(cc).Count() == 1) {
LOG(WARNING) ABSL_LOG(WARNING)
<< "MergeCalculator expects multiple input streams to merge but is " << "MergeCalculator expects multiple input streams to merge but is "
"receiving only one. Make sure the calculator is configured " "receiving only one. Make sure the calculator is configured "
"correctly or consider removing this calculator to reduce " "correctly or consider removing this calculator to reduce "
@ -72,8 +73,8 @@ class MergeCalculator : public Node {
} }
} }
LOG(WARNING) << "Empty input packets at timestamp " ABSL_LOG(WARNING) << "Empty input packets at timestamp "
<< cc->InputTimestamp().Value(); << cc->InputTimestamp().Value();
return absl::OkStatus(); return absl::OkStatus();
} }

View File

@ -16,6 +16,8 @@
#include <memory> #include <memory>
#include "absl/log/absl_log.h"
namespace { namespace {
// Reflect an integer against the lower and upper bound of an interval. // Reflect an integer against the lower and upper bound of an interval.
int64_t ReflectBetween(int64_t ts, int64_t ts_min, int64_t ts_max) { int64_t ReflectBetween(int64_t ts, int64_t ts_min, int64_t ts_max) {
@ -177,7 +179,7 @@ PacketResamplerCalculator::GetSamplingStrategy(
const PacketResamplerCalculatorOptions& options) { const PacketResamplerCalculatorOptions& options) {
if (options.reproducible_sampling()) { if (options.reproducible_sampling()) {
if (!options.jitter_with_reflection()) { if (!options.jitter_with_reflection()) {
LOG(WARNING) ABSL_LOG(WARNING)
<< "reproducible_sampling enabled w/ jitter_with_reflection " << "reproducible_sampling enabled w/ jitter_with_reflection "
"disabled. " "disabled. "
<< "reproducible_sampling always uses jitter with reflection, " << "reproducible_sampling always uses jitter with reflection, "
@ -229,13 +231,15 @@ absl::Status LegacyJitterWithReflectionStrategy::Open(CalculatorContext* cc) {
if (resampler_options.output_header() != if (resampler_options.output_header() !=
PacketResamplerCalculatorOptions::NONE) { PacketResamplerCalculatorOptions::NONE) {
LOG(WARNING) << "VideoHeader::frame_rate holds the target value and not " ABSL_LOG(WARNING)
"the actual value."; << "VideoHeader::frame_rate holds the target value and not "
"the actual value.";
} }
if (calculator_->flush_last_packet_) { if (calculator_->flush_last_packet_) {
LOG(WARNING) << "PacketResamplerCalculatorOptions.flush_last_packet is " ABSL_LOG(WARNING)
"ignored, because we are adding jitter."; << "PacketResamplerCalculatorOptions.flush_last_packet is "
"ignored, because we are adding jitter.";
} }
const auto& seed = cc->InputSidePackets().Tag(kSeedTag).Get<std::string>(); const auto& seed = cc->InputSidePackets().Tag(kSeedTag).Get<std::string>();
@ -254,7 +258,7 @@ absl::Status LegacyJitterWithReflectionStrategy::Open(CalculatorContext* cc) {
} }
absl::Status LegacyJitterWithReflectionStrategy::Close(CalculatorContext* cc) { absl::Status LegacyJitterWithReflectionStrategy::Close(CalculatorContext* cc) {
if (!packet_reservoir_->IsEmpty()) { if (!packet_reservoir_->IsEmpty()) {
LOG(INFO) << "Emitting pack from reservoir."; ABSL_LOG(INFO) << "Emitting pack from reservoir.";
calculator_->OutputWithinLimits(cc, packet_reservoir_->GetSample()); calculator_->OutputWithinLimits(cc, packet_reservoir_->GetSample());
} }
return absl::OkStatus(); return absl::OkStatus();
@ -285,7 +289,7 @@ absl::Status LegacyJitterWithReflectionStrategy::Process(
if (calculator_->frame_time_usec_ < if (calculator_->frame_time_usec_ <
(cc->InputTimestamp() - calculator_->last_packet_.Timestamp()).Value()) { (cc->InputTimestamp() - calculator_->last_packet_.Timestamp()).Value()) {
LOG_FIRST_N(WARNING, 2) ABSL_LOG_FIRST_N(WARNING, 2)
<< "Adding jitter is not very useful when upsampling."; << "Adding jitter is not very useful when upsampling.";
} }
@ -352,13 +356,15 @@ absl::Status ReproducibleJitterWithReflectionStrategy::Open(
if (resampler_options.output_header() != if (resampler_options.output_header() !=
PacketResamplerCalculatorOptions::NONE) { PacketResamplerCalculatorOptions::NONE) {
LOG(WARNING) << "VideoHeader::frame_rate holds the target value and not " ABSL_LOG(WARNING)
"the actual value."; << "VideoHeader::frame_rate holds the target value and not "
"the actual value.";
} }
if (calculator_->flush_last_packet_) { if (calculator_->flush_last_packet_) {
LOG(WARNING) << "PacketResamplerCalculatorOptions.flush_last_packet is " ABSL_LOG(WARNING)
"ignored, because we are adding jitter."; << "PacketResamplerCalculatorOptions.flush_last_packet is "
"ignored, because we are adding jitter.";
} }
const auto& seed = cc->InputSidePackets().Tag(kSeedTag).Get<std::string>(); const auto& seed = cc->InputSidePackets().Tag(kSeedTag).Get<std::string>();
@ -411,7 +417,7 @@ absl::Status ReproducibleJitterWithReflectionStrategy::Process(
// Note, if the stream is upsampling, this could lead to the same packet // Note, if the stream is upsampling, this could lead to the same packet
// being emitted twice. Upsampling and jitter doesn't make much sense // being emitted twice. Upsampling and jitter doesn't make much sense
// but does technically work. // but does technically work.
LOG_FIRST_N(WARNING, 2) ABSL_LOG_FIRST_N(WARNING, 2)
<< "Adding jitter is not very useful when upsampling."; << "Adding jitter is not very useful when upsampling.";
} }
@ -499,13 +505,15 @@ absl::Status JitterWithoutReflectionStrategy::Open(CalculatorContext* cc) {
if (resampler_options.output_header() != if (resampler_options.output_header() !=
PacketResamplerCalculatorOptions::NONE) { PacketResamplerCalculatorOptions::NONE) {
LOG(WARNING) << "VideoHeader::frame_rate holds the target value and not " ABSL_LOG(WARNING)
"the actual value."; << "VideoHeader::frame_rate holds the target value and not "
"the actual value.";
} }
if (calculator_->flush_last_packet_) { if (calculator_->flush_last_packet_) {
LOG(WARNING) << "PacketResamplerCalculatorOptions.flush_last_packet is " ABSL_LOG(WARNING)
"ignored, because we are adding jitter."; << "PacketResamplerCalculatorOptions.flush_last_packet is "
"ignored, because we are adding jitter.";
} }
const auto& seed = cc->InputSidePackets().Tag(kSeedTag).Get<std::string>(); const auto& seed = cc->InputSidePackets().Tag(kSeedTag).Get<std::string>();
@ -555,7 +563,7 @@ absl::Status JitterWithoutReflectionStrategy::Process(CalculatorContext* cc) {
if (calculator_->frame_time_usec_ < if (calculator_->frame_time_usec_ <
(cc->InputTimestamp() - calculator_->last_packet_.Timestamp()).Value()) { (cc->InputTimestamp() - calculator_->last_packet_.Timestamp()).Value()) {
LOG_FIRST_N(WARNING, 2) ABSL_LOG_FIRST_N(WARNING, 2)
<< "Adding jitter is not very useful when upsampling."; << "Adding jitter is not very useful when upsampling.";
} }

View File

@ -13,7 +13,6 @@
#include "mediapipe/framework/deps/random_base.h" #include "mediapipe/framework/deps/random_base.h"
#include "mediapipe/framework/formats/video_stream_header.h" #include "mediapipe/framework/formats/video_stream_header.h"
#include "mediapipe/framework/port/integral_types.h" #include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/port/status_macros.h" #include "mediapipe/framework/port/status_macros.h"

View File

@ -14,6 +14,7 @@
#include <deque> #include <deque>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/core/sequence_shift_calculator.pb.h" #include "mediapipe/calculators/core/sequence_shift_calculator.pb.h"
#include "mediapipe/framework/api2/node.h" #include "mediapipe/framework/api2/node.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
@ -101,7 +102,7 @@ void SequenceShiftCalculator::ProcessPositiveOffset(CalculatorContext* cc) {
kOut(cc).Send(packet_cache_.front().At(cc->InputTimestamp())); kOut(cc).Send(packet_cache_.front().At(cc->InputTimestamp()));
packet_cache_.pop_front(); packet_cache_.pop_front();
} else if (emit_empty_packets_before_first_packet_) { } else if (emit_empty_packets_before_first_packet_) {
LOG(FATAL) << "Not supported yet"; ABSL_LOG(FATAL) << "Not supported yet";
} }
// Store current packet for later output. // Store current packet for later output.
packet_cache_.push_back(kIn(cc).packet()); packet_cache_.push_back(kIn(cc).packet());

View File

@ -151,11 +151,11 @@ cc_library(
"//mediapipe/framework/formats:image_format_cc_proto", "//mediapipe/framework/formats:image_format_cc_proto",
"//mediapipe/framework/formats:image_frame", "//mediapipe/framework/formats:image_frame",
"//mediapipe/framework/formats:image_frame_opencv", "//mediapipe/framework/formats:image_frame_opencv",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:opencv_core", "//mediapipe/framework/port:opencv_core",
"//mediapipe/framework/port:opencv_imgproc", "//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/port:vector", "//mediapipe/framework/port:vector",
"@com_google_absl//absl/log:absl_log",
] + select({ ] + select({
"//mediapipe/gpu:disable_gpu": [], "//mediapipe/gpu:disable_gpu": [],
"//conditions:default": [ "//conditions:default": [
@ -300,6 +300,7 @@ cc_library(
"//mediapipe/framework/port:opencv_imgproc", "//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
] + select({ ] + select({
"//mediapipe/gpu:disable_gpu": [], "//mediapipe/gpu:disable_gpu": [],
"//conditions:default": [ "//conditions:default": [
@ -420,6 +421,7 @@ cc_library(
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/util:image_frame_util", "//mediapipe/util:image_frame_util",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@libyuv", "@libyuv",
], ],
@ -625,9 +627,9 @@ cc_library(
"//mediapipe/framework/formats:image", "//mediapipe/framework/formats:image",
"//mediapipe/framework/formats:image_format_cc_proto", "//mediapipe/framework/formats:image_format_cc_proto",
"//mediapipe/framework/formats:image_frame", "//mediapipe/framework/formats:image_frame",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/port:vector", "//mediapipe/framework/port:vector",
"@com_google_absl//absl/log:absl_log",
] + select({ ] + select({
"//mediapipe/gpu:disable_gpu": [], "//mediapipe/gpu:disable_gpu": [],
"//conditions:default": [ "//conditions:default": [
@ -665,6 +667,7 @@ cc_test(
"//mediapipe/framework/port:opencv_imgcodecs", "//mediapipe/framework/port:opencv_imgcodecs",
"//mediapipe/framework/port:opencv_imgproc", "//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:parse_text_proto", "//mediapipe/framework/port:parse_text_proto",
"@com_google_absl//absl/log:absl_log",
], ],
) )

View File

@ -16,6 +16,7 @@
#include <cmath> #include <cmath>
#include "absl/log/absl_log.h"
#include "mediapipe/framework/formats/image_frame.h" #include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/image_frame_opencv.h" #include "mediapipe/framework/formats/image_frame_opencv.h"
#include "mediapipe/framework/formats/rect.pb.h" #include "mediapipe/framework/formats/rect.pb.h"
@ -202,8 +203,9 @@ absl::Status ImageCroppingCalculator::ValidateBorderModeForGPU(
switch (options.border_mode()) { switch (options.border_mode()) {
case mediapipe::ImageCroppingCalculatorOptions::BORDER_ZERO: case mediapipe::ImageCroppingCalculatorOptions::BORDER_ZERO:
LOG(WARNING) << "BORDER_ZERO mode is not supported by GPU " ABSL_LOG(WARNING)
<< "implementation and will fall back into BORDER_REPLICATE"; << "BORDER_ZERO mode is not supported by GPU "
<< "implementation and will fall back into BORDER_REPLICATE";
break; break;
case mediapipe::ImageCroppingCalculatorOptions::BORDER_REPLICATE: case mediapipe::ImageCroppingCalculatorOptions::BORDER_REPLICATE:
break; break;

View File

@ -18,6 +18,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/substitute.h" #include "absl/strings/substitute.h"
#include "libyuv/scale.h" #include "libyuv/scale.h"
@ -293,7 +294,7 @@ absl::Status ScaleImageCalculator::InitializeFrameInfo(CalculatorContext* cc) {
header->width = output_width_; header->width = output_width_;
header->height = output_height_; header->height = output_height_;
header->format = output_format_; header->format = output_format_;
LOG(INFO) << "OUTPUTTING HEADER on stream"; ABSL_LOG(INFO) << "OUTPUTTING HEADER on stream";
cc->Outputs() cc->Outputs()
.Tag("VIDEO_HEADER") .Tag("VIDEO_HEADER")
.Add(header.release(), Timestamp::PreStream()); .Add(header.release(), Timestamp::PreStream());
@ -393,10 +394,11 @@ absl::Status ScaleImageCalculator::Open(CalculatorContext* cc) {
.SetHeader(Adopt(output_header.release())); .SetHeader(Adopt(output_header.release()));
has_header_ = true; has_header_ = true;
} else { } else {
LOG(WARNING) << "Stream had a VideoHeader which didn't have sufficient " ABSL_LOG(WARNING)
"information. " << "Stream had a VideoHeader which didn't have sufficient "
"Dropping VideoHeader and trying to deduce needed " "information. "
"information."; "Dropping VideoHeader and trying to deduce needed "
"information.";
input_width_ = 0; input_width_ = 0;
input_height_ = 0; input_height_ = 0;
if (!options_.has_input_format()) { if (!options_.has_input_format()) {

View File

@ -15,13 +15,13 @@
#include <algorithm> #include <algorithm>
#include <memory> #include <memory>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/image/segmentation_smoothing_calculator.pb.h" #include "mediapipe/calculators/image/segmentation_smoothing_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/calculator_options.pb.h" #include "mediapipe/framework/calculator_options.pb.h"
#include "mediapipe/framework/formats/image.h" #include "mediapipe/framework/formats/image.h"
#include "mediapipe/framework/formats/image_format.pb.h" #include "mediapipe/framework/formats/image_format.pb.h"
#include "mediapipe/framework/formats/image_frame.h" #include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/port/vector.h" #include "mediapipe/framework/port/vector.h"
@ -273,7 +273,7 @@ absl::Status SegmentationSmoothingCalculator::RenderGpu(CalculatorContext* cc) {
const auto& previous_frame = cc->Inputs().Tag(kPreviousMaskTag).Get<Image>(); const auto& previous_frame = cc->Inputs().Tag(kPreviousMaskTag).Get<Image>();
if (previous_frame.format() != current_frame.format()) { if (previous_frame.format() != current_frame.format()) {
LOG(ERROR) << "Warning: mixing input format types. "; ABSL_LOG(ERROR) << "Warning: mixing input format types. ";
} }
auto previous_texture = gpu_helper_.CreateSourceTexture(previous_frame); auto previous_texture = gpu_helper_.CreateSourceTexture(previous_frame);

View File

@ -14,6 +14,7 @@
#include <memory> #include <memory>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/image/segmentation_smoothing_calculator.pb.h" #include "mediapipe/calculators/image/segmentation_smoothing_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/calculator_runner.h" #include "mediapipe/framework/calculator_runner.h"
@ -169,7 +170,7 @@ void RunTest(bool use_gpu, float mix_ratio, cv::Mat& test_result) {
} }
} }
} else { } else {
LOG(ERROR) << "invalid ratio"; ABSL_LOG(ERROR) << "invalid ratio";
} }
} }

View File

@ -14,13 +14,13 @@
#include <memory> #include <memory>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/image/set_alpha_calculator.pb.h" #include "mediapipe/calculators/image/set_alpha_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/calculator_options.pb.h" #include "mediapipe/framework/calculator_options.pb.h"
#include "mediapipe/framework/formats/image_format.pb.h" #include "mediapipe/framework/formats/image_format.pb.h"
#include "mediapipe/framework/formats/image_frame.h" #include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/image_frame_opencv.h" #include "mediapipe/framework/formats/image_frame_opencv.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/opencv_core_inc.h" #include "mediapipe/framework/port/opencv_core_inc.h"
#include "mediapipe/framework/port/opencv_imgproc_inc.h" #include "mediapipe/framework/port/opencv_imgproc_inc.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
@ -268,7 +268,7 @@ absl::Status SetAlphaCalculator::RenderCpu(CalculatorContext* cc) {
const auto& input_frame = cc->Inputs().Tag(kInputFrameTag).Get<ImageFrame>(); const auto& input_frame = cc->Inputs().Tag(kInputFrameTag).Get<ImageFrame>();
const cv::Mat input_mat = formats::MatView(&input_frame); const cv::Mat input_mat = formats::MatView(&input_frame);
if (!(input_mat.type() == CV_8UC3 || input_mat.type() == CV_8UC4)) { if (!(input_mat.type() == CV_8UC3 || input_mat.type() == CV_8UC4)) {
LOG(ERROR) << "Only 3 or 4 channel 8-bit input image supported"; ABSL_LOG(ERROR) << "Only 3 or 4 channel 8-bit input image supported";
} }
// Setup destination image // Setup destination image
@ -328,7 +328,7 @@ absl::Status SetAlphaCalculator::RenderGpu(CalculatorContext* cc) {
cc->Inputs().Tag(kInputFrameTagGpu).Get<mediapipe::GpuBuffer>(); cc->Inputs().Tag(kInputFrameTagGpu).Get<mediapipe::GpuBuffer>();
if (!(input_frame.format() == mediapipe::GpuBufferFormat::kBGRA32 || if (!(input_frame.format() == mediapipe::GpuBufferFormat::kBGRA32 ||
input_frame.format() == mediapipe::GpuBufferFormat::kRGB24)) { input_frame.format() == mediapipe::GpuBufferFormat::kRGB24)) {
LOG(ERROR) << "Only RGB or RGBA input image supported"; ABSL_LOG(ERROR) << "Only RGB or RGBA input image supported";
} }
auto input_texture = gpu_helper_.CreateSourceTexture(input_frame); auto input_texture = gpu_helper_.CreateSourceTexture(input_frame);

View File

@ -474,6 +474,7 @@ cc_library(
"//mediapipe/gpu:gpu_buffer", "//mediapipe/gpu:gpu_buffer",
"//mediapipe/objc:mediapipe_framework_ios", "//mediapipe/objc:mediapipe_framework_ios",
"//mediapipe/util/tflite:config", "//mediapipe/util/tflite:config",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/strings:str_format",
"@org_tensorflow//tensorflow/lite/delegates/gpu:metal_delegate", "@org_tensorflow//tensorflow/lite/delegates/gpu:metal_delegate",
@ -744,6 +745,7 @@ cc_library(
"//mediapipe/framework/formats:tensor", "//mediapipe/framework/formats:tensor",
"//mediapipe/framework/formats/object_detection:anchor_cc_proto", "//mediapipe/framework/formats/object_detection:anchor_cc_proto",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/types:span", "@com_google_absl//absl/types:span",
] + selects.with_or({ ] + selects.with_or({
@ -992,6 +994,7 @@ cc_library(
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/port:statusor", "//mediapipe/framework/port:statusor",
"//mediapipe/gpu:gpu_origin_cc_proto", "//mediapipe/gpu:gpu_origin_cc_proto",
"@com_google_absl//absl/log:absl_log",
] + select({ ] + select({
"//mediapipe/gpu:disable_gpu": [], "//mediapipe/gpu:disable_gpu": [],
"//conditions:default": [":image_to_tensor_calculator_gpu_deps"], "//conditions:default": [":image_to_tensor_calculator_gpu_deps"],
@ -1211,6 +1214,7 @@ cc_library(
"//mediapipe/gpu:gl_calculator_helper", "//mediapipe/gpu:gl_calculator_helper",
"//mediapipe/gpu:gl_simple_shaders", "//mediapipe/gpu:gl_simple_shaders",
"//mediapipe/gpu:shader_util", "//mediapipe/gpu:shader_util",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
}), }),

View File

@ -16,6 +16,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/tensor/image_to_tensor_calculator.pb.h" #include "mediapipe/calculators/tensor/image_to_tensor_calculator.pb.h"
#include "mediapipe/calculators/tensor/image_to_tensor_converter.h" #include "mediapipe/calculators/tensor/image_to_tensor_converter.h"
#include "mediapipe/calculators/tensor/image_to_tensor_utils.h" #include "mediapipe/calculators/tensor/image_to_tensor_utils.h"
@ -284,9 +285,9 @@ class ImageToTensorCalculator : public Node {
cc, GetBorderMode(options_.border_mode()), cc, GetBorderMode(options_.border_mode()),
GetOutputTensorType(/*uses_gpu=*/false, params_))); GetOutputTensorType(/*uses_gpu=*/false, params_)));
#else #else
LOG(FATAL) << "Cannot create image to tensor CPU converter since " ABSL_LOG(FATAL) << "Cannot create image to tensor CPU converter since "
"MEDIAPIPE_DISABLE_OPENCV is defined and " "MEDIAPIPE_DISABLE_OPENCV is defined and "
"MEDIAPIPE_ENABLE_HALIDE is not defined."; "MEDIAPIPE_ENABLE_HALIDE is not defined.";
#endif // !MEDIAPIPE_DISABLE_HALIDE #endif // !MEDIAPIPE_DISABLE_HALIDE
} }
} }

View File

@ -22,6 +22,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "mediapipe/calculators/tensor/image_to_tensor_converter.h" #include "mediapipe/calculators/tensor/image_to_tensor_converter.h"
#include "mediapipe/calculators/tensor/image_to_tensor_converter_gl_utils.h" #include "mediapipe/calculators/tensor/image_to_tensor_converter_gl_utils.h"
@ -259,7 +260,7 @@ class GlProcessor : public ImageToTensorConverter {
// error. So in that case, we'll grab the transpose of our original matrix // error. So in that case, we'll grab the transpose of our original matrix
// and send that instead. // and send that instead.
const auto gl_context = mediapipe::GlContext::GetCurrent(); const auto gl_context = mediapipe::GlContext::GetCurrent();
LOG_IF(FATAL, !gl_context) << "GlContext is not bound to the thread."; ABSL_LOG_IF(FATAL, !gl_context) << "GlContext is not bound to the thread.";
if (gl_context->GetGlVersion() == mediapipe::GlVersion::kGLES2) { if (gl_context->GetGlVersion() == mediapipe::GlVersion::kGLES2) {
GetTransposedRotatedSubRectToRectTransformMatrix( GetTransposedRotatedSubRectToRectTransformMatrix(
sub_rect, texture.width(), texture.height(), flip_horizontaly, sub_rect, texture.width(), texture.height(), flip_horizontaly,

View File

@ -21,6 +21,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "mediapipe/calculators/tensor/inference_calculator.h" #include "mediapipe/calculators/tensor/inference_calculator.h"
@ -74,7 +75,7 @@ tflite::gpu::BHWC BhwcFromTensorShape(const Tensor::Shape& shape) {
break; break;
default: default:
// Handles 0 and >4. // Handles 0 and >4.
LOG(FATAL) ABSL_LOG(FATAL)
<< "Dimensions size must be in range [1,4] for GPU inference, but " << "Dimensions size must be in range [1,4] for GPU inference, but "
<< shape.dims.size() << " is provided"; << shape.dims.size() << " is provided";
} }

View File

@ -15,6 +15,7 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "absl/types/span.h" #include "absl/types/span.h"
#include "mediapipe/calculators/tensor/tensors_to_detections_calculator.pb.h" #include "mediapipe/calculators/tensor/tensors_to_detections_calculator.pb.h"
@ -329,7 +330,7 @@ absl::Status TensorsToDetectionsCalculator::Process(CalculatorContext* cc) {
} else if (status.code() == absl::StatusCode::kFailedPrecondition) { } else if (status.code() == absl::StatusCode::kFailedPrecondition) {
// For initialization error because of hardware limitation, fallback to // For initialization error because of hardware limitation, fallback to
// CPU processing. // CPU processing.
LOG(WARNING) << status.message(); ABSL_LOG(WARNING) << status.message();
} else { } else {
// For other error, let the error propagates. // For other error, let the error propagates.
return status; return status;
@ -668,7 +669,7 @@ absl::Status TensorsToDetectionsCalculator::ProcessGPU(
output_detections)); output_detections));
#else #else
LOG(ERROR) << "GPU input on non-Android not supported yet."; ABSL_LOG(ERROR) << "GPU input on non-Android not supported yet.";
#endif // !defined(MEDIAPIPE_DISABLE_GL_COMPUTE) #endif // !defined(MEDIAPIPE_DISABLE_GL_COMPUTE)
return absl::OkStatus(); return absl::OkStatus();
} }

View File

@ -488,10 +488,10 @@ cc_library(
"//mediapipe/calculators/tensorflow:tensorflow_session_from_frozen_graph_calculator_cc_proto", "//mediapipe/calculators/tensorflow:tensorflow_session_from_frozen_graph_calculator_cc_proto",
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/deps:clock", "//mediapipe/framework/deps:clock",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/tool:status_util", "//mediapipe/framework/tool:status_util",
"@com_google_absl//absl/log:absl_log",
"@org_tensorflow//tensorflow/core:protos_all_cc", "@org_tensorflow//tensorflow/core:protos_all_cc",
] + select({ ] + select({
"//conditions:default": [ "//conditions:default": [
@ -519,10 +519,10 @@ cc_library(
":tensorflow_session_from_frozen_graph_generator_cc_proto", ":tensorflow_session_from_frozen_graph_generator_cc_proto",
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/deps:clock", "//mediapipe/framework/deps:clock",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/tool:status_util", "//mediapipe/framework/tool:status_util",
"@com_google_absl//absl/log:absl_log",
"@org_tensorflow//tensorflow/core:protos_all_cc", "@org_tensorflow//tensorflow/core:protos_all_cc",
] + select({ ] + select({
"//conditions:default": [ "//conditions:default": [
@ -555,6 +555,7 @@ cc_library(
"//mediapipe/framework/deps:file_path", "//mediapipe/framework/deps:file_path",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@org_tensorflow//tensorflow/cc/saved_model:constants", "@org_tensorflow//tensorflow/cc/saved_model:constants",
"@org_tensorflow//tensorflow/cc/saved_model:loader_lite", "@org_tensorflow//tensorflow/cc/saved_model:loader_lite",
@ -632,6 +633,7 @@ cc_library(
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/tool:status_util", "//mediapipe/framework/tool:status_util",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/status", "@com_google_absl//absl/status",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@org_tensorflow//tensorflow/cc/saved_model:constants", "@org_tensorflow//tensorflow/cc/saved_model:constants",
@ -653,6 +655,7 @@ cc_library(
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
"@org_tensorflow//tensorflow/core:framework", "@org_tensorflow//tensorflow/core:framework",
], ],
alwayslink = 1, alwayslink = 1,
@ -778,6 +781,7 @@ cc_library(
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/util:audio_decoder_cc_proto", "//mediapipe/util:audio_decoder_cc_proto",
"//mediapipe/util/sequence:media_sequence", "//mediapipe/util/sequence:media_sequence",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@org_tensorflow//tensorflow/core:protos_all_cc", "@org_tensorflow//tensorflow/core:protos_all_cc",
], ],
@ -792,6 +796,7 @@ cc_library(
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
"@org_tensorflow//tensorflow/core:framework", "@org_tensorflow//tensorflow/core:framework",
], ],
alwayslink = 1, alwayslink = 1,
@ -805,6 +810,7 @@ cc_library(
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
"@org_tensorflow//tensorflow/core:framework", "@org_tensorflow//tensorflow/core:framework",
], ],
alwayslink = 1, alwayslink = 1,
@ -818,6 +824,7 @@ cc_library(
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
"@org_tensorflow//tensorflow/core:framework", "@org_tensorflow//tensorflow/core:framework",
], ],
alwayslink = 1, alwayslink = 1,
@ -831,6 +838,7 @@ cc_library(
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework:packet", "//mediapipe/framework:packet",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
"@org_tensorflow//tensorflow/core:protos_all_cc", "@org_tensorflow//tensorflow/core:protos_all_cc",
], ],
alwayslink = 1, alwayslink = 1,
@ -1167,6 +1175,7 @@ cc_test(
"//mediapipe/framework/port:rectangle", "//mediapipe/framework/port:rectangle",
"//mediapipe/util:audio_decoder_cc_proto", "//mediapipe/util:audio_decoder_cc_proto",
"//mediapipe/util/sequence:media_sequence", "//mediapipe/util/sequence:media_sequence",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@org_tensorflow//tensorflow/core:protos_all_cc", "@org_tensorflow//tensorflow/core:protos_all_cc",
@ -1248,6 +1257,7 @@ cc_test(
"//mediapipe/framework/tool:sink", "//mediapipe/framework/tool:sink",
"//mediapipe/framework/tool:validate_type", "//mediapipe/framework/tool:validate_type",
"@com_google_absl//absl/flags:flag", "@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log:absl_log",
] + select({ ] + select({
"//conditions:default": [ "//conditions:default": [
"@org_tensorflow//tensorflow/core:direct_session", "@org_tensorflow//tensorflow/core:direct_session",

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/tensorflow/tensor_squeeze_dimensions_calculator.pb.h" #include "mediapipe/calculators/tensorflow/tensor_squeeze_dimensions_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
@ -99,10 +100,11 @@ class TensorSqueezeDimensionsCalculator : public CalculatorBase {
} }
} }
if (remove_dims_.empty()) { if (remove_dims_.empty()) {
LOG(ERROR) << "TensorSqueezeDimensionsCalculator is squeezing input with " ABSL_LOG(ERROR)
"no single-dimensions. Calculator will be a no-op."; << "TensorSqueezeDimensionsCalculator is squeezing input with "
LOG(ERROR) << "Input to TensorSqueezeDimensionsCalculator has shape " "no single-dimensions. Calculator will be a no-op.";
<< tensor_shape.DebugString(); ABSL_LOG(ERROR) << "Input to TensorSqueezeDimensionsCalculator has shape "
<< tensor_shape.DebugString();
} }
} }
}; };

View File

@ -17,6 +17,7 @@
#include <vector> #include <vector>
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/tensorflow/tensorflow_inference_calculator.pb.h" #include "mediapipe/calculators/tensorflow/tensorflow_inference_calculator.pb.h"
#include "mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_generator.pb.h" #include "mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_generator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
@ -586,12 +587,12 @@ TEST_F(TensorflowInferenceCalculatorTest, TestRecurrentStates) {
runner_->Outputs().Tag(kMultipliedTag).packets; runner_->Outputs().Tag(kMultipliedTag).packets;
ASSERT_EQ(2, output_packets_mult.size()); ASSERT_EQ(2, output_packets_mult.size());
const tf::Tensor& tensor_mult = output_packets_mult[0].Get<tf::Tensor>(); const tf::Tensor& tensor_mult = output_packets_mult[0].Get<tf::Tensor>();
LOG(INFO) << "timestamp: " << 0; ABSL_LOG(INFO) << "timestamp: " << 0;
auto expected_tensor = tf::test::AsTensor<int32_t>({3, 8, 15}); auto expected_tensor = tf::test::AsTensor<int32_t>({3, 8, 15});
tf::test::ExpectTensorEqual<int32_t>(tensor_mult, expected_tensor); tf::test::ExpectTensorEqual<int32_t>(tensor_mult, expected_tensor);
const tf::Tensor& tensor_mult1 = output_packets_mult[1].Get<tf::Tensor>(); const tf::Tensor& tensor_mult1 = output_packets_mult[1].Get<tf::Tensor>();
auto expected_tensor1 = tf::test::AsTensor<int32_t>({9, 32, 75}); auto expected_tensor1 = tf::test::AsTensor<int32_t>({9, 32, 75});
LOG(INFO) << "timestamp: " << 1; ABSL_LOG(INFO) << "timestamp: " << 1;
tf::test::ExpectTensorEqual<int32_t>(tensor_mult1, expected_tensor1); tf::test::ExpectTensorEqual<int32_t>(tensor_mult1, expected_tensor1);
EXPECT_EQ(2, runner_ EXPECT_EQ(2, runner_
@ -627,12 +628,12 @@ TEST_F(TensorflowInferenceCalculatorTest, TestRecurrentStateOverride) {
runner_->Outputs().Tag(kMultipliedTag).packets; runner_->Outputs().Tag(kMultipliedTag).packets;
ASSERT_EQ(2, output_packets_mult.size()); ASSERT_EQ(2, output_packets_mult.size());
const tf::Tensor& tensor_mult = output_packets_mult[0].Get<tf::Tensor>(); const tf::Tensor& tensor_mult = output_packets_mult[0].Get<tf::Tensor>();
LOG(INFO) << "timestamp: " << 0; ABSL_LOG(INFO) << "timestamp: " << 0;
auto expected_tensor = tf::test::AsTensor<int32_t>({3, 4, 5}); auto expected_tensor = tf::test::AsTensor<int32_t>({3, 4, 5});
tf::test::ExpectTensorEqual<int32_t>(tensor_mult, expected_tensor); tf::test::ExpectTensorEqual<int32_t>(tensor_mult, expected_tensor);
const tf::Tensor& tensor_mult1 = output_packets_mult[1].Get<tf::Tensor>(); const tf::Tensor& tensor_mult1 = output_packets_mult[1].Get<tf::Tensor>();
auto expected_tensor1 = tf::test::AsTensor<int32_t>({3, 4, 5}); auto expected_tensor1 = tf::test::AsTensor<int32_t>({3, 4, 5});
LOG(INFO) << "timestamp: " << 1; ABSL_LOG(INFO) << "timestamp: " << 1;
tf::test::ExpectTensorEqual<int32_t>(tensor_mult1, expected_tensor1); tf::test::ExpectTensorEqual<int32_t>(tensor_mult1, expected_tensor1);
EXPECT_EQ(2, runner_ EXPECT_EQ(2, runner_

View File

@ -23,12 +23,12 @@
#include <string> #include <string>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/tensorflow/tensorflow_session.h" #include "mediapipe/calculators/tensorflow/tensorflow_session.h"
#include "mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_calculator.pb.h" #include "mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/deps/clock.h" #include "mediapipe/framework/deps/clock.h"
#include "mediapipe/framework/deps/monotonic_clock.h" #include "mediapipe/framework/deps/monotonic_clock.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/tool/status_util.h" #include "mediapipe/framework/tool/status_util.h"
@ -156,8 +156,8 @@ class TensorFlowSessionFromFrozenGraphCalculator : public CalculatorBase {
cc->OutputSidePackets().Tag(kSessionTag).Set(Adopt(session.release())); cc->OutputSidePackets().Tag(kSessionTag).Set(Adopt(session.release()));
const uint64_t end_time = absl::ToUnixMicros(clock->TimeNow()); const uint64_t end_time = absl::ToUnixMicros(clock->TimeNow());
LOG(INFO) << "Loaded frozen model in: " << end_time - start_time ABSL_LOG(INFO) << "Loaded frozen model in: " << end_time - start_time
<< " microseconds."; << " microseconds.";
return absl::OkStatus(); return absl::OkStatus();
} }

View File

@ -24,13 +24,13 @@
#include <string> #include <string>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/tensorflow/tensorflow_session.h" #include "mediapipe/calculators/tensorflow/tensorflow_session.h"
#include "mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_generator.pb.h" #include "mediapipe/calculators/tensorflow/tensorflow_session_from_frozen_graph_generator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/deps/clock.h" #include "mediapipe/framework/deps/clock.h"
#include "mediapipe/framework/deps/monotonic_clock.h" #include "mediapipe/framework/deps/monotonic_clock.h"
#include "mediapipe/framework/port/file_helpers.h" #include "mediapipe/framework/port/file_helpers.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/tool/status_util.h" #include "mediapipe/framework/tool/status_util.h"
@ -155,8 +155,8 @@ class TensorFlowSessionFromFrozenGraphGenerator : public PacketGenerator {
output_side_packets->Tag(kSessionTag) = Adopt(session.release()); output_side_packets->Tag(kSessionTag) = Adopt(session.release());
const uint64_t end_time = absl::ToUnixMicros(clock->TimeNow()); const uint64_t end_time = absl::ToUnixMicros(clock->TimeNow());
LOG(INFO) << "Loaded frozen model in: " << end_time - start_time ABSL_LOG(INFO) << "Loaded frozen model in: " << end_time - start_time
<< " microseconds."; << " microseconds.";
return absl::OkStatus(); return absl::OkStatus();
} }
}; };

View File

@ -17,6 +17,7 @@
#if !defined(__ANDROID__) #if !defined(__ANDROID__)
#include "mediapipe/framework/port/file_helpers.h" #include "mediapipe/framework/port/file_helpers.h"
#endif #endif
#include "absl/log/absl_log.h"
#include "absl/strings/str_replace.h" #include "absl/strings/str_replace.h"
#include "mediapipe/calculators/tensorflow/tensorflow_session.h" #include "mediapipe/calculators/tensorflow/tensorflow_session.h"
#include "mediapipe/calculators/tensorflow/tensorflow_session_from_saved_model_calculator.pb.h" #include "mediapipe/calculators/tensorflow/tensorflow_session_from_saved_model_calculator.pb.h"
@ -69,7 +70,7 @@ const std::string MaybeConvertSignatureToTag(
[](unsigned char c) { return std::toupper(c); }); [](unsigned char c) { return std::toupper(c); });
output = absl::StrReplaceAll( output = absl::StrReplaceAll(
output, {{"/", "_"}, {"-", "_"}, {".", "_"}, {":", "_"}}); output, {{"/", "_"}, {"-", "_"}, {".", "_"}, {":", "_"}});
LOG(INFO) << "Renamed TAG from: " << name << " to " << output; ABSL_LOG(INFO) << "Renamed TAG from: " << name << " to " << output;
return output; return output;
} else { } else {
return name; return name;

View File

@ -19,6 +19,7 @@
#if !defined(__ANDROID__) #if !defined(__ANDROID__)
#include "mediapipe/framework/port/file_helpers.h" #include "mediapipe/framework/port/file_helpers.h"
#endif #endif
#include "absl/log/absl_log.h"
#include "absl/strings/str_replace.h" #include "absl/strings/str_replace.h"
#include "mediapipe/calculators/tensorflow/tensorflow_session.h" #include "mediapipe/calculators/tensorflow/tensorflow_session.h"
#include "mediapipe/calculators/tensorflow/tensorflow_session_from_saved_model_generator.pb.h" #include "mediapipe/calculators/tensorflow/tensorflow_session_from_saved_model_generator.pb.h"
@ -75,7 +76,7 @@ const std::string MaybeConvertSignatureToTag(
[](unsigned char c) { return std::toupper(c); }); [](unsigned char c) { return std::toupper(c); });
output = absl::StrReplaceAll( output = absl::StrReplaceAll(
output, {{"/", "_"}, {"-", "_"}, {".", "_"}, {":", "_"}}); output, {{"/", "_"}, {"-", "_"}, {".", "_"}, {":", "_"}});
LOG(INFO) << "Renamed TAG from: " << name << " to " << output; ABSL_LOG(INFO) << "Renamed TAG from: " << name << " to " << output;
return output; return output;
} else { } else {
return name; return name;

View File

@ -13,6 +13,7 @@
// limitations under the License. // limitations under the License.
#include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_map.h"
#include "absl/log/absl_log.h"
#include "absl/strings/match.h" #include "absl/strings/match.h"
#include "mediapipe/calculators/core/packet_resampler_calculator.pb.h" #include "mediapipe/calculators/core/packet_resampler_calculator.pb.h"
#include "mediapipe/calculators/tensorflow/unpack_media_sequence_calculator.pb.h" #include "mediapipe/calculators/tensorflow/unpack_media_sequence_calculator.pb.h"
@ -201,8 +202,8 @@ class UnpackMediaSequenceCalculator : public CalculatorBase {
first_timestamp_seen_ = Timestamp::OneOverPostStream().Value(); first_timestamp_seen_ = Timestamp::OneOverPostStream().Value();
for (const auto& map_kv : sequence_->feature_lists().feature_list()) { for (const auto& map_kv : sequence_->feature_lists().feature_list()) {
if (absl::StrContains(map_kv.first, "/timestamp")) { if (absl::StrContains(map_kv.first, "/timestamp")) {
LOG(INFO) << "Found feature timestamps: " << map_kv.first ABSL_LOG(INFO) << "Found feature timestamps: " << map_kv.first
<< " with size: " << map_kv.second.feature_size(); << " with size: " << map_kv.second.feature_size();
int64_t recent_timestamp = Timestamp::PreStream().Value(); int64_t recent_timestamp = Timestamp::PreStream().Value();
for (int i = 0; i < map_kv.second.feature_size(); ++i) { for (int i = 0; i < map_kv.second.feature_size(); ++i) {
int64_t next_timestamp = int64_t next_timestamp =
@ -309,8 +310,8 @@ class UnpackMediaSequenceCalculator : public CalculatorBase {
audio_decoder_options->set_end_time( audio_decoder_options->set_end_time(
end_time + options.extra_padding_from_media_decoder()); end_time + options.extra_padding_from_media_decoder());
} }
LOG(INFO) << "Created AudioDecoderOptions:\n" ABSL_LOG(INFO) << "Created AudioDecoderOptions:\n"
<< audio_decoder_options->DebugString(); << audio_decoder_options->DebugString();
cc->OutputSidePackets() cc->OutputSidePackets()
.Tag(kAudioDecoderOptions) .Tag(kAudioDecoderOptions)
.Set(Adopt(audio_decoder_options.release())); .Set(Adopt(audio_decoder_options.release()));
@ -331,8 +332,8 @@ class UnpackMediaSequenceCalculator : public CalculatorBase {
->set_end_time(Timestamp::FromSeconds(end_time).Value()); ->set_end_time(Timestamp::FromSeconds(end_time).Value());
} }
LOG(INFO) << "Created PacketResamplerOptions:\n" ABSL_LOG(INFO) << "Created PacketResamplerOptions:\n"
<< resampler_options->DebugString(); << resampler_options->DebugString();
cc->OutputSidePackets() cc->OutputSidePackets()
.Tag(kPacketResamplerOptions) .Tag(kPacketResamplerOptions)
.Set(Adopt(resampler_options.release())); .Set(Adopt(resampler_options.release()));
@ -351,7 +352,8 @@ class UnpackMediaSequenceCalculator : public CalculatorBase {
absl::Status Process(CalculatorContext* cc) override { absl::Status Process(CalculatorContext* cc) override {
if (timestamps_.empty()) { if (timestamps_.empty()) {
// This occurs when we only have metadata to unpack. // This occurs when we only have metadata to unpack.
LOG(INFO) << "only unpacking metadata because there are no timestamps."; ABSL_LOG(INFO)
<< "only unpacking metadata because there are no timestamps.";
return tool::StatusStop(); return tool::StatusStop();
} }
// In Process(), we loop through timestamps on a reference stream and emit // In Process(), we loop through timestamps on a reference stream and emit

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/strings/numbers.h" #include "absl/strings/numbers.h"
#include "mediapipe/calculators/core/packet_resampler_calculator.pb.h" #include "mediapipe/calculators/core/packet_resampler_calculator.pb.h"
@ -81,7 +82,7 @@ class UnpackMediaSequenceCalculatorTest : public ::testing::Test {
if (options != nullptr) { if (options != nullptr) {
*config.mutable_options() = *options; *config.mutable_options() = *options;
} }
LOG(INFO) << config.DebugString(); ABSL_LOG(INFO) << config.DebugString();
runner_ = absl::make_unique<CalculatorRunner>(config); runner_ = absl::make_unique<CalculatorRunner>(config);
} }

View File

@ -14,6 +14,7 @@
#include <iterator> #include <iterator>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/tensorflow/lapped_tensor_buffer_calculator.pb.h" #include "mediapipe/calculators/tensorflow/lapped_tensor_buffer_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/packet.h" #include "mediapipe/framework/packet.h"
@ -149,8 +150,9 @@ class UnpackYt8mSequenceExampleCalculator : public CalculatorBase {
.Set(MakePacket<int>(segment_size)); .Set(MakePacket<int>(segment_size));
} }
} }
LOG(INFO) << "Reading the sequence example that contains yt8m id: " ABSL_LOG(INFO) << "Reading the sequence example that contains yt8m id: "
<< yt8m_id << ". Feature list length: " << feature_list_length_; << yt8m_id
<< ". Feature list length: " << feature_list_length_;
return absl::OkStatus(); return absl::OkStatus();
} }

View File

@ -14,6 +14,7 @@
// //
// Converts vector<float> (or vector<vector<float>>) to 1D (or 2D) tf::Tensor. // Converts vector<float> (or vector<vector<float>>) to 1D (or 2D) tf::Tensor.
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/tensorflow/vector_float_to_tensor_calculator_options.pb.h" #include "mediapipe/calculators/tensorflow/vector_float_to_tensor_calculator_options.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
@ -68,7 +69,7 @@ absl::Status VectorFloatToTensorCalculator::GetContract(
// Output vector<float>. // Output vector<float>.
); );
} else { } else {
LOG(FATAL) << "input size not supported"; ABSL_LOG(FATAL) << "input size not supported";
} }
RET_CHECK_EQ(cc->Outputs().NumEntries(), 1) RET_CHECK_EQ(cc->Outputs().NumEntries(), 1)
<< "Only one output stream is supported."; << "Only one output stream is supported.";
@ -125,7 +126,7 @@ absl::Status VectorFloatToTensorCalculator::Process(CalculatorContext* cc) {
} }
cc->Outputs().Index(0).Add(output.release(), cc->InputTimestamp()); cc->Outputs().Index(0).Add(output.release(), cc->InputTimestamp());
} else { } else {
LOG(FATAL) << "input size not supported"; ABSL_LOG(FATAL) << "input size not supported";
} }
return absl::OkStatus(); return absl::OkStatus();
} }

View File

@ -15,6 +15,7 @@
// Converts a single int or vector<int> or vector<vector<int>> to 1D (or 2D) // Converts a single int or vector<int> or vector<vector<int>> to 1D (or 2D)
// tf::Tensor. // tf::Tensor.
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/tensorflow/vector_int_to_tensor_calculator_options.pb.h" #include "mediapipe/calculators/tensorflow/vector_int_to_tensor_calculator_options.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
@ -86,7 +87,7 @@ absl::Status VectorIntToTensorCalculator::GetContract(CalculatorContract* cc) {
cc->Inputs().Tag(kVectorInt).Set<std::vector<int>>(); cc->Inputs().Tag(kVectorInt).Set<std::vector<int>>();
} }
} else { } else {
LOG(FATAL) << "input size not supported"; ABSL_LOG(FATAL) << "input size not supported";
} }
RET_CHECK_EQ(cc->Outputs().NumEntries(), 1) RET_CHECK_EQ(cc->Outputs().NumEntries(), 1)
<< "Only one output stream is supported."; << "Only one output stream is supported.";
@ -140,7 +141,7 @@ absl::Status VectorIntToTensorCalculator::Process(CalculatorContext* cc) {
AssignMatrixValue<int>(c, r, input[r][c], output.get()); AssignMatrixValue<int>(c, r, input[r][c], output.get());
break; break;
default: default:
LOG(FATAL) << "tensor data type is not supported."; ABSL_LOG(FATAL) << "tensor data type is not supported.";
} }
} }
} }
@ -158,7 +159,7 @@ absl::Status VectorIntToTensorCalculator::Process(CalculatorContext* cc) {
AssignMatrixValue<int>(r, c, input[r][c], output.get()); AssignMatrixValue<int>(r, c, input[r][c], output.get());
break; break;
default: default:
LOG(FATAL) << "tensor data type is not supported."; ABSL_LOG(FATAL) << "tensor data type is not supported.";
} }
} }
} }
@ -188,12 +189,12 @@ absl::Status VectorIntToTensorCalculator::Process(CalculatorContext* cc) {
output->tensor<int, 1>()(i) = input.at(i); output->tensor<int, 1>()(i) = input.at(i);
break; break;
default: default:
LOG(FATAL) << "tensor data type is not supported."; ABSL_LOG(FATAL) << "tensor data type is not supported.";
} }
} }
cc->Outputs().Tag(kTensorOut).Add(output.release(), cc->InputTimestamp()); cc->Outputs().Tag(kTensorOut).Add(output.release(), cc->InputTimestamp());
} else { } else {
LOG(FATAL) << "input size not supported"; ABSL_LOG(FATAL) << "input size not supported";
} }
return absl::OkStatus(); return absl::OkStatus();
} }

View File

@ -15,6 +15,7 @@
// Converts vector<std::string> (or vector<vector<std::string>>) to 1D (or 2D) // Converts vector<std::string> (or vector<vector<std::string>>) to 1D (or 2D)
// tf::Tensor. // tf::Tensor.
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/tensorflow/vector_string_to_tensor_calculator_options.pb.h" #include "mediapipe/calculators/tensorflow/vector_string_to_tensor_calculator_options.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
@ -69,7 +70,7 @@ absl::Status VectorStringToTensorCalculator::GetContract(
// Input vector<std::string>. // Input vector<std::string>.
); );
} else { } else {
LOG(FATAL) << "input size not supported"; ABSL_LOG(FATAL) << "input size not supported";
} }
RET_CHECK_EQ(cc->Outputs().NumEntries(), 1) RET_CHECK_EQ(cc->Outputs().NumEntries(), 1)
<< "Only one output stream is supported."; << "Only one output stream is supported.";
@ -129,7 +130,7 @@ absl::Status VectorStringToTensorCalculator::Process(CalculatorContext* cc) {
} }
cc->Outputs().Index(0).Add(output.release(), cc->InputTimestamp()); cc->Outputs().Index(0).Add(output.release(), cc->InputTimestamp());
} else { } else {
LOG(FATAL) << "input size not supported"; ABSL_LOG(FATAL) << "input size not supported";
} }
return absl::OkStatus(); return absl::OkStatus();
} }

View File

@ -103,6 +103,7 @@ cc_library(
"//mediapipe/framework/formats/object_detection:anchor_cc_proto", "//mediapipe/framework/formats/object_detection:anchor_cc_proto",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
], ],
alwayslink = 1, alwayslink = 1,
) )
@ -196,10 +197,12 @@ cc_library(
deps = [ deps = [
":tflite_inference_calculator_cc_proto", ":tflite_inference_calculator_cc_proto",
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/stream_handler:fixed_size_input_stream_handler", "//mediapipe/framework/stream_handler:fixed_size_input_stream_handler",
"//mediapipe/util/tflite:config", "//mediapipe/util/tflite:config",
"//mediapipe/util/tflite:tflite_model_loader", "//mediapipe/util/tflite:tflite_model_loader",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@org_tensorflow//tensorflow/lite:framework", "@org_tensorflow//tensorflow/lite:framework",
"@org_tensorflow//tensorflow/lite/delegates/xnnpack:xnnpack_delegate", "@org_tensorflow//tensorflow/lite/delegates/xnnpack:xnnpack_delegate",
@ -392,6 +395,7 @@ cc_library(
"//mediapipe/framework/formats/object_detection:anchor_cc_proto", "//mediapipe/framework/formats/object_detection:anchor_cc_proto",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/util/tflite:config", "//mediapipe/util/tflite:config",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/types:span", "@com_google_absl//absl/types:span",
"@org_tensorflow//tensorflow/lite:framework", "@org_tensorflow//tensorflow/lite:framework",

View File

@ -16,6 +16,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/tflite/ssd_anchors_calculator.pb.h" #include "mediapipe/calculators/tflite/ssd_anchors_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/object_detection/anchor.pb.h" #include "mediapipe/framework/formats/object_detection/anchor.pb.h"
@ -272,7 +273,7 @@ absl::Status SsdAnchorsCalculator::GenerateAnchors(
if (options.feature_map_height_size()) { if (options.feature_map_height_size()) {
if (options.strides_size()) { if (options.strides_size()) {
LOG(ERROR) << "Found feature map shapes. Strides will be ignored."; ABSL_LOG(ERROR) << "Found feature map shapes. Strides will be ignored.";
} }
CHECK_EQ(options.feature_map_height_size(), kNumLayers); CHECK_EQ(options.feature_map_height_size(), kNumLayers);
CHECK_EQ(options.feature_map_height_size(), CHECK_EQ(options.feature_map_height_size(),

View File

@ -17,9 +17,11 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "mediapipe/calculators/tflite/tflite_inference_calculator.pb.h" #include "mediapipe/calculators/tflite/tflite_inference_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/util/tflite/config.h" #include "mediapipe/util/tflite/config.h"
@ -406,8 +408,9 @@ absl::Status TfLiteInferenceCalculator::Open(CalculatorContext* cc) {
} }
if (use_advanced_gpu_api_ && !gpu_input_) { if (use_advanced_gpu_api_ && !gpu_input_) {
LOG(WARNING) << "Cannot use advanced GPU APIs, input must be GPU buffers." ABSL_LOG(WARNING)
"Falling back to the default TFLite API."; << "Cannot use advanced GPU APIs, input must be GPU buffers."
"Falling back to the default TFLite API.";
use_advanced_gpu_api_ = false; use_advanced_gpu_api_ = false;
} }
CHECK(!use_advanced_gpu_api_ || gpu_inference_); CHECK(!use_advanced_gpu_api_ || gpu_inference_);
@ -1053,7 +1056,7 @@ absl::Status TfLiteInferenceCalculator::LoadDelegate(CalculatorContext* cc) {
gpu_data_in_[i]->shape.w * gpu_data_in_[i]->shape.c; gpu_data_in_[i]->shape.w * gpu_data_in_[i]->shape.c;
// Input to model can be RGBA only. // Input to model can be RGBA only.
if (tensor->dims->data[3] != 4) { if (tensor->dims->data[3] != 4) {
LOG(WARNING) << "Please ensure input GPU tensor is 4 channels."; ABSL_LOG(WARNING) << "Please ensure input GPU tensor is 4 channels.";
} }
const std::string shader_source = const std::string shader_source =
absl::Substitute(R"(#include <metal_stdlib> absl::Substitute(R"(#include <metal_stdlib>

View File

@ -15,6 +15,7 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "absl/types/span.h" #include "absl/types/span.h"
#include "mediapipe/calculators/tflite/tflite_tensors_to_detections_calculator.pb.h" #include "mediapipe/calculators/tflite/tflite_tensors_to_detections_calculator.pb.h"
@ -541,7 +542,7 @@ absl::Status TfLiteTensorsToDetectionsCalculator::ProcessGPU(
output_detections)); output_detections));
#else #else
LOG(ERROR) << "GPU input on non-Android not supported yet."; ABSL_LOG(ERROR) << "GPU input on non-Android not supported yet.";
#endif // MEDIAPIPE_TFLITE_GL_INFERENCE #endif // MEDIAPIPE_TFLITE_GL_INFERENCE
return absl::OkStatus(); return absl::OkStatus();
} }

View File

@ -183,9 +183,9 @@ cc_library(
"//mediapipe/framework:calculator_options_cc_proto", "//mediapipe/framework:calculator_options_cc_proto",
"//mediapipe/framework:timestamp", "//mediapipe/framework:timestamp",
"//mediapipe/framework/deps:clock", "//mediapipe/framework/deps:clock",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/time", "@com_google_absl//absl/time",
], ],
@ -254,7 +254,6 @@ cc_library(
"//mediapipe/framework/formats:image_frame_opencv", "//mediapipe/framework/formats:image_frame_opencv",
"//mediapipe/framework/formats:image_opencv", "//mediapipe/framework/formats:image_opencv",
"//mediapipe/framework/formats:video_stream_header", "//mediapipe/framework/formats:video_stream_header",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:opencv_core", "//mediapipe/framework/port:opencv_core",
"//mediapipe/framework/port:opencv_imgproc", "//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
@ -262,6 +261,7 @@ cc_library(
"//mediapipe/util:annotation_renderer", "//mediapipe/util:annotation_renderer",
"//mediapipe/util:color_cc_proto", "//mediapipe/util:color_cc_proto",
"//mediapipe/util:render_data_cc_proto", "//mediapipe/util:render_data_cc_proto",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
] + select({ ] + select({
"//mediapipe/gpu:disable_gpu": [], "//mediapipe/gpu:disable_gpu": [],
@ -376,9 +376,9 @@ cc_library(
"//mediapipe/framework/formats:detection_cc_proto", "//mediapipe/framework/formats:detection_cc_proto",
"//mediapipe/framework/formats:image_frame", "//mediapipe/framework/formats:image_frame",
"//mediapipe/framework/formats:location", "//mediapipe/framework/formats:location",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:rectangle", "//mediapipe/framework/port:rectangle",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
], ],
alwayslink = 1, alwayslink = 1,
) )
@ -1151,6 +1151,7 @@ cc_library(
"//mediapipe/framework/port:file_helpers", "//mediapipe/framework/port:file_helpers",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
], ],
alwayslink = 1, alwayslink = 1,
) )

View File

@ -14,6 +14,7 @@
#include <memory> #include <memory>
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "mediapipe/calculators/util/annotation_overlay_calculator.pb.h" #include "mediapipe/calculators/util/annotation_overlay_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
@ -24,7 +25,6 @@
#include "mediapipe/framework/formats/image_frame_opencv.h" #include "mediapipe/framework/formats/image_frame_opencv.h"
#include "mediapipe/framework/formats/image_opencv.h" #include "mediapipe/framework/formats/image_opencv.h"
#include "mediapipe/framework/formats/video_stream_header.h" #include "mediapipe/framework/formats/video_stream_header.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/opencv_core_inc.h" #include "mediapipe/framework/port/opencv_core_inc.h"
#include "mediapipe/framework/port/opencv_imgproc_inc.h" #include "mediapipe/framework/port/opencv_imgproc_inc.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
@ -274,7 +274,8 @@ absl::Status AnnotationOverlayCalculator::Open(CalculatorContext* cc) {
renderer_->SetFlipTextVertically(options_.flip_text_vertically()); renderer_->SetFlipTextVertically(options_.flip_text_vertically());
if (use_gpu_) renderer_->SetScaleFactor(options_.gpu_scale_factor()); if (use_gpu_) renderer_->SetScaleFactor(options_.gpu_scale_factor());
if (renderer_->GetScaleFactor() < 1.0 && HasImageTag(cc)) if (renderer_->GetScaleFactor() < 1.0 && HasImageTag(cc))
LOG(WARNING) << "Annotation scale factor only supports GPU backed Image."; ABSL_LOG(WARNING)
<< "Annotation scale factor only supports GPU backed Image.";
// Set the output header based on the input header (if present). // Set the output header based on the input header (if present).
const char* tag = HasImageTag(cc) ? kImageTag const char* tag = HasImageTag(cc) ? kImageTag

View File

@ -15,6 +15,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "absl/log/absl_log.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/file_helpers.h" #include "mediapipe/framework/port/file_helpers.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
@ -58,7 +59,7 @@ class LocalFilePatternContentsCalculator : public CalculatorBase {
absl::Status Process(CalculatorContext* cc) override { absl::Status Process(CalculatorContext* cc) override {
if (current_output_ < filenames_.size()) { if (current_output_ < filenames_.size()) {
auto contents = absl::make_unique<std::string>(); auto contents = absl::make_unique<std::string>();
LOG(INFO) << filenames_[current_output_]; ABSL_LOG(INFO) << filenames_[current_output_];
MP_RETURN_IF_ERROR(mediapipe::file::GetContents( MP_RETURN_IF_ERROR(mediapipe::file::GetContents(
filenames_[current_output_], contents.get())); filenames_[current_output_], contents.get()));
++current_output_; ++current_output_;

View File

@ -18,12 +18,12 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/util/non_max_suppression_calculator.pb.h" #include "mediapipe/calculators/util/non_max_suppression_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/detection.pb.h" #include "mediapipe/framework/formats/detection.pb.h"
#include "mediapipe/framework/formats/image_frame.h" #include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/location.h" #include "mediapipe/framework/formats/location.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/rectangle.h" #include "mediapipe/framework/port/rectangle.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
@ -92,7 +92,7 @@ float OverlapSimilarity(
normalization = rect1.Area() + rect2.Area() - intersection_area; normalization = rect1.Area() + rect2.Area() - intersection_area;
break; break;
default: default:
LOG(FATAL) << "Unrecognized overlap type: " << overlap_type; ABSL_LOG(FATAL) << "Unrecognized overlap type: " << overlap_type;
} }
return normalization > 0.0f ? intersection_area / normalization : 0.0f; return normalization > 0.0f ? intersection_area / normalization : 0.0f;
} }

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/time/time.h" #include "absl/time/time.h"
#include "mediapipe/calculators/util/latency.pb.h" #include "mediapipe/calculators/util/latency.pb.h"
@ -20,7 +21,6 @@
#include "mediapipe/framework/calculator_options.pb.h" #include "mediapipe/framework/calculator_options.pb.h"
#include "mediapipe/framework/deps/clock.h" #include "mediapipe/framework/deps/clock.h"
#include "mediapipe/framework/deps/monotonic_clock.h" #include "mediapipe/framework/deps/monotonic_clock.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/timestamp.h" #include "mediapipe/framework/timestamp.h"
@ -237,7 +237,7 @@ absl::Status PacketLatencyCalculator::Process(CalculatorContext* cc) {
} }
if (first_process_time_usec_ < 0) { if (first_process_time_usec_ < 0) {
LOG(WARNING) << "No reference packet received."; ABSL_LOG(WARNING) << "No reference packet received.";
return absl::OkStatus(); return absl::OkStatus();
} }

View File

@ -132,6 +132,7 @@ cc_library(
"//mediapipe/framework/port:opencv_video", "//mediapipe/framework/port:opencv_video",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/tool:status_util", "//mediapipe/framework/tool:status_util",
"@com_google_absl//absl/log:absl_log",
], ],
alwayslink = 1, alwayslink = 1,
) )
@ -153,6 +154,7 @@ cc_library(
"//mediapipe/framework/port:source_location", "//mediapipe/framework/port:source_location",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/tool:status_util", "//mediapipe/framework/tool:status_util",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
alwayslink = 1, alwayslink = 1,
@ -193,6 +195,7 @@ cc_library(
"//mediapipe/util/tracking:motion_estimation", "//mediapipe/util/tracking:motion_estimation",
"//mediapipe/util/tracking:motion_models", "//mediapipe/util/tracking:motion_models",
"//mediapipe/util/tracking:region_flow_cc_proto", "//mediapipe/util/tracking:region_flow_cc_proto",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
alwayslink = 1, alwayslink = 1,
@ -205,10 +208,10 @@ cc_library(
":flow_packager_calculator_cc_proto", ":flow_packager_calculator_cc_proto",
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging",
"//mediapipe/util/tracking:camera_motion_cc_proto", "//mediapipe/util/tracking:camera_motion_cc_proto",
"//mediapipe/util/tracking:flow_packager", "//mediapipe/util/tracking:flow_packager",
"//mediapipe/util/tracking:region_flow_cc_proto", "//mediapipe/util/tracking:region_flow_cc_proto",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format", "@com_google_absl//absl/strings:str_format",
], ],
@ -225,7 +228,6 @@ cc_library(
"//mediapipe/framework/formats:image_frame_opencv", "//mediapipe/framework/formats:image_frame_opencv",
"//mediapipe/framework/formats:video_stream_header", # fixdeps: keep -- required for exobazel build. "//mediapipe/framework/formats:video_stream_header", # fixdeps: keep -- required for exobazel build.
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:parse_text_proto", "//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
@ -236,6 +238,7 @@ cc_library(
"@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/container:node_hash_map", "@com_google_absl//absl/container:node_hash_map",
"@com_google_absl//absl/container:node_hash_set", "@com_google_absl//absl/container:node_hash_set",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
alwayslink = 1, alwayslink = 1,
@ -251,7 +254,6 @@ cc_library(
"//mediapipe/framework/formats:image_frame_opencv", "//mediapipe/framework/formats:image_frame_opencv",
"//mediapipe/framework/formats:video_stream_header", # fixdeps: keep -- required for exobazel build. "//mediapipe/framework/formats:video_stream_header", # fixdeps: keep -- required for exobazel build.
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:opencv_core", "//mediapipe/framework/port:opencv_core",
"//mediapipe/framework/port:opencv_features2d", "//mediapipe/framework/port:opencv_features2d",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
@ -263,6 +265,7 @@ cc_library(
"//mediapipe/util/tracking:box_tracker_cc_proto", "//mediapipe/util/tracking:box_tracker_cc_proto",
"//mediapipe/util/tracking:flow_packager_cc_proto", "//mediapipe/util/tracking:flow_packager_cc_proto",
"//mediapipe/util/tracking:tracking_visualization_utilities", "//mediapipe/util/tracking:tracking_visualization_utilities",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
] + select({ ] + select({
@ -359,12 +362,12 @@ cc_test(
"//mediapipe/framework/formats:video_stream_header", "//mediapipe/framework/formats:video_stream_header",
"//mediapipe/framework/port:gtest_main", "//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:opencv_highgui", "//mediapipe/framework/port:opencv_highgui",
"//mediapipe/framework/port:opencv_imgproc", "//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:opencv_video", "//mediapipe/framework/port:opencv_video",
"//mediapipe/framework/port:parse_text_proto", "//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/tool:test_util", "//mediapipe/framework/tool:test_util",
"@com_google_absl//absl/log:absl_log",
], ],
) )
@ -448,6 +451,7 @@ cc_test(
"//mediapipe/framework/tool:test_util", "//mediapipe/framework/tool:test_util",
"//mediapipe/util/tracking:box_tracker_cc_proto", "//mediapipe/util/tracking:box_tracker_cc_proto",
"//mediapipe/util/tracking:tracking_cc_proto", "//mediapipe/util/tracking:tracking_cc_proto",
"@com_google_absl//absl/log:absl_log",
], ],
) )

View File

@ -17,6 +17,7 @@
#include <memory> #include <memory>
#include <unordered_set> #include <unordered_set>
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/strings/numbers.h" #include "absl/strings/numbers.h"
#include "mediapipe/calculators/video/box_detector_calculator.pb.h" #include "mediapipe/calculators/video/box_detector_calculator.pb.h"
@ -25,7 +26,6 @@
#include "mediapipe/framework/formats/image_frame_opencv.h" #include "mediapipe/framework/formats/image_frame_opencv.h"
#include "mediapipe/framework/formats/video_stream_header.h" #include "mediapipe/framework/formats/video_stream_header.h"
#include "mediapipe/framework/port/integral_types.h" #include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/opencv_core_inc.h" #include "mediapipe/framework/port/opencv_core_inc.h"
#include "mediapipe/framework/port/opencv_features2d_inc.h" #include "mediapipe/framework/port/opencv_features2d_inc.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
@ -198,7 +198,8 @@ absl::Status BoxDetectorCalculator::Open(CalculatorContext* cc) {
if (!predefined_index.ParseFromString(cc->InputSidePackets() if (!predefined_index.ParseFromString(cc->InputSidePackets()
.Tag(kIndexProtoStringTag) .Tag(kIndexProtoStringTag)
.Get<std::string>())) { .Get<std::string>())) {
LOG(FATAL) << "failed to parse BoxDetectorIndex from INDEX_PROTO_STRING"; ABSL_LOG(FATAL)
<< "failed to parse BoxDetectorIndex from INDEX_PROTO_STRING";
} }
box_detector_->AddBoxDetectorIndex(predefined_index); box_detector_->AddBoxDetectorIndex(predefined_index);
} }
@ -210,7 +211,7 @@ absl::Status BoxDetectorCalculator::Open(CalculatorContext* cc) {
MP_RETURN_IF_ERROR(file::GetContents(string_path, &index_string)); MP_RETURN_IF_ERROR(file::GetContents(string_path, &index_string));
BoxDetectorIndex predefined_index; BoxDetectorIndex predefined_index;
if (!predefined_index.ParseFromString(index_string)) { if (!predefined_index.ParseFromString(index_string)) {
LOG(FATAL) ABSL_LOG(FATAL)
<< "failed to parse BoxDetectorIndex from index_proto_filename"; << "failed to parse BoxDetectorIndex from index_proto_filename";
} }
box_detector_->AddBoxDetectorIndex(predefined_index); box_detector_->AddBoxDetectorIndex(predefined_index);
@ -248,7 +249,7 @@ absl::Status BoxDetectorCalculator::Process(CalculatorContext* cc) {
BoxDetectorIndex predefined_index; BoxDetectorIndex predefined_index;
if (!predefined_index.ParseFromString( if (!predefined_index.ParseFromString(
add_index_stream->Get<std::string>())) { add_index_stream->Get<std::string>())) {
LOG(FATAL) << "failed to parse BoxDetectorIndex from ADD_INDEX"; ABSL_LOG(FATAL) << "failed to parse BoxDetectorIndex from ADD_INDEX";
} }
box_detector_->AddBoxDetectorIndex(predefined_index); box_detector_->AddBoxDetectorIndex(predefined_index);
} }

View File

@ -22,6 +22,7 @@
#include "absl/container/flat_hash_set.h" #include "absl/container/flat_hash_set.h"
#include "absl/container/node_hash_map.h" #include "absl/container/node_hash_map.h"
#include "absl/container/node_hash_set.h" #include "absl/container/node_hash_set.h"
#include "absl/log/absl_log.h"
#include "absl/strings/numbers.h" #include "absl/strings/numbers.h"
#include "mediapipe/calculators/video/box_tracker_calculator.pb.h" #include "mediapipe/calculators/video/box_tracker_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
@ -29,7 +30,6 @@
#include "mediapipe/framework/formats/image_frame_opencv.h" #include "mediapipe/framework/formats/image_frame_opencv.h"
#include "mediapipe/framework/formats/video_stream_header.h" #include "mediapipe/framework/formats/video_stream_header.h"
#include "mediapipe/framework/port/integral_types.h" #include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/parse_text_proto.h" #include "mediapipe/framework/port/parse_text_proto.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
@ -358,7 +358,7 @@ void ConvertCoordinateForRotation(float in_top, float in_left, float in_bottom,
out_height = in_width; out_height = in_width;
break; break;
default: default:
LOG(ERROR) << "invalid rotation " << rotation; ABSL_LOG(ERROR) << "invalid rotation " << rotation;
out_center_x = in_center_x; out_center_x = in_center_x;
out_center_y = in_center_y; out_center_y = in_center_y;
out_width = in_width; out_width = in_width;
@ -384,7 +384,8 @@ void AddStateToPath(const MotionBoxState& state, int64_t time_msec,
path->insert(insert_pos, path->insert(insert_pos,
InternalTimedBox(result, new MotionBoxState(state))); InternalTimedBox(result, new MotionBoxState(state)));
} else { } else {
LOG(ERROR) << "Box at time " << time_msec << " already present; ignoring"; ABSL_LOG(ERROR) << "Box at time " << time_msec
<< " already present; ignoring";
} }
} }
@ -486,8 +487,9 @@ absl::Status BoxTrackerCalculator::Open(CalculatorContext* cc) {
#if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__) #if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
if (cc->InputSidePackets().HasTag(kInitialPosTag)) { if (cc->InputSidePackets().HasTag(kInitialPosTag)) {
LOG(INFO) << "Parsing: " ABSL_LOG(INFO)
<< cc->InputSidePackets().Tag(kInitialPosTag).Get<std::string>(); << "Parsing: "
<< cc->InputSidePackets().Tag(kInitialPosTag).Get<std::string>();
initial_pos_ = ParseTextProtoOrDie<TimedBoxProtoList>( initial_pos_ = ParseTextProtoOrDie<TimedBoxProtoList>(
cc->InputSidePackets().Tag(kInitialPosTag).Get<std::string>()); cc->InputSidePackets().Tag(kInitialPosTag).Get<std::string>());
} }
@ -624,7 +626,7 @@ absl::Status BoxTrackerCalculator::Process(CalculatorContext* cc) {
if (cancel_object_id_stream && !cancel_object_id_stream->IsEmpty()) { if (cancel_object_id_stream && !cancel_object_id_stream->IsEmpty()) {
const int cancel_object_id = cancel_object_id_stream->Get<int>(); const int cancel_object_id = cancel_object_id_stream->Get<int>();
if (streaming_motion_boxes_.erase(cancel_object_id) == 0) { if (streaming_motion_boxes_.erase(cancel_object_id) == 0) {
LOG(WARNING) << "box id " << cancel_object_id << " does not exist."; ABSL_LOG(WARNING) << "box id " << cancel_object_id << " does not exist.";
} }
} }
@ -944,7 +946,7 @@ void BoxTrackerCalculator::OutputRandomAccessTrack(
const bool forward_track = start.time_msec() < end_time_msec; const bool forward_track = start.time_msec() < end_time_msec;
if (track_timestamps_.empty()) { if (track_timestamps_.empty()) {
LOG(WARNING) << "No tracking data cached yet."; ABSL_LOG(WARNING) << "No tracking data cached yet.";
continue; continue;
} }
@ -954,27 +956,27 @@ void BoxTrackerCalculator::OutputRandomAccessTrack(
const int64_t tracking_end_timestamp_msec = const int64_t tracking_end_timestamp_msec =
track_timestamps_.back().Microseconds() / 1000; track_timestamps_.back().Microseconds() / 1000;
if (start.time_msec() < tracking_start_timestamp_msec) { if (start.time_msec() < tracking_start_timestamp_msec) {
LOG(WARNING) << "Request start timestamp " << start.time_msec() ABSL_LOG(WARNING) << "Request start timestamp " << start.time_msec()
<< " too old. First frame in the window: " << " too old. First frame in the window: "
<< tracking_start_timestamp_msec; << tracking_start_timestamp_msec;
continue; continue;
} }
if (start.time_msec() > tracking_end_timestamp_msec) { if (start.time_msec() > tracking_end_timestamp_msec) {
LOG(WARNING) << "Request start timestamp " << start.time_msec() ABSL_LOG(WARNING) << "Request start timestamp " << start.time_msec()
<< " too new. Last frame in the window: " << " too new. Last frame in the window: "
<< tracking_end_timestamp_msec; << tracking_end_timestamp_msec;
continue; continue;
} }
if (end_time_msec < tracking_start_timestamp_msec) { if (end_time_msec < tracking_start_timestamp_msec) {
LOG(WARNING) << "Request end timestamp " << end_time_msec ABSL_LOG(WARNING) << "Request end timestamp " << end_time_msec
<< " too old. First frame in the window: " << " too old. First frame in the window: "
<< tracking_start_timestamp_msec; << tracking_start_timestamp_msec;
continue; continue;
} }
if (end_time_msec > tracking_end_timestamp_msec) { if (end_time_msec > tracking_end_timestamp_msec) {
LOG(WARNING) << "Request end timestamp " << end_time_msec ABSL_LOG(WARNING) << "Request end timestamp " << end_time_msec
<< " too new. Last frame in the window: " << " too new. Last frame in the window: "
<< tracking_end_timestamp_msec; << tracking_end_timestamp_msec;
continue; continue;
} }
@ -982,7 +984,7 @@ void BoxTrackerCalculator::OutputRandomAccessTrack(
GetRandomAccessTimestampPos(start, forward_track); GetRandomAccessTimestampPos(start, forward_track);
if (timestamp_pos == track_timestamps_.end()) { if (timestamp_pos == track_timestamps_.end()) {
LOG(ERROR) << "Random access outside cached range"; ABSL_LOG(ERROR) << "Random access outside cached range";
continue; continue;
} }
@ -993,7 +995,7 @@ void BoxTrackerCalculator::OutputRandomAccessTrack(
// TODO: Interpolate random access tracking start_data instead // TODO: Interpolate random access tracking start_data instead
// of dropping the request in the case of missing processed frame. // of dropping the request in the case of missing processed frame.
if (start_data == tracking_data_cache_.end()) { if (start_data == tracking_data_cache_.end()) {
LOG(ERROR) << "Random access starts at unprocessed frame."; ABSL_LOG(ERROR) << "Random access starts at unprocessed frame.";
continue; continue;
} }
@ -1010,7 +1012,7 @@ void BoxTrackerCalculator::OutputRandomAccessTrack(
&single_map, end_time_msec); &single_map, end_time_msec);
if (track_error) { if (track_error) {
LOG(ERROR) << "Could not track box."; ABSL_LOG(ERROR) << "Could not track box.";
continue; continue;
} }
@ -1197,7 +1199,7 @@ void BoxTrackerCalculator::StreamTrack(const TrackingData& data,
if (!motion_box.second.box.TrackStep(from_frame, // from frame. if (!motion_box.second.box.TrackStep(from_frame, // from frame.
mvf, forward)) { mvf, forward)) {
failed_ids->push_back(motion_box.first); failed_ids->push_back(motion_box.first);
LOG(INFO) << "lost track. pushed failed id: " << motion_box.first; ABSL_LOG(INFO) << "lost track. pushed failed id: " << motion_box.first;
} else { } else {
// Store result. // Store result.
PathSegment& path = motion_box.second.path; PathSegment& path = motion_box.second.path;
@ -1224,8 +1226,8 @@ void BoxTrackerCalculator::FastForwardStartPos(
track_timestamps_.end(), timestamp); track_timestamps_.end(), timestamp);
if (timestamp_pos == track_timestamps_.end()) { if (timestamp_pos == track_timestamps_.end()) {
LOG(WARNING) << "Received start pos beyond current timestamp, " ABSL_LOG(WARNING) << "Received start pos beyond current timestamp, "
<< "Starting to track once frame arrives."; << "Starting to track once frame arrives.";
*initial_pos_.add_box() = start_pos; *initial_pos_.add_box() = start_pos;
continue; continue;
} }
@ -1242,8 +1244,9 @@ void BoxTrackerCalculator::FastForwardStartPos(
-> bool { return item.first == timestamp_pos[0]; }); -> bool { return item.first == timestamp_pos[0]; });
if (start_data == tracking_data_cache_.end()) { if (start_data == tracking_data_cache_.end()) {
LOG(ERROR) << "Box to fast forward outside tracking data cache. Ignoring." ABSL_LOG(ERROR)
<< " To avoid this error consider increasing the cache size."; << "Box to fast forward outside tracking data cache. Ignoring."
<< " To avoid this error consider increasing the cache size.";
continue; continue;
} }
@ -1281,7 +1284,8 @@ void BoxTrackerCalculator::FastForwardStartPos(
true, // forward true, // forward
&single_map, &failed_box); &single_map, &failed_box);
if (!failed_box.empty()) { if (!failed_box.empty()) {
LOG(WARNING) << "Unable to fast forward box at frame " << curr_frame; ABSL_LOG(WARNING) << "Unable to fast forward box at frame "
<< curr_frame;
track_error = true; track_error = true;
break; break;
} }

View File

@ -17,12 +17,12 @@
#include <fstream> #include <fstream>
#include <memory> #include <memory>
#include "absl/log/absl_log.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "mediapipe/calculators/video/flow_packager_calculator.pb.h" #include "mediapipe/calculators/video/flow_packager_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/integral_types.h" #include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/util/tracking/camera_motion.pb.h" #include "mediapipe/util/tracking/camera_motion.pb.h"
#include "mediapipe/util/tracking/flow_packager.h" #include "mediapipe/util/tracking/flow_packager.h"
#include "mediapipe/util/tracking/region_flow.pb.h" #include "mediapipe/util/tracking/region_flow.pb.h"
@ -227,10 +227,11 @@ absl::Status FlowPackagerCalculator::Close(CalculatorContext* cc) {
void FlowPackagerCalculator::WriteChunk(const TrackingDataChunk& chunk) const { void FlowPackagerCalculator::WriteChunk(const TrackingDataChunk& chunk) const {
if (chunk.item_size() == 0) { if (chunk.item_size() == 0) {
LOG(ERROR) << "Write chunk called with empty tracking data." ABSL_LOG(ERROR)
<< "This can only occur if the spacing between frames " << "Write chunk called with empty tracking data."
<< "is larger than the requested chunk size. Try increasing " << "This can only occur if the spacing between frames "
<< "the chunk size"; << "is larger than the requested chunk size. Try increasing "
<< "the chunk size";
return; return;
} }
@ -242,7 +243,7 @@ void FlowPackagerCalculator::WriteChunk(const TrackingDataChunk& chunk) const {
chunk_file = chunk_file =
cache_dir_ + "/" + absl::StrFormat(*format_runtime, chunk_idx_); cache_dir_ + "/" + absl::StrFormat(*format_runtime, chunk_idx_);
} else { } else {
LOG(ERROR) << "chache_file_format wrong. fall back to chunk_%04d."; ABSL_LOG(ERROR) << "chache_file_format wrong. fall back to chunk_%04d.";
chunk_file = cache_dir_ + "/" + absl::StrFormat("chunk_%04d", chunk_idx_); chunk_file = cache_dir_ + "/" + absl::StrFormat("chunk_%04d", chunk_idx_);
} }
@ -252,23 +253,23 @@ void FlowPackagerCalculator::WriteChunk(const TrackingDataChunk& chunk) const {
const char* temp_filename = tempnam(cache_dir_.c_str(), nullptr); const char* temp_filename = tempnam(cache_dir_.c_str(), nullptr);
std::ofstream out_file(temp_filename); std::ofstream out_file(temp_filename);
if (!out_file) { if (!out_file) {
LOG(ERROR) << "Could not open " << temp_filename; ABSL_LOG(ERROR) << "Could not open " << temp_filename;
} else { } else {
out_file.write(data.data(), data.size()); out_file.write(data.data(), data.size());
} }
if (rename(temp_filename, chunk_file.c_str()) != 0) { if (rename(temp_filename, chunk_file.c_str()) != 0) {
LOG(ERROR) << "Failed to rename to " << chunk_file; ABSL_LOG(ERROR) << "Failed to rename to " << chunk_file;
} }
LOG(INFO) << "Wrote chunk : " << chunk_file; ABSL_LOG(INFO) << "Wrote chunk : " << chunk_file;
} }
void FlowPackagerCalculator::PrepareCurrentForNextChunk( void FlowPackagerCalculator::PrepareCurrentForNextChunk(
TrackingDataChunk* chunk) { TrackingDataChunk* chunk) {
CHECK(chunk); CHECK(chunk);
if (chunk->item_size() == 0) { if (chunk->item_size() == 0) {
LOG(ERROR) << "Called with empty chunk. Unexpected."; ABSL_LOG(ERROR) << "Called with empty chunk. Unexpected.";
return; return;
} }

View File

@ -17,6 +17,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "absl/log/absl_log.h"
#include "absl/strings/numbers.h" #include "absl/strings/numbers.h"
#include "absl/strings/str_split.h" #include "absl/strings/str_split.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
@ -348,8 +349,8 @@ absl::Status MotionAnalysisCalculator::Open(CalculatorContext* cc) {
video_header = video_header =
&(cc->Inputs().Tag(kSelectionTag).Header().Get<VideoHeader>()); &(cc->Inputs().Tag(kSelectionTag).Header().Get<VideoHeader>());
} else { } else {
LOG(WARNING) << "No input video header found. Downstream calculators " ABSL_LOG(WARNING) << "No input video header found. Downstream calculators "
"expecting video headers are likely to fail."; "expecting video headers are likely to fail.";
} }
with_saliency_ = options_.analysis_options().compute_motion_saliency(); with_saliency_ = options_.analysis_options().compute_motion_saliency();
@ -357,9 +358,9 @@ absl::Status MotionAnalysisCalculator::Open(CalculatorContext* cc) {
if (cc->Outputs().HasTag(kSaliencyTag)) { if (cc->Outputs().HasTag(kSaliencyTag)) {
with_saliency_ = true; with_saliency_ = true;
if (!options_.analysis_options().compute_motion_saliency()) { if (!options_.analysis_options().compute_motion_saliency()) {
LOG(WARNING) << "Enable saliency computation. Set " ABSL_LOG(WARNING) << "Enable saliency computation. Set "
<< "compute_motion_saliency to true to silence this " << "compute_motion_saliency to true to silence this "
<< "warning."; << "warning.";
options_.mutable_analysis_options()->set_compute_motion_saliency(true); options_.mutable_analysis_options()->set_compute_motion_saliency(true);
} }
} }
@ -603,8 +604,8 @@ absl::Status MotionAnalysisCalculator::Close(CalculatorContext* cc) {
} }
if (csv_file_input_) { if (csv_file_input_) {
if (!meta_motions_.empty()) { if (!meta_motions_.empty()) {
LOG(ERROR) << "More motions than frames. Unexpected! Remainder: " ABSL_LOG(ERROR) << "More motions than frames. Unexpected! Remainder: "
<< meta_motions_.size(); << meta_motions_.size();
} }
} }
return absl::OkStatus(); return absl::OkStatus();
@ -741,8 +742,8 @@ absl::Status MotionAnalysisCalculator::InitOnProcess(
} }
if (region_options->image_format() != image_format && if (region_options->image_format() != image_format &&
region_options->image_format() != image_format2) { region_options->image_format() != image_format2) {
LOG(WARNING) << "Requested image format in RegionFlowComputation " ABSL_LOG(WARNING) << "Requested image format in RegionFlowComputation "
<< "does not match video stream format. Overriding."; << "does not match video stream format. Overriding.";
region_options->set_image_format(image_format); region_options->set_image_format(image_format);
} }
@ -761,7 +762,7 @@ absl::Status MotionAnalysisCalculator::InitOnProcess(
frame_width_ = camera_motion.frame_width(); frame_width_ = camera_motion.frame_width();
frame_height_ = camera_motion.frame_height(); frame_height_ = camera_motion.frame_height();
} else { } else {
LOG(FATAL) << "Either VIDEO or SELECTION stream need to be specified."; ABSL_LOG(FATAL) << "Either VIDEO or SELECTION stream need to be specified.";
} }
// Filled by CSV file parsing. // Filled by CSV file parsing.
@ -800,7 +801,7 @@ bool MotionAnalysisCalculator::ParseModelCSV(
for (const auto& value : values) { for (const auto& value : values) {
double value_64f; double value_64f;
if (!absl::SimpleAtod(value, &value_64f)) { if (!absl::SimpleAtod(value, &value_64f)) {
LOG(ERROR) << "Not a double, expected!"; ABSL_LOG(ERROR) << "Not a double, expected!";
return false; return false;
} }
@ -818,7 +819,7 @@ bool MotionAnalysisCalculator::HomographiesFromValues(
// Obvious constants are obvious :D // Obvious constants are obvious :D
constexpr int kHomographyValues = 9; constexpr int kHomographyValues = 9;
if (homog_values.size() % kHomographyValues != 0) { if (homog_values.size() % kHomographyValues != 0) {
LOG(ERROR) << "Contents not a multiple of " << kHomographyValues; ABSL_LOG(ERROR) << "Contents not a multiple of " << kHomographyValues;
return false; return false;
} }
@ -830,7 +831,7 @@ bool MotionAnalysisCalculator::HomographiesFromValues(
// Normalize last entry to 1. // Normalize last entry to 1.
if (h_vals[kHomographyValues - 1] == 0) { if (h_vals[kHomographyValues - 1] == 0) {
LOG(ERROR) << "Degenerate homography, last entry is zero"; ABSL_LOG(ERROR) << "Degenerate homography, last entry is zero";
return false; return false;
} }
@ -844,8 +845,8 @@ bool MotionAnalysisCalculator::HomographiesFromValues(
} }
if (homographies->size() % options_.meta_models_per_frame() != 0) { if (homographies->size() % options_.meta_models_per_frame() != 0) {
LOG(ERROR) << "Total homographies not a multiple of specified models " ABSL_LOG(ERROR) << "Total homographies not a multiple of specified models "
<< "per frame."; << "per frame.";
return false; return false;
} }

View File

@ -14,6 +14,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "absl/log/absl_log.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/image_format.pb.h" #include "mediapipe/framework/formats/image_format.pb.h"
#include "mediapipe/framework/formats/image_frame.h" #include "mediapipe/framework/formats/image_frame.h"
@ -168,9 +169,10 @@ class OpenCvVideoDecoderCalculator : public CalculatorBase {
.Tag(kSavedAudioPathTag) .Tag(kSavedAudioPathTag)
.Set(MakePacket<std::string>(saved_audio_path)); .Set(MakePacket<std::string>(saved_audio_path));
} else { } else {
LOG(WARNING) << "FFmpeg can't extract audio from " << input_file_path ABSL_LOG(WARNING) << "FFmpeg can't extract audio from "
<< " by executing the following command: " << input_file_path
<< ffmpeg_command; << " by executing the following command: "
<< ffmpeg_command;
cc->OutputSidePackets() cc->OutputSidePackets()
.Tag(kSavedAudioPathTag) .Tag(kSavedAudioPathTag)
.Set(MakePacket<std::string>(std::string())); .Set(MakePacket<std::string>(std::string()));
@ -227,9 +229,9 @@ class OpenCvVideoDecoderCalculator : public CalculatorBase {
cap_->release(); cap_->release();
} }
if (decoded_frames_ != frame_count_) { if (decoded_frames_ != frame_count_) {
LOG(WARNING) << "Not all the frames are decoded (total frames: " ABSL_LOG(WARNING) << "Not all the frames are decoded (total frames: "
<< frame_count_ << " vs decoded frames: " << decoded_frames_ << frame_count_
<< ")."; << " vs decoded frames: " << decoded_frames_ << ").";
} }
return absl::OkStatus(); return absl::OkStatus();
} }

View File

@ -18,6 +18,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "absl/strings/str_split.h" #include "absl/strings/str_split.h"
#include "mediapipe/calculators/video/opencv_video_encoder_calculator.pb.h" #include "mediapipe/calculators/video/opencv_video_encoder_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
@ -187,9 +188,10 @@ absl::Status OpenCvVideoEncoderCalculator::Close(CalculatorContext* cc) {
const std::string& audio_file_path = const std::string& audio_file_path =
cc->InputSidePackets().Tag(kAudioFilePathTag).Get<std::string>(); cc->InputSidePackets().Tag(kAudioFilePathTag).Get<std::string>();
if (audio_file_path.empty()) { if (audio_file_path.empty()) {
LOG(WARNING) << "OpenCvVideoEncoderCalculator isn't able to attach the " ABSL_LOG(WARNING)
"audio tracks to the generated video because the audio " << "OpenCvVideoEncoderCalculator isn't able to attach the "
"file path is not specified."; "audio tracks to the generated video because the audio "
"file path is not specified.";
} else { } else {
// A temp output file is needed because FFmpeg can't do in-place editing. // A temp output file is needed because FFmpeg can't do in-place editing.
const std::string temp_file_path = std::tmpnam(nullptr); const std::string temp_file_path = std::tmpnam(nullptr);

View File

@ -19,6 +19,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "mediapipe/calculators/video/box_tracker_calculator.pb.h" #include "mediapipe/calculators/video/box_tracker_calculator.pb.h"
#include "mediapipe/framework/calculator.pb.h" #include "mediapipe/framework/calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
@ -52,7 +53,7 @@ bool LoadBinaryTestGraph(const std::string& graph_path,
bool success = config->ParseFromZeroCopyStream(&in_stream); bool success = config->ParseFromZeroCopyStream(&in_stream);
ifs.close(); ifs.close();
if (!success) { if (!success) {
LOG(ERROR) << "could not parse test graph: " << graph_path; ABSL_LOG(ERROR) << "could not parse test graph: " << graph_path;
} }
return success; return success;
} }
@ -620,7 +621,7 @@ TEST_F(TrackingGraphTest, TestTransitionFramesForReacquisition) {
// Add TRACK_TIME stream queries in between 2 frames. // Add TRACK_TIME stream queries in between 2 frames.
if (j > 0) { if (j > 0) {
Timestamp track_time = Timestamp((j - 0.5f) * kFrameIntervalUs); Timestamp track_time = Timestamp((j - 0.5f) * kFrameIntervalUs);
LOG(INFO) << track_time.Value(); ABSL_LOG(INFO) << track_time.Value();
Packet track_time_packet = Adopt(new Timestamp).At(track_time); Packet track_time_packet = Adopt(new Timestamp).At(track_time);
MP_EXPECT_OK( MP_EXPECT_OK(
graph_.AddPacketToInputStream("track_time", track_time_packet)); graph_.AddPacketToInputStream("track_time", track_time_packet));

View File

@ -35,6 +35,7 @@ cc_library(
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/flags:flag", "@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse", "@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/log:absl_log",
], ],
) )

View File

@ -17,6 +17,7 @@
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/flags/parse.h" #include "absl/flags/parse.h"
#include "absl/log/absl_log.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/image_frame.h" #include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/image_frame_opencv.h" #include "mediapipe/framework/formats/image_frame_opencv.h"
@ -45,17 +46,17 @@ absl::Status RunMPPGraph() {
MP_RETURN_IF_ERROR(mediapipe::file::GetContents( MP_RETURN_IF_ERROR(mediapipe::file::GetContents(
absl::GetFlag(FLAGS_calculator_graph_config_file), absl::GetFlag(FLAGS_calculator_graph_config_file),
&calculator_graph_config_contents)); &calculator_graph_config_contents));
LOG(INFO) << "Get calculator graph config contents: " ABSL_LOG(INFO) << "Get calculator graph config contents: "
<< calculator_graph_config_contents; << calculator_graph_config_contents;
mediapipe::CalculatorGraphConfig config = mediapipe::CalculatorGraphConfig config =
mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>( mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>(
calculator_graph_config_contents); calculator_graph_config_contents);
LOG(INFO) << "Initialize the calculator graph."; ABSL_LOG(INFO) << "Initialize the calculator graph.";
mediapipe::CalculatorGraph graph; mediapipe::CalculatorGraph graph;
MP_RETURN_IF_ERROR(graph.Initialize(config)); MP_RETURN_IF_ERROR(graph.Initialize(config));
LOG(INFO) << "Initialize the camera or load the video."; ABSL_LOG(INFO) << "Initialize the camera or load the video.";
cv::VideoCapture capture; cv::VideoCapture capture;
const bool load_video = !absl::GetFlag(FLAGS_input_video_path).empty(); const bool load_video = !absl::GetFlag(FLAGS_input_video_path).empty();
if (load_video) { if (load_video) {
@ -68,7 +69,7 @@ absl::Status RunMPPGraph() {
cv::VideoWriter writer; cv::VideoWriter writer;
const bool save_video = !absl::GetFlag(FLAGS_output_video_path).empty(); const bool save_video = !absl::GetFlag(FLAGS_output_video_path).empty();
if (save_video) { if (save_video) {
LOG(INFO) << "Prepare video writer."; ABSL_LOG(INFO) << "Prepare video writer.";
cv::Mat test_frame; cv::Mat test_frame;
capture.read(test_frame); // Consume first frame. capture.read(test_frame); // Consume first frame.
capture.set(cv::CAP_PROP_POS_AVI_RATIO, 0); // Rewind to beginning. capture.set(cv::CAP_PROP_POS_AVI_RATIO, 0); // Rewind to beginning.
@ -85,12 +86,12 @@ absl::Status RunMPPGraph() {
capture.set(cv::CAP_PROP_FPS, 30); capture.set(cv::CAP_PROP_FPS, 30);
} }
LOG(INFO) << "Start running the calculator graph."; ABSL_LOG(INFO) << "Start running the calculator graph.";
ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller poller, ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller poller,
graph.AddOutputStreamPoller(kOutputStream)); graph.AddOutputStreamPoller(kOutputStream));
MP_RETURN_IF_ERROR(graph.StartRun({})); MP_RETURN_IF_ERROR(graph.StartRun({}));
LOG(INFO) << "Start grabbing and processing frames."; ABSL_LOG(INFO) << "Start grabbing and processing frames.";
bool grab_frames = true; bool grab_frames = true;
while (grab_frames) { while (grab_frames) {
// Capture opencv camera or video frame. // Capture opencv camera or video frame.
@ -135,7 +136,7 @@ absl::Status RunMPPGraph() {
} }
} }
LOG(INFO) << "Shutting down."; ABSL_LOG(INFO) << "Shutting down.";
if (writer.isOpened()) writer.release(); if (writer.isOpened()) writer.release();
MP_RETURN_IF_ERROR(graph.CloseInputStream(kInputStream)); MP_RETURN_IF_ERROR(graph.CloseInputStream(kInputStream));
return graph.WaitUntilDone(); return graph.WaitUntilDone();
@ -146,10 +147,10 @@ int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv); absl::ParseCommandLine(argc, argv);
absl::Status run_status = RunMPPGraph(); absl::Status run_status = RunMPPGraph();
if (!run_status.ok()) { if (!run_status.ok()) {
LOG(ERROR) << "Failed to run the graph: " << run_status.message(); ABSL_LOG(ERROR) << "Failed to run the graph: " << run_status.message();
return EXIT_FAILURE; return EXIT_FAILURE;
} else { } else {
LOG(INFO) << "Success!"; ABSL_LOG(INFO) << "Success!";
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -31,6 +31,7 @@ cc_library(
"//mediapipe/framework/port:statusor", "//mediapipe/framework/port:statusor",
"@com_google_absl//absl/flags:flag", "@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse", "@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
) )
@ -51,6 +52,7 @@ cc_library(
"//mediapipe/util:resource_util", "//mediapipe/util:resource_util",
"@com_google_absl//absl/flags:flag", "@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse", "@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/log:absl_log",
], ],
) )
@ -77,5 +79,6 @@ cc_library(
"//mediapipe/util:resource_util", "//mediapipe/util:resource_util",
"@com_google_absl//absl/flags:flag", "@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse", "@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/log:absl_log",
], ],
) )

View File

@ -306,6 +306,7 @@ cc_library(
"//mediapipe/framework/port:opencv_imgproc", "//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
], ],
alwayslink = 1, alwayslink = 1,
) )

View File

@ -18,6 +18,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "mediapipe/examples/desktop/autoflip/calculators/shot_boundary_calculator.pb.h" #include "mediapipe/examples/desktop/autoflip/calculators/shot_boundary_calculator.pb.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/image_frame.h" #include "mediapipe/framework/formats/image_frame.h"
@ -112,8 +113,8 @@ void ShotBoundaryCalculator::Transmit(mediapipe::CalculatorContext* cc,
is_shot_change = false; is_shot_change = false;
} }
if (is_shot_change) { if (is_shot_change) {
LOG(INFO) << "Shot change at: " << cc->InputTimestamp().Seconds() ABSL_LOG(INFO) << "Shot change at: " << cc->InputTimestamp().Seconds()
<< " seconds."; << " seconds.";
cc->Outputs() cc->Outputs()
.Tag(kShotChangeTag) .Tag(kShotChangeTag)
.AddPacket(Adopt(std::make_unique<bool>(true).release()) .AddPacket(Adopt(std::make_unique<bool>(true).release())

View File

@ -53,6 +53,7 @@ cc_library(
"//mediapipe/examples/desktop/autoflip:autoflip_messages_cc_proto", "//mediapipe/examples/desktop/autoflip:autoflip_messages_cc_proto",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
], ],
) )
@ -67,6 +68,7 @@ cc_library(
hdrs = ["piecewise_linear_function.h"], hdrs = ["piecewise_linear_function.h"],
deps = [ deps = [
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:check",
], ],
) )
@ -192,6 +194,7 @@ cc_library(
"//mediapipe/framework/port:opencv_imgproc", "//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
], ],
) )
@ -234,6 +237,7 @@ cc_test(
"//mediapipe/framework/port:gtest_main", "//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/flags:flag", "@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
) )
@ -327,6 +331,7 @@ cc_library(
"//mediapipe/framework/port:opencv_imgproc", "//mediapipe/framework/port:opencv_imgproc",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
], ],
) )

View File

@ -16,6 +16,7 @@
#include <cmath> #include <cmath>
#include "absl/log/absl_log.h"
#include "mediapipe/examples/desktop/autoflip/quality/utils.h" #include "mediapipe/examples/desktop/autoflip/quality/utils.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
@ -137,7 +138,7 @@ void FrameCropRegionComputer::UpdateCropRegionScore(
const float feature_score, const bool is_required, const float feature_score, const bool is_required,
float* crop_region_score) { float* crop_region_score) {
if (feature_score < 0.0) { if (feature_score < 0.0) {
LOG(WARNING) << "Ignoring negative score"; ABSL_LOG(WARNING) << "Ignoring negative score";
return; return;
} }
@ -161,7 +162,8 @@ void FrameCropRegionComputer::UpdateCropRegionScore(
break; break;
} }
default: { default: {
LOG(WARNING) << "Unknown CropRegionScoreType " << score_aggregation_type; ABSL_LOG(WARNING) << "Unknown CropRegionScoreType "
<< score_aggregation_type;
break; break;
} }
} }

View File

@ -20,6 +20,7 @@
#include <limits> #include <limits>
#include <vector> #include <vector>
#include "absl/log/check.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
namespace mediapipe { namespace mediapipe {

View File

@ -20,6 +20,7 @@
#include <vector> #include <vector>
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/log/check.h"
#include "absl/strings/str_split.h" #include "absl/strings/str_split.h"
#include "mediapipe/examples/desktop/autoflip/autoflip_messages.pb.h" #include "mediapipe/examples/desktop/autoflip/autoflip_messages.pb.h"
#include "mediapipe/examples/desktop/autoflip/quality/focus_point.pb.h" #include "mediapipe/examples/desktop/autoflip/quality/focus_point.pb.h"

View File

@ -19,6 +19,7 @@
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "mediapipe/examples/desktop/autoflip/quality/math_utils.h" #include "mediapipe/examples/desktop/autoflip/quality/math_utils.h"
#include "mediapipe/framework/port/opencv_imgproc_inc.h" #include "mediapipe/framework/port/opencv_imgproc_inc.h"
@ -121,12 +122,12 @@ absl::Status PackKeyFrameInfo(const int64_t frame_timestamp_ms,
ScaleRect(original_detection.location(), scale_x, scale_y, &location); ScaleRect(original_detection.location(), scale_x, scale_y, &location);
} else { } else {
has_valid_location = false; has_valid_location = false;
LOG(ERROR) << "Detection missing a bounding box, skipped."; ABSL_LOG(ERROR) << "Detection missing a bounding box, skipped.";
} }
if (has_valid_location) { if (has_valid_location) {
if (!ClampRect(original_frame_width, original_frame_height, &location) if (!ClampRect(original_frame_width, original_frame_height, &location)
.ok()) { .ok()) {
LOG(ERROR) << "Invalid detection bounding box, skipped."; ABSL_LOG(ERROR) << "Invalid detection bounding box, skipped.";
continue; continue;
} }
auto* detection = processed_detections->add_detections(); auto* detection = processed_detections->add_detections();

View File

@ -21,6 +21,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "mediapipe/framework/port/opencv_core_inc.h" #include "mediapipe/framework/port/opencv_core_inc.h"
#include "mediapipe/framework/port/opencv_imgproc_inc.h" #include "mediapipe/framework/port/opencv_imgproc_inc.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
@ -106,7 +107,7 @@ absl::Status VisualScorer::CalculateScore(const cv::Mat& image,
*score = (area_score + sharpness_score + colorfulness_score) / weight_sum; *score = (area_score + sharpness_score + colorfulness_score) / weight_sum;
if (*score > 1.0f || *score < 0.0f) { if (*score > 1.0f || *score < 0.0f) {
LOG(WARNING) << "Score of region outside expected range: " << *score; ABSL_LOG(WARNING) << "Score of region outside expected range: " << *score;
} }
return absl::OkStatus(); return absl::OkStatus();
} }

View File

@ -17,6 +17,7 @@
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/flags/parse.h" #include "absl/flags/parse.h"
#include "absl/log/absl_log.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/image_frame.h" #include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/image_frame_opencv.h" #include "mediapipe/framework/formats/image_frame_opencv.h"
@ -46,17 +47,17 @@ absl::Status RunMPPGraph() {
MP_RETURN_IF_ERROR(mediapipe::file::GetContents( MP_RETURN_IF_ERROR(mediapipe::file::GetContents(
absl::GetFlag(FLAGS_calculator_graph_config_file), absl::GetFlag(FLAGS_calculator_graph_config_file),
&calculator_graph_config_contents)); &calculator_graph_config_contents));
LOG(INFO) << "Get calculator graph config contents: " ABSL_LOG(INFO) << "Get calculator graph config contents: "
<< calculator_graph_config_contents; << calculator_graph_config_contents;
mediapipe::CalculatorGraphConfig config = mediapipe::CalculatorGraphConfig config =
mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>( mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>(
calculator_graph_config_contents); calculator_graph_config_contents);
LOG(INFO) << "Initialize the calculator graph."; ABSL_LOG(INFO) << "Initialize the calculator graph.";
mediapipe::CalculatorGraph graph; mediapipe::CalculatorGraph graph;
MP_RETURN_IF_ERROR(graph.Initialize(config)); MP_RETURN_IF_ERROR(graph.Initialize(config));
LOG(INFO) << "Initialize the camera or load the video."; ABSL_LOG(INFO) << "Initialize the camera or load the video.";
cv::VideoCapture capture; cv::VideoCapture capture;
const bool load_video = !absl::GetFlag(FLAGS_input_video_path).empty(); const bool load_video = !absl::GetFlag(FLAGS_input_video_path).empty();
if (load_video) { if (load_video) {
@ -77,12 +78,12 @@ absl::Status RunMPPGraph() {
#endif #endif
} }
LOG(INFO) << "Start running the calculator graph."; ABSL_LOG(INFO) << "Start running the calculator graph.";
ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller poller, ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller poller,
graph.AddOutputStreamPoller(kOutputStream)); graph.AddOutputStreamPoller(kOutputStream));
MP_RETURN_IF_ERROR(graph.StartRun({})); MP_RETURN_IF_ERROR(graph.StartRun({}));
LOG(INFO) << "Start grabbing and processing frames."; ABSL_LOG(INFO) << "Start grabbing and processing frames.";
bool grab_frames = true; bool grab_frames = true;
while (grab_frames) { while (grab_frames) {
// Capture opencv camera or video frame. // Capture opencv camera or video frame.
@ -90,10 +91,10 @@ absl::Status RunMPPGraph() {
capture >> camera_frame_raw; capture >> camera_frame_raw;
if (camera_frame_raw.empty()) { if (camera_frame_raw.empty()) {
if (!load_video) { if (!load_video) {
LOG(INFO) << "Ignore empty frames from camera."; ABSL_LOG(INFO) << "Ignore empty frames from camera.";
continue; continue;
} }
LOG(INFO) << "Empty frame, end of video reached."; ABSL_LOG(INFO) << "Empty frame, end of video reached.";
break; break;
} }
cv::Mat camera_frame; cv::Mat camera_frame;
@ -126,7 +127,7 @@ absl::Status RunMPPGraph() {
cv::cvtColor(output_frame_mat, output_frame_mat, cv::COLOR_RGB2BGR); cv::cvtColor(output_frame_mat, output_frame_mat, cv::COLOR_RGB2BGR);
if (save_video) { if (save_video) {
if (!writer.isOpened()) { if (!writer.isOpened()) {
LOG(INFO) << "Prepare video writer."; ABSL_LOG(INFO) << "Prepare video writer.";
writer.open(absl::GetFlag(FLAGS_output_video_path), writer.open(absl::GetFlag(FLAGS_output_video_path),
mediapipe::fourcc('a', 'v', 'c', '1'), // .mp4 mediapipe::fourcc('a', 'v', 'c', '1'), // .mp4
capture.get(cv::CAP_PROP_FPS), output_frame_mat.size()); capture.get(cv::CAP_PROP_FPS), output_frame_mat.size());
@ -141,7 +142,7 @@ absl::Status RunMPPGraph() {
} }
} }
LOG(INFO) << "Shutting down."; ABSL_LOG(INFO) << "Shutting down.";
if (writer.isOpened()) writer.release(); if (writer.isOpened()) writer.release();
MP_RETURN_IF_ERROR(graph.CloseInputStream(kInputStream)); MP_RETURN_IF_ERROR(graph.CloseInputStream(kInputStream));
return graph.WaitUntilDone(); return graph.WaitUntilDone();
@ -152,10 +153,10 @@ int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv); absl::ParseCommandLine(argc, argv);
absl::Status run_status = RunMPPGraph(); absl::Status run_status = RunMPPGraph();
if (!run_status.ok()) { if (!run_status.ok()) {
LOG(ERROR) << "Failed to run the graph: " << run_status.message(); ABSL_LOG(ERROR) << "Failed to run the graph: " << run_status.message();
return EXIT_FAILURE; return EXIT_FAILURE;
} else { } else {
LOG(INFO) << "Success!"; ABSL_LOG(INFO) << "Success!";
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -18,6 +18,7 @@
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/flags/parse.h" #include "absl/flags/parse.h"
#include "absl/log/absl_log.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/image_frame.h" #include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/image_frame_opencv.h" #include "mediapipe/framework/formats/image_frame_opencv.h"
@ -50,23 +51,23 @@ absl::Status RunMPPGraph() {
MP_RETURN_IF_ERROR(mediapipe::file::GetContents( MP_RETURN_IF_ERROR(mediapipe::file::GetContents(
absl::GetFlag(FLAGS_calculator_graph_config_file), absl::GetFlag(FLAGS_calculator_graph_config_file),
&calculator_graph_config_contents)); &calculator_graph_config_contents));
LOG(INFO) << "Get calculator graph config contents: " ABSL_LOG(INFO) << "Get calculator graph config contents: "
<< calculator_graph_config_contents; << calculator_graph_config_contents;
mediapipe::CalculatorGraphConfig config = mediapipe::CalculatorGraphConfig config =
mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>( mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>(
calculator_graph_config_contents); calculator_graph_config_contents);
LOG(INFO) << "Initialize the calculator graph."; ABSL_LOG(INFO) << "Initialize the calculator graph.";
mediapipe::CalculatorGraph graph; mediapipe::CalculatorGraph graph;
MP_RETURN_IF_ERROR(graph.Initialize(config)); MP_RETURN_IF_ERROR(graph.Initialize(config));
LOG(INFO) << "Initialize the GPU."; ABSL_LOG(INFO) << "Initialize the GPU.";
ASSIGN_OR_RETURN(auto gpu_resources, mediapipe::GpuResources::Create()); ASSIGN_OR_RETURN(auto gpu_resources, mediapipe::GpuResources::Create());
MP_RETURN_IF_ERROR(graph.SetGpuResources(std::move(gpu_resources))); MP_RETURN_IF_ERROR(graph.SetGpuResources(std::move(gpu_resources)));
mediapipe::GlCalculatorHelper gpu_helper; mediapipe::GlCalculatorHelper gpu_helper;
gpu_helper.InitializeForTest(graph.GetGpuResources().get()); gpu_helper.InitializeForTest(graph.GetGpuResources().get());
LOG(INFO) << "Initialize the camera or load the video."; ABSL_LOG(INFO) << "Initialize the camera or load the video.";
cv::VideoCapture capture; cv::VideoCapture capture;
const bool load_video = !absl::GetFlag(FLAGS_input_video_path).empty(); const bool load_video = !absl::GetFlag(FLAGS_input_video_path).empty();
if (load_video) { if (load_video) {
@ -87,12 +88,12 @@ absl::Status RunMPPGraph() {
#endif #endif
} }
LOG(INFO) << "Start running the calculator graph."; ABSL_LOG(INFO) << "Start running the calculator graph.";
ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller poller, ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller poller,
graph.AddOutputStreamPoller(kOutputStream)); graph.AddOutputStreamPoller(kOutputStream));
MP_RETURN_IF_ERROR(graph.StartRun({})); MP_RETURN_IF_ERROR(graph.StartRun({}));
LOG(INFO) << "Start grabbing and processing frames."; ABSL_LOG(INFO) << "Start grabbing and processing frames.";
bool grab_frames = true; bool grab_frames = true;
while (grab_frames) { while (grab_frames) {
// Capture opencv camera or video frame. // Capture opencv camera or video frame.
@ -100,10 +101,10 @@ absl::Status RunMPPGraph() {
capture >> camera_frame_raw; capture >> camera_frame_raw;
if (camera_frame_raw.empty()) { if (camera_frame_raw.empty()) {
if (!load_video) { if (!load_video) {
LOG(INFO) << "Ignore empty frames from camera."; ABSL_LOG(INFO) << "Ignore empty frames from camera.";
continue; continue;
} }
LOG(INFO) << "Empty frame, end of video reached."; ABSL_LOG(INFO) << "Empty frame, end of video reached.";
break; break;
} }
cv::Mat camera_frame; cv::Mat camera_frame;
@ -169,7 +170,7 @@ absl::Status RunMPPGraph() {
cv::cvtColor(output_frame_mat, output_frame_mat, cv::COLOR_RGB2BGR); cv::cvtColor(output_frame_mat, output_frame_mat, cv::COLOR_RGB2BGR);
if (save_video) { if (save_video) {
if (!writer.isOpened()) { if (!writer.isOpened()) {
LOG(INFO) << "Prepare video writer."; ABSL_LOG(INFO) << "Prepare video writer.";
writer.open(absl::GetFlag(FLAGS_output_video_path), writer.open(absl::GetFlag(FLAGS_output_video_path),
mediapipe::fourcc('a', 'v', 'c', '1'), // .mp4 mediapipe::fourcc('a', 'v', 'c', '1'), // .mp4
capture.get(cv::CAP_PROP_FPS), output_frame_mat.size()); capture.get(cv::CAP_PROP_FPS), output_frame_mat.size());
@ -184,7 +185,7 @@ absl::Status RunMPPGraph() {
} }
} }
LOG(INFO) << "Shutting down."; ABSL_LOG(INFO) << "Shutting down.";
if (writer.isOpened()) writer.release(); if (writer.isOpened()) writer.release();
MP_RETURN_IF_ERROR(graph.CloseInputStream(kInputStream)); MP_RETURN_IF_ERROR(graph.CloseInputStream(kInputStream));
return graph.WaitUntilDone(); return graph.WaitUntilDone();
@ -195,10 +196,10 @@ int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv); absl::ParseCommandLine(argc, argv);
absl::Status run_status = RunMPPGraph(); absl::Status run_status = RunMPPGraph();
if (!run_status.ok()) { if (!run_status.ok()) {
LOG(ERROR) << "Failed to run the graph: " << run_status.message(); ABSL_LOG(ERROR) << "Failed to run the graph: " << run_status.message();
return EXIT_FAILURE; return EXIT_FAILURE;
} else { } else {
LOG(INFO) << "Success!"; ABSL_LOG(INFO) << "Success!";
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -22,8 +22,8 @@ cc_binary(
deps = [ deps = [
"//mediapipe/calculators/core:pass_through_calculator", "//mediapipe/calculators/core:pass_through_calculator",
"//mediapipe/framework:calculator_graph", "//mediapipe/framework:calculator_graph",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:parse_text_proto", "//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
], ],
) )

View File

@ -14,8 +14,8 @@
// //
// A simple example to print out "Hello World!" from a MediaPipe graph. // A simple example to print out "Hello World!" from a MediaPipe graph.
#include "absl/log/absl_log.h"
#include "mediapipe/framework/calculator_graph.h" #include "mediapipe/framework/calculator_graph.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/parse_text_proto.h" #include "mediapipe/framework/port/parse_text_proto.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
@ -54,7 +54,7 @@ absl::Status PrintHelloWorld() {
mediapipe::Packet packet; mediapipe::Packet packet;
// Get the output packets string. // Get the output packets string.
while (poller.Next(&packet)) { while (poller.Next(&packet)) {
LOG(INFO) << packet.Get<std::string>(); ABSL_LOG(INFO) << packet.Get<std::string>();
} }
return graph.WaitUntilDone(); return graph.WaitUntilDone();
} }

View File

@ -33,6 +33,7 @@ cc_binary(
"//mediapipe/graphs/iris_tracking:iris_depth_cpu_deps", "//mediapipe/graphs/iris_tracking:iris_depth_cpu_deps",
"@com_google_absl//absl/flags:flag", "@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse", "@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/log:absl_log",
], ],
) )

View File

@ -19,6 +19,7 @@
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/flags/parse.h" #include "absl/flags/parse.h"
#include "absl/log/absl_log.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/image_frame.h" #include "mediapipe/framework/formats/image_frame.h"
#include "mediapipe/framework/formats/image_frame_opencv.h" #include "mediapipe/framework/formats/image_frame_opencv.h"
@ -55,11 +56,11 @@ absl::StatusOr<std::string> ReadFileToString(const std::string& file_path) {
} }
absl::Status ProcessImage(std::unique_ptr<mediapipe::CalculatorGraph> graph) { absl::Status ProcessImage(std::unique_ptr<mediapipe::CalculatorGraph> graph) {
LOG(INFO) << "Load the image."; ABSL_LOG(INFO) << "Load the image.";
ASSIGN_OR_RETURN(const std::string raw_image, ASSIGN_OR_RETURN(const std::string raw_image,
ReadFileToString(absl::GetFlag(FLAGS_input_image_path))); ReadFileToString(absl::GetFlag(FLAGS_input_image_path)));
LOG(INFO) << "Start running the calculator graph."; ABSL_LOG(INFO) << "Start running the calculator graph.";
ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller output_image_poller, ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller output_image_poller,
graph->AddOutputStreamPoller(kOutputImageStream)); graph->AddOutputStreamPoller(kOutputImageStream));
ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller left_iris_depth_poller, ASSIGN_OR_RETURN(mediapipe::OutputStreamPoller left_iris_depth_poller,
@ -108,7 +109,7 @@ absl::Status ProcessImage(std::unique_ptr<mediapipe::CalculatorGraph> graph) {
cv::cvtColor(output_frame_mat, output_frame_mat, cv::COLOR_RGB2BGR); cv::cvtColor(output_frame_mat, output_frame_mat, cv::COLOR_RGB2BGR);
const bool save_image = !absl::GetFlag(FLAGS_output_image_path).empty(); const bool save_image = !absl::GetFlag(FLAGS_output_image_path).empty();
if (save_image) { if (save_image) {
LOG(INFO) << "Saving image to file..."; ABSL_LOG(INFO) << "Saving image to file...";
cv::imwrite(absl::GetFlag(FLAGS_output_image_path), output_frame_mat); cv::imwrite(absl::GetFlag(FLAGS_output_image_path), output_frame_mat);
} else { } else {
cv::namedWindow(kWindowName, /*flags=WINDOW_AUTOSIZE*/ 1); cv::namedWindow(kWindowName, /*flags=WINDOW_AUTOSIZE*/ 1);
@ -117,7 +118,7 @@ absl::Status ProcessImage(std::unique_ptr<mediapipe::CalculatorGraph> graph) {
cv::waitKey(0); cv::waitKey(0);
} }
LOG(INFO) << "Shutting down."; ABSL_LOG(INFO) << "Shutting down.";
MP_RETURN_IF_ERROR(graph->CloseInputStream(kInputStream)); MP_RETURN_IF_ERROR(graph->CloseInputStream(kInputStream));
return graph->WaitUntilDone(); return graph->WaitUntilDone();
} }
@ -126,13 +127,13 @@ absl::Status RunMPPGraph() {
std::string calculator_graph_config_contents; std::string calculator_graph_config_contents;
MP_RETURN_IF_ERROR(mediapipe::file::GetContents( MP_RETURN_IF_ERROR(mediapipe::file::GetContents(
kCalculatorGraphConfigFile, &calculator_graph_config_contents)); kCalculatorGraphConfigFile, &calculator_graph_config_contents));
LOG(INFO) << "Get calculator graph config contents: " ABSL_LOG(INFO) << "Get calculator graph config contents: "
<< calculator_graph_config_contents; << calculator_graph_config_contents;
mediapipe::CalculatorGraphConfig config = mediapipe::CalculatorGraphConfig config =
mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>( mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>(
calculator_graph_config_contents); calculator_graph_config_contents);
LOG(INFO) << "Initialize the calculator graph."; ABSL_LOG(INFO) << "Initialize the calculator graph.";
std::unique_ptr<mediapipe::CalculatorGraph> graph = std::unique_ptr<mediapipe::CalculatorGraph> graph =
absl::make_unique<mediapipe::CalculatorGraph>(); absl::make_unique<mediapipe::CalculatorGraph>();
MP_RETURN_IF_ERROR(graph->Initialize(config)); MP_RETURN_IF_ERROR(graph->Initialize(config));
@ -152,10 +153,10 @@ int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv); absl::ParseCommandLine(argc, argv);
absl::Status run_status = RunMPPGraph(); absl::Status run_status = RunMPPGraph();
if (!run_status.ok()) { if (!run_status.ok()) {
LOG(ERROR) << "Failed to run the graph: " << run_status.message(); ABSL_LOG(ERROR) << "Failed to run the graph: " << run_status.message();
return EXIT_FAILURE; return EXIT_FAILURE;
} else { } else {
LOG(INFO) << "Success!"; ABSL_LOG(INFO) << "Success!";
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -30,6 +30,7 @@ cc_library(
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/flags:flag", "@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse", "@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
) )

View File

@ -19,6 +19,7 @@
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/flags/parse.h" #include "absl/flags/parse.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_split.h" #include "absl/strings/str_split.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/file_helpers.h" #include "mediapipe/framework/port/file_helpers.h"
@ -43,8 +44,8 @@ absl::Status RunMPPGraph() {
MP_RETURN_IF_ERROR(mediapipe::file::GetContents( MP_RETURN_IF_ERROR(mediapipe::file::GetContents(
absl::GetFlag(FLAGS_calculator_graph_config_file), absl::GetFlag(FLAGS_calculator_graph_config_file),
&calculator_graph_config_contents)); &calculator_graph_config_contents));
LOG(INFO) << "Get calculator graph config contents: " ABSL_LOG(INFO) << "Get calculator graph config contents: "
<< calculator_graph_config_contents; << calculator_graph_config_contents;
mediapipe::CalculatorGraphConfig config = mediapipe::CalculatorGraphConfig config =
mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>( mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>(
calculator_graph_config_contents); calculator_graph_config_contents);
@ -61,12 +62,12 @@ absl::Status RunMPPGraph() {
input_side_packets[name_and_value[0]] = input_side_packets[name_and_value[0]] =
mediapipe::MakePacket<std::string>(input_side_packet_contents); mediapipe::MakePacket<std::string>(input_side_packet_contents);
} }
LOG(INFO) << "Initialize the calculator graph."; ABSL_LOG(INFO) << "Initialize the calculator graph.";
mediapipe::CalculatorGraph graph; mediapipe::CalculatorGraph graph;
MP_RETURN_IF_ERROR(graph.Initialize(config, input_side_packets)); MP_RETURN_IF_ERROR(graph.Initialize(config, input_side_packets));
LOG(INFO) << "Start running the calculator graph."; ABSL_LOG(INFO) << "Start running the calculator graph.";
MP_RETURN_IF_ERROR(graph.Run()); MP_RETURN_IF_ERROR(graph.Run());
LOG(INFO) << "Gathering output side packets."; ABSL_LOG(INFO) << "Gathering output side packets.";
kv_pairs = absl::StrSplit(absl::GetFlag(FLAGS_output_side_packets), ','); kv_pairs = absl::StrSplit(absl::GetFlag(FLAGS_output_side_packets), ',');
for (const std::string& kv_pair : kv_pairs) { for (const std::string& kv_pair : kv_pairs) {
std::vector<std::string> name_and_value = absl::StrSplit(kv_pair, '='); std::vector<std::string> name_and_value = absl::StrSplit(kv_pair, '=');
@ -88,10 +89,10 @@ int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv); absl::ParseCommandLine(argc, argv);
absl::Status run_status = RunMPPGraph(); absl::Status run_status = RunMPPGraph();
if (!run_status.ok()) { if (!run_status.ok()) {
LOG(ERROR) << "Failed to run the graph: " << run_status.message(); ABSL_LOG(ERROR) << "Failed to run the graph: " << run_status.message();
return EXIT_FAILURE; return EXIT_FAILURE;
} else { } else {
LOG(INFO) << "Success!"; ABSL_LOG(INFO) << "Success!";
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -22,6 +22,7 @@
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/flags/parse.h" #include "absl/flags/parse.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h" #include "absl/strings/str_split.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
@ -102,8 +103,8 @@ absl::Status RunMPPGraph() {
MP_RETURN_IF_ERROR(mediapipe::file::GetContents( MP_RETURN_IF_ERROR(mediapipe::file::GetContents(
absl::GetFlag(FLAGS_calculator_graph_config_file), absl::GetFlag(FLAGS_calculator_graph_config_file),
&calculator_graph_config_contents)); &calculator_graph_config_contents));
LOG(INFO) << "Get calculator graph config contents: " ABSL_LOG(INFO) << "Get calculator graph config contents: "
<< calculator_graph_config_contents; << calculator_graph_config_contents;
mediapipe::CalculatorGraphConfig config = mediapipe::CalculatorGraphConfig config =
mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>( mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>(
calculator_graph_config_contents); calculator_graph_config_contents);
@ -119,14 +120,14 @@ absl::Status RunMPPGraph() {
mediapipe::MakePacket<std::string>(name_and_value[1]); mediapipe::MakePacket<std::string>(name_and_value[1]);
} }
} }
LOG(INFO) << "Initialize the calculator graph."; ABSL_LOG(INFO) << "Initialize the calculator graph.";
mediapipe::CalculatorGraph graph; mediapipe::CalculatorGraph graph;
MP_RETURN_IF_ERROR(graph.Initialize(config, input_side_packets)); MP_RETURN_IF_ERROR(graph.Initialize(config, input_side_packets));
if (!absl::GetFlag(FLAGS_output_stream).empty() && if (!absl::GetFlag(FLAGS_output_stream).empty() &&
!absl::GetFlag(FLAGS_output_stream_file).empty()) { !absl::GetFlag(FLAGS_output_stream_file).empty()) {
ASSIGN_OR_RETURN(auto poller, graph.AddOutputStreamPoller( ASSIGN_OR_RETURN(auto poller, graph.AddOutputStreamPoller(
absl::GetFlag(FLAGS_output_stream))); absl::GetFlag(FLAGS_output_stream)));
LOG(INFO) << "Start running the calculator graph."; ABSL_LOG(INFO) << "Start running the calculator graph.";
MP_RETURN_IF_ERROR(graph.StartRun({})); MP_RETURN_IF_ERROR(graph.StartRun({}));
MP_RETURN_IF_ERROR(OutputStreamToLocalFile(poller)); MP_RETURN_IF_ERROR(OutputStreamToLocalFile(poller));
} else { } else {
@ -134,7 +135,7 @@ absl::Status RunMPPGraph() {
absl::GetFlag(FLAGS_output_stream_file).empty()) absl::GetFlag(FLAGS_output_stream_file).empty())
<< "--output_stream and --output_stream_file should be specified in " << "--output_stream and --output_stream_file should be specified in "
"pair."; "pair.";
LOG(INFO) << "Start running the calculator graph."; ABSL_LOG(INFO) << "Start running the calculator graph.";
MP_RETURN_IF_ERROR(graph.StartRun({})); MP_RETURN_IF_ERROR(graph.StartRun({}));
} }
MP_RETURN_IF_ERROR(graph.WaitUntilDone()); MP_RETURN_IF_ERROR(graph.WaitUntilDone());
@ -146,10 +147,10 @@ int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv); absl::ParseCommandLine(argc, argv);
absl::Status run_status = RunMPPGraph(); absl::Status run_status = RunMPPGraph();
if (!run_status.ok()) { if (!run_status.ok()) {
LOG(ERROR) << "Failed to run the graph: " << run_status.message(); ABSL_LOG(ERROR) << "Failed to run the graph: " << run_status.message();
return EXIT_FAILURE; return EXIT_FAILURE;
} else { } else {
LOG(INFO) << "Success!"; ABSL_LOG(INFO) << "Success!";
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -22,6 +22,7 @@ cc_binary(
deps = [ deps = [
"@com_google_absl//absl/flags:flag", "@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse", "@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"//mediapipe/framework:calculator_framework", "//mediapipe/framework:calculator_framework",
"//mediapipe/framework/formats:matrix", "//mediapipe/framework/formats:matrix",

View File

@ -19,6 +19,7 @@
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/flags/parse.h" #include "absl/flags/parse.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_split.h" #include "absl/strings/str_split.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/formats/matrix.h" #include "mediapipe/framework/formats/matrix.h"
@ -44,8 +45,8 @@ absl::Status RunMPPGraph() {
MP_RETURN_IF_ERROR(mediapipe::file::GetContents( MP_RETURN_IF_ERROR(mediapipe::file::GetContents(
absl::GetFlag(FLAGS_calculator_graph_config_file), absl::GetFlag(FLAGS_calculator_graph_config_file),
&calculator_graph_config_contents)); &calculator_graph_config_contents));
LOG(INFO) << "Get calculator graph config contents: " ABSL_LOG(INFO) << "Get calculator graph config contents: "
<< calculator_graph_config_contents; << calculator_graph_config_contents;
mediapipe::CalculatorGraphConfig config = mediapipe::CalculatorGraphConfig config =
mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>( mediapipe::ParseTextProtoOrDie<mediapipe::CalculatorGraphConfig>(
calculator_graph_config_contents); calculator_graph_config_contents);
@ -102,12 +103,12 @@ absl::Status RunMPPGraph() {
input_side_packets["vggish_pca_projection_matrix"] = input_side_packets["vggish_pca_projection_matrix"] =
mediapipe::MakePacket<mediapipe::Matrix>(vggish_pca_projection_matrix); mediapipe::MakePacket<mediapipe::Matrix>(vggish_pca_projection_matrix);
LOG(INFO) << "Initialize the calculator graph."; ABSL_LOG(INFO) << "Initialize the calculator graph.";
mediapipe::CalculatorGraph graph; mediapipe::CalculatorGraph graph;
MP_RETURN_IF_ERROR(graph.Initialize(config, input_side_packets)); MP_RETURN_IF_ERROR(graph.Initialize(config, input_side_packets));
LOG(INFO) << "Start running the calculator graph."; ABSL_LOG(INFO) << "Start running the calculator graph.";
MP_RETURN_IF_ERROR(graph.Run()); MP_RETURN_IF_ERROR(graph.Run());
LOG(INFO) << "Gathering output side packets."; ABSL_LOG(INFO) << "Gathering output side packets.";
kv_pairs = absl::StrSplit(absl::GetFlag(FLAGS_output_side_packets), ','); kv_pairs = absl::StrSplit(absl::GetFlag(FLAGS_output_side_packets), ',');
for (const std::string& kv_pair : kv_pairs) { for (const std::string& kv_pair : kv_pairs) {
std::vector<std::string> name_and_value = absl::StrSplit(kv_pair, '='); std::vector<std::string> name_and_value = absl::StrSplit(kv_pair, '=');
@ -129,10 +130,10 @@ int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv); absl::ParseCommandLine(argc, argv);
absl::Status run_status = RunMPPGraph(); absl::Status run_status = RunMPPGraph();
if (!run_status.ok()) { if (!run_status.ok()) {
LOG(ERROR) << "Failed to run the graph: " << run_status.message(); ABSL_LOG(ERROR) << "Failed to run the graph: " << run_status.message();
return EXIT_FAILURE; return EXIT_FAILURE;
} else { } else {
LOG(INFO) << "Success!"; ABSL_LOG(INFO) << "Success!";
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -360,7 +360,7 @@ cc_library(
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/log", "@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/status", "@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor", "@com_google_absl//absl/status:statusor",
@ -432,6 +432,7 @@ cc_library(
"//mediapipe/framework/tool:tag_map", "//mediapipe/framework/tool:tag_map",
"//mediapipe/framework/tool:validate_name", "//mediapipe/framework/tool:validate_name",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/status", "@com_google_absl//absl/status",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
@ -458,11 +459,11 @@ cc_library(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
":calculator_framework", ":calculator_framework",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/tool:sink", "//mediapipe/framework/tool:sink",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
@ -505,11 +506,11 @@ cc_library(
deps = [ deps = [
":collection_item_id", ":collection_item_id",
":type_map", ":type_map",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/tool:tag_map", "//mediapipe/framework/tool:tag_map",
"//mediapipe/framework/tool:tag_map_helper", "//mediapipe/framework/tool:tag_map_helper",
"//mediapipe/framework/tool:validate_name", "//mediapipe/framework/tool:validate_name",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
@ -543,6 +544,7 @@ cc_library(
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:map_util", "//mediapipe/framework/port:map_util",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
"@com_google_absl//absl/time", "@com_google_absl//absl/time",
@ -613,10 +615,10 @@ cc_library(
":packet_set", ":packet_set",
":packet_type", ":packet_type",
":timestamp", ":timestamp",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
], ],
@ -871,6 +873,7 @@ cc_library(
"//mediapipe/framework/port:statusor", "//mediapipe/framework/port:statusor",
"//mediapipe/framework/tool:type_util", "//mediapipe/framework/tool:type_util",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
@ -951,6 +954,7 @@ cc_library(
"//mediapipe/framework/tool:type_util", "//mediapipe/framework/tool:type_util",
"//mediapipe/framework/tool:validate_name", "//mediapipe/framework/tool:validate_name",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/status", "@com_google_absl//absl/status",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/types:span", "@com_google_absl//absl/types:span",
@ -1136,6 +1140,7 @@ cc_library(
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging", "//mediapipe/framework/port:logging",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
) )
@ -1156,6 +1161,8 @@ cc_library(
"//mediapipe/framework/tool:status_util", "//mediapipe/framework/tool:status_util",
"//mediapipe/framework/tool:type_util", "//mediapipe/framework/tool:type_util",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
], ],
alwayslink = 1, alwayslink = 1,
@ -1209,6 +1216,7 @@ cc_library(
"//mediapipe/framework/tool:validate", "//mediapipe/framework/tool:validate",
"//mediapipe/framework/tool:validate_name", "//mediapipe/framework/tool:validate_name",
"@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_protobuf//:protobuf", "@com_google_protobuf//:protobuf",
@ -1293,10 +1301,10 @@ cc_test(
":calculator_node", ":calculator_node",
"//mediapipe/calculators/core:pass_through_calculator", "//mediapipe/calculators/core:pass_through_calculator",
"//mediapipe/framework/port:gtest_main", "//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:parse_text_proto", "//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/tool:source", "//mediapipe/framework/tool:source",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
], ],
) )
@ -1390,8 +1398,8 @@ cc_test(
":packet_type", ":packet_type",
":timestamp", ":timestamp",
"//mediapipe/framework/port:gtest_main", "//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
], ],
) )
@ -1453,7 +1461,6 @@ cc_test(
"//mediapipe/calculators/core:mux_calculator", "//mediapipe/calculators/core:mux_calculator",
"//mediapipe/calculators/core:pass_through_calculator", "//mediapipe/calculators/core:pass_through_calculator",
"//mediapipe/framework/port:gtest_main", "//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:parse_text_proto", "//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
@ -1468,6 +1475,7 @@ cc_test(
"//mediapipe/framework/tool:status_util", "//mediapipe/framework/tool:status_util",
"//mediapipe/gpu:gpu_service", "//mediapipe/gpu:gpu_service",
"@com_google_absl//absl/container:fixed_array", "@com_google_absl//absl/container:fixed_array",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/status", "@com_google_absl//absl/status",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
@ -1524,11 +1532,11 @@ cc_test(
"//mediapipe/calculators/core:mux_calculator", "//mediapipe/calculators/core:mux_calculator",
"//mediapipe/calculators/core:pass_through_calculator", "//mediapipe/calculators/core:pass_through_calculator",
"//mediapipe/framework/port:gtest_main", "//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:parse_text_proto", "//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:ret_check", "//mediapipe/framework/port:ret_check",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/tool:sink", "//mediapipe/framework/tool:sink",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/time", "@com_google_absl//absl/time",
], ],
) )

View File

@ -114,6 +114,7 @@ cc_test(
"//mediapipe/framework/port:gtest_main", "//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:parse_text_proto", "//mediapipe/framework/port:parse_text_proto",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"@com_google_absl//absl/log:absl_log",
], ],
) )

View File

@ -3,6 +3,7 @@
#include <tuple> #include <tuple>
#include <utility> #include <utility>
#include "absl/log/absl_log.h"
#include "mediapipe/framework/api2/packet.h" #include "mediapipe/framework/api2/packet.h"
#include "mediapipe/framework/api2/port.h" #include "mediapipe/framework/api2/port.h"
#include "mediapipe/framework/api2/test_contracts.h" #include "mediapipe/framework/api2/test_contracts.h"
@ -570,7 +571,7 @@ struct LogSinkNode : public Node {
MEDIAPIPE_NODE_CONTRACT(kIn); MEDIAPIPE_NODE_CONTRACT(kIn);
absl::Status Process(CalculatorContext* cc) override { absl::Status Process(CalculatorContext* cc) override {
LOG(INFO) << "LogSinkNode received: " << kIn(cc).Get(); ABSL_LOG(INFO) << "LogSinkNode received: " << kIn(cc).Get();
return {}; return {};
} }
}; };

View File

@ -26,7 +26,7 @@
#include <vector> #include <vector>
#include "absl/container/flat_hash_set.h" #include "absl/container/flat_hash_set.h"
#include "absl/log/log.h" #include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/status/status.h" #include "absl/status/status.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
@ -147,7 +147,7 @@ CalculatorGraph::~CalculatorGraph() {
// Stop periodic profiler output to unblock Executor destructors. // Stop periodic profiler output to unblock Executor destructors.
absl::Status status = profiler()->Stop(); absl::Status status = profiler()->Stop();
if (!status.ok()) { if (!status.ok()) {
LOG(ERROR) << "During graph destruction: " << status; ABSL_LOG(ERROR) << "During graph destruction: " << status;
} }
} }
@ -600,7 +600,7 @@ absl::Status CalculatorGraph::MaybeSetUpGpuServiceFromLegacySidePacket(
if (legacy_sp.IsEmpty()) return absl::OkStatus(); if (legacy_sp.IsEmpty()) return absl::OkStatus();
auto gpu_resources = service_manager_.GetServiceObject(kGpuService); auto gpu_resources = service_manager_.GetServiceObject(kGpuService);
if (gpu_resources) { if (gpu_resources) {
LOG(WARNING) ABSL_LOG(WARNING)
<< "::mediapipe::GpuSharedData provided as a side packet while the " << "::mediapipe::GpuSharedData provided as a side packet while the "
<< "graph already had one; ignoring side packet"; << "graph already had one; ignoring side packet";
return absl::OkStatus(); return absl::OkStatus();
@ -728,7 +728,7 @@ absl::Status CalculatorGraph::PrepareForRun(
absl::Status error_status; absl::Status error_status;
if (has_error_) { if (has_error_) {
GetCombinedErrors(&error_status); GetCombinedErrors(&error_status);
LOG(ERROR) << error_status.ToString(kStatusLogFlags); ABSL_LOG(ERROR) << error_status.ToString(kStatusLogFlags);
return error_status; return error_status;
} }
@ -807,7 +807,7 @@ absl::Status CalculatorGraph::PrepareForRun(
} }
if (GetCombinedErrors(&error_status)) { if (GetCombinedErrors(&error_status)) {
LOG(ERROR) << error_status.ToString(kStatusLogFlags); ABSL_LOG(ERROR) << error_status.ToString(kStatusLogFlags);
CleanupAfterRun(&error_status); CleanupAfterRun(&error_status);
return error_status; return error_status;
} }
@ -861,7 +861,7 @@ absl::Status CalculatorGraph::PrepareForRun(
absl::Status CalculatorGraph::WaitUntilIdle() { absl::Status CalculatorGraph::WaitUntilIdle() {
if (has_sources_) { if (has_sources_) {
LOG_FIRST_N(WARNING, 1) ABSL_LOG_FIRST_N(WARNING, 1)
<< "WaitUntilIdle called on a graph with source nodes, which " << "WaitUntilIdle called on a graph with source nodes, which "
"is not fully supported at the moment. Source nodes: " "is not fully supported at the moment. Source nodes: "
<< ListSourceNodes(); << ListSourceNodes();
@ -871,7 +871,7 @@ absl::Status CalculatorGraph::WaitUntilIdle() {
VLOG(2) << "Scheduler idle."; VLOG(2) << "Scheduler idle.";
absl::Status status = absl::OkStatus(); absl::Status status = absl::OkStatus();
if (GetCombinedErrors(&status)) { if (GetCombinedErrors(&status)) {
LOG(ERROR) << status.ToString(kStatusLogFlags); ABSL_LOG(ERROR) << status.ToString(kStatusLogFlags);
} }
return status; return status;
} }
@ -1064,10 +1064,11 @@ void CalculatorGraph::RecordError(const absl::Status& error) {
} }
if (errors_.size() > kMaxNumAccumulatedErrors) { if (errors_.size() > kMaxNumAccumulatedErrors) {
for (const absl::Status& error : errors_) { for (const absl::Status& error : errors_) {
LOG(ERROR) << error; ABSL_LOG(ERROR) << error;
} }
LOG(FATAL) << "Forcefully aborting to prevent the framework running out " ABSL_LOG(FATAL)
"of memory."; << "Forcefully aborting to prevent the framework running out "
"of memory.";
} }
} }
} }
@ -1264,7 +1265,7 @@ bool CalculatorGraph::UnthrottleSources() {
} }
int new_size = stream->QueueSize() + 1; int new_size = stream->QueueSize() + 1;
stream->SetMaxQueueSize(new_size); stream->SetMaxQueueSize(new_size);
LOG_EVERY_N(WARNING, 100) << absl::StrCat( ABSL_LOG_EVERY_N(WARNING, 100) << absl::StrCat(
"Resolved a deadlock by increasing max_queue_size of input stream: \"", "Resolved a deadlock by increasing max_queue_size of input stream: \"",
stream->Name(), "\" of a node \"", GetParentNodeDebugName(stream), stream->Name(), "\" of a node \"", GetParentNodeDebugName(stream),
"\" to ", new_size, "\" to ", new_size,
@ -1436,12 +1437,13 @@ void PrintTimingToInfo(const std::string& label, int64_t timer_value) {
const int64_t minutes = (total_seconds / 60ll) % 60ll; const int64_t minutes = (total_seconds / 60ll) % 60ll;
const int64_t seconds = total_seconds % 60ll; const int64_t seconds = total_seconds % 60ll;
const int64_t milliseconds = (timer_value / 1000ll) % 1000ll; const int64_t milliseconds = (timer_value / 1000ll) % 1000ll;
LOG(INFO) << label << " took " ABSL_LOG(INFO)
<< absl::StrFormat( << label << " took "
"%02lld days, %02lld:%02lld:%02lld.%03lld (total seconds: " << absl::StrFormat(
"%lld.%06lld)", "%02lld days, %02lld:%02lld:%02lld.%03lld (total seconds: "
days, hours, minutes, seconds, milliseconds, total_seconds, "%lld.%06lld)",
timer_value % int64_t{1000000}); days, hours, minutes, seconds, milliseconds, total_seconds,
timer_value % int64_t{1000000});
} }
bool MetricElementComparator(const std::pair<std::string, int64_t>& e1, bool MetricElementComparator(const std::pair<std::string, int64_t>& e1,

View File

@ -17,6 +17,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "absl/time/clock.h" #include "absl/time/clock.h"
#include "absl/time/time.h" #include "absl/time/time.h"
#include "mediapipe/framework/calculator.pb.h" #include "mediapipe/framework/calculator.pb.h"
@ -24,7 +25,6 @@
#include "mediapipe/framework/port/canonical_errors.h" #include "mediapipe/framework/port/canonical_errors.h"
#include "mediapipe/framework/port/gmock.h" #include "mediapipe/framework/port/gmock.h"
#include "mediapipe/framework/port/gtest.h" #include "mediapipe/framework/port/gtest.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/parse_text_proto.h" #include "mediapipe/framework/port/parse_text_proto.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
@ -128,7 +128,7 @@ class IntegerOutputSidePacketCalculator : public CalculatorBase {
} }
absl::Status Process(CalculatorContext* cc) final { absl::Status Process(CalculatorContext* cc) final {
LOG(FATAL) << "Not reached."; ABSL_LOG(FATAL) << "Not reached.";
return absl::OkStatus(); return absl::OkStatus();
} }
}; };
@ -153,7 +153,7 @@ class SidePacketAdderCalculator : public CalculatorBase {
} }
absl::Status Process(CalculatorContext* cc) final { absl::Status Process(CalculatorContext* cc) final {
LOG(FATAL) << "Not reached."; ABSL_LOG(FATAL) << "Not reached.";
return absl::OkStatus(); return absl::OkStatus();
} }
}; };
@ -778,7 +778,7 @@ class OutputSidePacketCachedCalculator : public CalculatorBase {
} }
absl::Status Process(CalculatorContext* cc) final { absl::Status Process(CalculatorContext* cc) final {
LOG(FATAL) << "Not reached."; ABSL_LOG(FATAL) << "Not reached.";
return absl::OkStatus(); return absl::OkStatus();
} }
}; };

View File

@ -29,6 +29,7 @@
#include <vector> #include <vector>
#include "absl/container/fixed_array.h" #include "absl/container/fixed_array.h"
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/status/status.h" #include "absl/status/status.h"
#include "absl/strings/escaping.h" #include "absl/strings/escaping.h"
@ -51,7 +52,6 @@
#include "mediapipe/framework/port/canonical_errors.h" #include "mediapipe/framework/port/canonical_errors.h"
#include "mediapipe/framework/port/gmock.h" #include "mediapipe/framework/port/gmock.h"
#include "mediapipe/framework/port/gtest.h" #include "mediapipe/framework/port/gtest.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/parse_text_proto.h" #include "mediapipe/framework/port/parse_text_proto.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
@ -1410,7 +1410,7 @@ void RunComprehensiveTest(CalculatorGraph* graph,
// Call graph->Run() several times, to make sure that the appropriate // Call graph->Run() several times, to make sure that the appropriate
// cleanup happens between iterations. // cleanup happens between iterations.
for (int iteration = 0; iteration < 2; ++iteration) { for (int iteration = 0; iteration < 2; ++iteration) {
LOG(INFO) << "Loop iteration " << iteration; ABSL_LOG(INFO) << "Loop iteration " << iteration;
dumped_final_sum_packet = Packet(); dumped_final_sum_packet = Packet();
dumped_final_stddev_packet = Packet(); dumped_final_stddev_packet = Packet();
dumped_final_packet = Packet(); dumped_final_packet = Packet();
@ -1452,7 +1452,7 @@ void RunComprehensiveTest(CalculatorGraph* graph,
->GetCounter("copy_range5-PassThrough") ->GetCounter("copy_range5-PassThrough")
->Get()); ->Get());
} }
LOG(INFO) << "After Loop Runs."; ABSL_LOG(INFO) << "After Loop Runs.";
// Verify that the graph can still run (but not successfully) when // Verify that the graph can still run (but not successfully) when
// one of the nodes is caused to fail. // one of the nodes is caused to fail.
extra_side_packets.clear(); extra_side_packets.clear();
@ -1463,9 +1463,9 @@ void RunComprehensiveTest(CalculatorGraph* graph,
dumped_final_sum_packet = Packet(); dumped_final_sum_packet = Packet();
dumped_final_stddev_packet = Packet(); dumped_final_stddev_packet = Packet();
dumped_final_packet = Packet(); dumped_final_packet = Packet();
LOG(INFO) << "Expect an error to be logged here."; ABSL_LOG(INFO) << "Expect an error to be logged here.";
ASSERT_FALSE(graph->Run(extra_side_packets).ok()); ASSERT_FALSE(graph->Run(extra_side_packets).ok());
LOG(INFO) << "Error should have been logged."; ABSL_LOG(INFO) << "Error should have been logged.";
} }
TEST(CalculatorGraph, BadInitialization) { TEST(CalculatorGraph, BadInitialization) {

View File

@ -19,6 +19,7 @@
#include <unordered_map> #include <unordered_map>
#include <utility> #include <utility>
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/status/status.h" #include "absl/status/status.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
@ -506,7 +507,7 @@ absl::Status CalculatorNode::OpenNode() {
Timestamp(0)); Timestamp(0));
} }
LOG_IF(FATAL, result == tool::StatusStop()) << absl::Substitute( ABSL_LOG_IF(FATAL, result == tool::StatusStop()) << absl::Substitute(
"Open() on node \"$0\" returned tool::StatusStop() which should only be " "Open() on node \"$0\" returned tool::StatusStop() which should only be "
"used to signal that a source node is done producing data.", "used to signal that a source node is done producing data.",
DebugName()); DebugName());
@ -519,7 +520,7 @@ absl::Status CalculatorNode::OpenNode() {
offset_enabled = offset_enabled || stream->Spec()->offset_enabled; offset_enabled = offset_enabled || stream->Spec()->offset_enabled;
} }
if (offset_enabled && input_stream_handler_->SyncSetCount() > 1) { if (offset_enabled && input_stream_handler_->SyncSetCount() > 1) {
LOG(WARNING) << absl::Substitute( ABSL_LOG(WARNING) << absl::Substitute(
"Calculator node \"$0\" is configured with multiple input sync-sets " "Calculator node \"$0\" is configured with multiple input sync-sets "
"and an output timestamp-offset, which will often conflict due to " "and an output timestamp-offset, which will often conflict due to "
"the order of packet arrival. With multiple input sync-sets, use " "the order of packet arrival. With multiple input sync-sets, use "
@ -601,7 +602,7 @@ absl::Status CalculatorNode::CloseNode(const absl::Status& graph_status,
} }
needs_to_close_ = false; needs_to_close_ = false;
LOG_IF(FATAL, result == tool::StatusStop()) << absl::Substitute( ABSL_LOG_IF(FATAL, result == tool::StatusStop()) << absl::Substitute(
"Close() on node \"$0\" returned tool::StatusStop() which should only be " "Close() on node \"$0\" returned tool::StatusStop() which should only be "
"used to signal that a source node is done producing data.", "used to signal that a source node is done producing data.",
DebugName()); DebugName());

View File

@ -18,11 +18,11 @@
#include <memory> #include <memory>
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/gmock.h" #include "mediapipe/framework/port/gmock.h"
#include "mediapipe/framework/port/gtest.h" #include "mediapipe/framework/port/gtest.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/parse_text_proto.h" #include "mediapipe/framework/port/parse_text_proto.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/port/status_macros.h" #include "mediapipe/framework/port/status_macros.h"
@ -95,7 +95,8 @@ int CountCalculator::num_destroyed_ = 0;
void SourceNodeOpenedNoOp() {} void SourceNodeOpenedNoOp() {}
void CheckFail(const absl::Status& status) { void CheckFail(const absl::Status& status) {
LOG(FATAL) << "The test triggered the error callback with status: " << status; ABSL_LOG(FATAL) << "The test triggered the error callback with status: "
<< status;
} }
class CalculatorNodeTest : public ::testing::Test { class CalculatorNodeTest : public ::testing::Test {

View File

@ -16,10 +16,10 @@
#include "mediapipe/framework/calculator_runner.h" #include "mediapipe/framework/calculator_runner.h"
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "mediapipe/framework/calculator_framework.h" #include "mediapipe/framework/calculator_framework.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/ret_check.h" #include "mediapipe/framework/port/ret_check.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
@ -262,16 +262,18 @@ absl::Status CalculatorRunner::BuildGraph() {
if (log_calculator_proto_) { if (log_calculator_proto_) {
#if defined(MEDIAPIPE_PROTO_LITE) #if defined(MEDIAPIPE_PROTO_LITE)
LOG(INFO) << "Please initialize CalculatorRunner using the recommended " ABSL_LOG(INFO)
"constructor:\n CalculatorRunner runner(node_config);"; << "Please initialize CalculatorRunner using the recommended "
"constructor:\n CalculatorRunner runner(node_config);";
#else #else
std::string config_string; std::string config_string;
proto_ns::TextFormat::Printer printer; proto_ns::TextFormat::Printer printer;
printer.SetInitialIndentLevel(4); printer.SetInitialIndentLevel(4);
printer.PrintToString(node_config_, &config_string); printer.PrintToString(node_config_, &config_string);
LOG(INFO) << "Please initialize CalculatorRunner using the recommended " ABSL_LOG(INFO)
"constructor:\n CalculatorRunner runner(R\"(\n" << "Please initialize CalculatorRunner using the recommended "
<< config_string << "\n )\");"; "constructor:\n CalculatorRunner runner(R\"(\n"
<< config_string << "\n )\");";
#endif #endif
} }

View File

@ -16,6 +16,7 @@
#include "mediapipe/framework/calculator_runner.h" #include "mediapipe/framework/calculator_runner.h"
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "mediapipe/framework/calculator_base.h" #include "mediapipe/framework/calculator_base.h"
#include "mediapipe/framework/calculator_registry.h" #include "mediapipe/framework/calculator_registry.h"
@ -24,7 +25,6 @@
#include "mediapipe/framework/packet_type.h" #include "mediapipe/framework/packet_type.h"
#include "mediapipe/framework/port/gmock.h" #include "mediapipe/framework/port/gmock.h"
#include "mediapipe/framework/port/gtest.h" #include "mediapipe/framework/port/gtest.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/status.h" #include "mediapipe/framework/port/status.h"
#include "mediapipe/framework/port/status_matchers.h" #include "mediapipe/framework/port/status_matchers.h"
#include "mediapipe/framework/timestamp.h" #include "mediapipe/framework/timestamp.h"
@ -136,7 +136,7 @@ TEST(CalculatorRunner, RunsCalculator) {
// Run CalculatorRunner::Run() several times, with different inputs. This // Run CalculatorRunner::Run() several times, with different inputs. This
// tests that a CalculatorRunner instance can be reused. // tests that a CalculatorRunner instance can be reused.
for (int iter = 0; iter < 3; ++iter) { for (int iter = 0; iter < 3; ++iter) {
LOG(INFO) << "iter: " << iter; ABSL_LOG(INFO) << "iter: " << iter;
const int length = iter; const int length = iter;
// Generate the inputs at timestamps 0 ... length-1, at timestamp t having // Generate the inputs at timestamps 0 ... length-1, at timestamp t having
// values t and t*2 for the two streams, respectively. // values t and t*2 for the two streams, respectively.

View File

@ -24,11 +24,11 @@
#include <vector> #include <vector>
#include "absl/base/macros.h" #include "absl/base/macros.h"
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "mediapipe/framework/collection_item_id.h" #include "mediapipe/framework/collection_item_id.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/tool/tag_map.h" #include "mediapipe/framework/tool/tag_map.h"
#include "mediapipe/framework/tool/tag_map_helper.h" #include "mediapipe/framework/tool/tag_map_helper.h"
#include "mediapipe/framework/tool/validate_name.h" #include "mediapipe/framework/tool/validate_name.h"
@ -52,7 +52,7 @@ struct CollectionErrorHandlerFatal {
// get away with only one version of this function (which is const // get away with only one version of this function (which is const
// but returns a non-const reference). // but returns a non-const reference).
T& GetFallback(const absl::string_view tag, int index) const { T& GetFallback(const absl::string_view tag, int index) const {
LOG(FATAL) << "Failed to get tag \"" << tag << "\" index " << index; ABSL_LOG(FATAL) << "Failed to get tag \"" << tag << "\" index " << index;
std::abort(); std::abort();
} }
}; };
@ -365,7 +365,7 @@ class Collection {
std::unique_ptr<stored_type[]> data_; std::unique_ptr<stored_type[]> data_;
// A class which allows errors to be reported flexibly. The default // A class which allows errors to be reported flexibly. The default
// instantiation performs a LOG(FATAL) and does not have any member // instantiation performs a ABSL_LOG(FATAL) and does not have any member
// variables (zero size). // variables (zero size).
ErrorHandler error_handler_; ErrorHandler error_handler_;
}; };

View File

@ -16,6 +16,7 @@
#include <vector> #include <vector>
#include "absl/log/absl_log.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "absl/synchronization/mutex.h" #include "absl/synchronization/mutex.h"
@ -59,9 +60,9 @@ void CounterSet::PublishCounters() ABSL_LOCKS_EXCLUDED(mu_) {}
void CounterSet::PrintCounters() ABSL_LOCKS_EXCLUDED(mu_) { void CounterSet::PrintCounters() ABSL_LOCKS_EXCLUDED(mu_) {
absl::ReaderMutexLock lock(&mu_); absl::ReaderMutexLock lock(&mu_);
LOG_IF(INFO, !counters_.empty()) << "MediaPipe Counters:"; ABSL_LOG_IF(INFO, !counters_.empty()) << "MediaPipe Counters:";
for (const auto& counter : counters_) { for (const auto& counter : counters_) {
LOG(INFO) << counter.first << ": " << counter.second->Get(); ABSL_LOG(INFO) << counter.first << ": " << counter.second->Get();
} }
} }

View File

@ -77,8 +77,9 @@ cc_library(
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//mediapipe/framework/port:logging",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
"@com_google_absl//absl/time", "@com_google_absl//absl/time",
], ],
@ -130,8 +131,9 @@ cc_library(
deps = [ deps = [
"//mediapipe/framework/port", "//mediapipe/framework/port",
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/log:check",
], ],
) )
@ -228,12 +230,13 @@ cc_library(
], ],
deps = [ deps = [
":registration_token", ":registration_token",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:status", "//mediapipe/framework/port:status",
"//mediapipe/framework/port:statusor", "//mediapipe/framework/port:statusor",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set", "@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/meta:type_traits", "@com_google_absl//absl/meta:type_traits",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
@ -276,8 +279,8 @@ cc_library(
visibility = ["//mediapipe/framework/port:__pkg__"], visibility = ["//mediapipe/framework/port:__pkg__"],
deps = [ deps = [
":source_location", ":source_location",
"//mediapipe/framework/port:logging",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/status", "@com_google_absl//absl/status",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
@ -344,6 +347,7 @@ cc_library(
deps = [ deps = [
":thread_options", ":thread_options",
"//mediapipe/framework/port:logging", "//mediapipe/framework/port:logging",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
], ],
@ -358,6 +362,7 @@ cc_library(
visibility = ["//mediapipe/framework/port:__pkg__"], visibility = ["//mediapipe/framework/port:__pkg__"],
deps = [ deps = [
"//mediapipe/framework/port:logging", "//mediapipe/framework/port:logging",
"@com_google_absl//absl/log:absl_log",
], ],
) )
@ -415,10 +420,10 @@ cc_test(
":clock", ":clock",
"//mediapipe/framework/port:gtest_main", "//mediapipe/framework/port:gtest_main",
"//mediapipe/framework/port:integral_types", "//mediapipe/framework/port:integral_types",
"//mediapipe/framework/port:logging",
"//mediapipe/framework/port:threadpool", "//mediapipe/framework/port:threadpool",
"//mediapipe/framework/tool:simulation_clock", "//mediapipe/framework/tool:simulation_clock",
"@com_google_absl//absl/base:core_headers", "@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/memory", "@com_google_absl//absl/memory",
"@com_google_absl//absl/synchronization", "@com_google_absl//absl/synchronization",
"@com_google_absl//absl/time", "@com_google_absl//absl/time",

View File

@ -26,7 +26,7 @@
// DataObject d; // DataObject d;
// while (ReadDataObject(fp, &d)) { // while (ReadDataObject(fp, &d)) {
// if (d.IsBad()) { // if (d.IsBad()) {
// LOG(ERROR) << "Bad Data"; // ABSL_LOG(ERROR) << "Bad Data";
// return; // return;
// } // }
// PushGoodData(d); // PushGoodData(d);

View File

@ -14,8 +14,8 @@
#include "mediapipe/framework/deps/clock.h" #include "mediapipe/framework/deps/clock.h"
#include "absl/log/absl_log.h"
#include "absl/time/clock.h" #include "absl/time/clock.h"
#include "mediapipe/framework/port/logging.h"
namespace mediapipe { namespace mediapipe {
@ -28,7 +28,7 @@ namespace {
class RealTimeClock : public Clock { class RealTimeClock : public Clock {
public: public:
virtual ~RealTimeClock() { virtual ~RealTimeClock() {
LOG(FATAL) << "RealTimeClock should never be destroyed"; ABSL_LOG(FATAL) << "RealTimeClock should never be destroyed";
} }
absl::Time TimeNow() override { return absl::Now(); } absl::Time TimeNow() override { return absl::Now(); }

View File

@ -16,9 +16,10 @@
#include "absl/base/macros.h" #include "absl/base/macros.h"
#include "absl/base/thread_annotations.h" #include "absl/base/thread_annotations.h"
#include "absl/log/absl_log.h"
#include "absl/log/check.h"
#include "absl/synchronization/mutex.h" #include "absl/synchronization/mutex.h"
#include "absl/time/time.h" #include "absl/time/time.h"
#include "mediapipe/framework/port/logging.h"
namespace mediapipe { namespace mediapipe {
@ -205,7 +206,7 @@ MonotonicClock* MonotonicClock::CreateSynchronizedMonotonicClock() {
// Test access methods. // Test access methods.
void MonotonicClockAccess::SynchronizedMonotonicClockReset() { void MonotonicClockAccess::SynchronizedMonotonicClockReset() {
LOG(INFO) << "Resetting SynchronizedMonotonicClock"; ABSL_LOG(INFO) << "Resetting SynchronizedMonotonicClock";
State* sync_state = GlobalSyncState(); State* sync_state = GlobalSyncState();
absl::MutexLock m(&sync_state->lock); absl::MutexLock m(&sync_state->lock);
sync_state->max_time = absl::UnixEpoch(); sync_state->max_time = absl::UnixEpoch();

View File

@ -21,13 +21,13 @@
#include <vector> #include <vector>
#include "absl/base/thread_annotations.h" #include "absl/base/thread_annotations.h"
#include "absl/log/absl_log.h"
#include "absl/memory/memory.h" #include "absl/memory/memory.h"
#include "absl/synchronization/mutex.h" #include "absl/synchronization/mutex.h"
#include "absl/time/clock.h" #include "absl/time/clock.h"
#include "absl/time/time.h" #include "absl/time/time.h"
#include "mediapipe/framework/port/gtest.h" #include "mediapipe/framework/port/gtest.h"
#include "mediapipe/framework/port/integral_types.h" #include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/threadpool.h" #include "mediapipe/framework/port/threadpool.h"
#include "mediapipe/framework/tool/simulation_clock.h" #include "mediapipe/framework/tool/simulation_clock.h"
@ -254,8 +254,8 @@ TEST_F(MonotonicClockTest, RealTime) {
// Just out of curiousity -- did real clock go backwards? // Just out of curiousity -- did real clock go backwards?
int clock_num_corrections; int clock_num_corrections;
mono_clock->GetCorrectionMetrics(&clock_num_corrections, NULL); mono_clock->GetCorrectionMetrics(&clock_num_corrections, NULL);
LOG(INFO) << clock_num_corrections << " corrections in " << num_calls ABSL_LOG(INFO) << clock_num_corrections << " corrections in " << num_calls
<< " calls to mono_clock->Now()"; << " calls to mono_clock->Now()";
delete mono_clock; delete mono_clock;
} }
@ -523,13 +523,13 @@ TEST_F(MonotonicClockTest, RealFrenzy) {
// Just out of curiousity -- did real clock go backwards? // Just out of curiousity -- did real clock go backwards?
int clock_num_corrections; int clock_num_corrections;
m1->GetCorrectionMetrics(&clock_num_corrections, NULL); m1->GetCorrectionMetrics(&clock_num_corrections, NULL);
LOG_IF(INFO, clock_num_corrections > 0) ABSL_LOG_IF(INFO, clock_num_corrections > 0)
<< clock_num_corrections << " corrections"; << clock_num_corrections << " corrections";
m2->GetCorrectionMetrics(&clock_num_corrections, NULL); m2->GetCorrectionMetrics(&clock_num_corrections, NULL);
LOG_IF(INFO, clock_num_corrections > 0) ABSL_LOG_IF(INFO, clock_num_corrections > 0)
<< clock_num_corrections << " corrections"; << clock_num_corrections << " corrections";
m3->GetCorrectionMetrics(&clock_num_corrections, NULL); m3->GetCorrectionMetrics(&clock_num_corrections, NULL);
LOG_IF(INFO, clock_num_corrections > 0) ABSL_LOG_IF(INFO, clock_num_corrections > 0)
<< clock_num_corrections << " corrections"; << clock_num_corrections << " corrections";
delete m1; delete m1;
delete m2; delete m2;

View File

@ -28,6 +28,8 @@
#include "absl/base/thread_annotations.h" #include "absl/base/thread_annotations.h"
#include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h" #include "absl/container/flat_hash_set.h"
#include "absl/log/absl_log.h"
#include "absl/log/check.h"
#include "absl/meta/type_traits.h" #include "absl/meta/type_traits.h"
#include "absl/strings/str_join.h" #include "absl/strings/str_join.h"
#include "absl/strings/str_split.h" #include "absl/strings/str_split.h"
@ -35,7 +37,6 @@
#include "absl/synchronization/mutex.h" #include "absl/synchronization/mutex.h"
#include "mediapipe/framework/deps/registration_token.h" #include "mediapipe/framework/deps/registration_token.h"
#include "mediapipe/framework/port/canonical_errors.h" #include "mediapipe/framework/port/canonical_errors.h"
#include "mediapipe/framework/port/logging.h"
#include "mediapipe/framework/port/statusor.h" #include "mediapipe/framework/port/statusor.h"
namespace mediapipe { namespace mediapipe {
@ -191,7 +192,7 @@ class FunctionRegistry {
return RegistrationToken( return RegistrationToken(
[this, normalized_name]() { Unregister(normalized_name); }); [this, normalized_name]() { Unregister(normalized_name); });
} }
LOG(FATAL) << "Function with name " << name << " already registered."; ABSL_LOG(FATAL) << "Function with name " << name << " already registered.";
return RegistrationToken([]() {}); return RegistrationToken([]() {});
} }

View File

@ -34,7 +34,7 @@
// define any custom policy they desire. // define any custom policy they desire.
// //
// PolicyTypes: // PolicyTypes:
// LogFatalOnError: LOG(FATAL) when a error occurs. // LogFatalOnError: ABSL_LOG(FATAL) when a error occurs.
#ifndef MEDIAPIPE_DEPS_SAFE_INT_H_ #ifndef MEDIAPIPE_DEPS_SAFE_INT_H_
#define MEDIAPIPE_DEPS_SAFE_INT_H_ #define MEDIAPIPE_DEPS_SAFE_INT_H_
@ -44,8 +44,9 @@
#include <limits> #include <limits>
#include <type_traits> #include <type_traits>
#include "absl/log/absl_log.h"
#include "absl/log/check.h"
#include "mediapipe/framework/deps/strong_int.h" #include "mediapipe/framework/deps/strong_int.h"
#include "mediapipe/framework/port/logging.h"
namespace mediapipe { namespace mediapipe {
namespace intops { namespace intops {
@ -284,15 +285,15 @@ class SafeIntStrongIntValidator {
} }
}; };
// A SafeIntStrongIntValidator policy class to LOG(FATAL) on errors. // A SafeIntStrongIntValidator policy class to ABSL_LOG(FATAL) on errors.
struct LogFatalOnError { struct LogFatalOnError {
template <typename Tlhs, typename Trhs> template <typename Tlhs, typename Trhs>
static void Error(const char* error, Tlhs lhs, Trhs rhs, const char* op) { static void Error(const char* error, Tlhs lhs, Trhs rhs, const char* op) {
LOG(FATAL) << error << ": (" << lhs << " " << op << " " << rhs << ")"; ABSL_LOG(FATAL) << error << ": (" << lhs << " " << op << " " << rhs << ")";
} }
template <typename Tval> template <typename Tval>
static void Error(const char* error, Tval val, const char* op) { static void Error(const char* error, Tval val, const char* op) {
LOG(FATAL) << error << ": (" << op << val << ")"; ABSL_LOG(FATAL) << error << ": (" << op << val << ")";
} }
}; };

View File

@ -21,9 +21,9 @@
#include <string> #include <string>
#include "absl/base/attributes.h" #include "absl/base/attributes.h"
#include "absl/log/absl_log.h"
#include "absl/status/status.h" #include "absl/status/status.h"
#include "absl/strings/string_view.h" #include "absl/strings/string_view.h"
#include "mediapipe/framework/port/logging.h"
namespace mediapipe { namespace mediapipe {
@ -44,7 +44,7 @@ inline std::string* MediaPipeCheckOpHelper(absl::Status v, const char* msg) {
#define MEDIAPIPE_DO_CHECK_OK(val, level) \ #define MEDIAPIPE_DO_CHECK_OK(val, level) \
while (auto _result = mediapipe::MediaPipeCheckOpHelper(val, #val)) \ while (auto _result = mediapipe::MediaPipeCheckOpHelper(val, #val)) \
LOG(level) << *(_result) ABSL_LOG(level) << *(_result)
#define MEDIAPIPE_CHECK_OK(val) MEDIAPIPE_DO_CHECK_OK(val, FATAL) #define MEDIAPIPE_CHECK_OK(val) MEDIAPIPE_DO_CHECK_OK(val, FATAL)
#define MEDIAPIPE_QCHECK_OK(val) MEDIAPIPE_DO_CHECK_OK(val, QFATAL) #define MEDIAPIPE_QCHECK_OK(val) MEDIAPIPE_DO_CHECK_OK(val, QFATAL)
@ -53,7 +53,7 @@ inline std::string* MediaPipeCheckOpHelper(absl::Status v, const char* msg) {
#define MEDIAPIPE_DCHECK_OK(val) MEDIAPIPE_CHECK_OK(val) #define MEDIAPIPE_DCHECK_OK(val) MEDIAPIPE_CHECK_OK(val)
#else #else
#define MEDIAPIPE_DCHECK_OK(val) \ #define MEDIAPIPE_DCHECK_OK(val) \
while (false && (absl::OkStatus() == (val))) LOG(FATAL) while (false && (absl::OkStatus() == (val))) ABSL_LOG(FATAL)
#endif #endif
#define CHECK_OK MEDIAPIPE_CHECK_OK #define CHECK_OK MEDIAPIPE_CHECK_OK

View File

@ -103,6 +103,7 @@
#include <type_traits> #include <type_traits>
#include "absl/base/macros.h" #include "absl/base/macros.h"
#include "absl/log/absl_log.h"
#include "mediapipe/framework/port/integral_types.h" #include "mediapipe/framework/port/integral_types.h"
#include "mediapipe/framework/port/port.h" #include "mediapipe/framework/port/port.h"
@ -134,7 +135,7 @@ struct NullStrongIntValidator {
// //
// template<typename T, typename U> // template<typename T, typename U>
// static void ValidateInit(U arg) { // static void ValidateInit(U arg) {
// if (arg < 0) LOG(FATAL) << "arg < 0"; // if (arg < 0) ABSL_LOG(FATAL) << "arg < 0";
// } // }
// //
// template<typename T, typename U> // template<typename T, typename U>

View File

@ -18,6 +18,7 @@
#include <sys/syscall.h> #include <sys/syscall.h>
#include <unistd.h> #include <unistd.h>
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h" #include "absl/strings/str_join.h"
#include "mediapipe/framework/deps/threadpool.h" #include "mediapipe/framework/deps/threadpool.h"
@ -67,9 +68,9 @@ void* ThreadPool::WorkerThread::ThreadBody(void* arg) {
if (nice(nice_priority_level) != -1 || errno == 0) { if (nice(nice_priority_level) != -1 || errno == 0) {
VLOG(1) << "Changed the nice priority level by " << nice_priority_level; VLOG(1) << "Changed the nice priority level by " << nice_priority_level;
} else { } else {
LOG(ERROR) << "Error : " << strerror(errno) << std::endl ABSL_LOG(ERROR) << "Error : " << strerror(errno) << std::endl
<< "Could not change the nice priority level by " << "Could not change the nice priority level by "
<< nice_priority_level; << nice_priority_level;
} }
} }
if (!selected_cpus.empty()) { if (!selected_cpus.empty()) {
@ -84,27 +85,27 @@ void* ThreadPool::WorkerThread::ThreadBody(void* arg) {
VLOG(1) << "Pinned the thread pool executor to processor " VLOG(1) << "Pinned the thread pool executor to processor "
<< absl::StrJoin(selected_cpus, ", processor ") << "."; << absl::StrJoin(selected_cpus, ", processor ") << ".";
} else { } else {
LOG(ERROR) << "Error : " << strerror(errno) << std::endl ABSL_LOG(ERROR) << "Error : " << strerror(errno) << std::endl
<< "Failed to set processor affinity. Ignore processor " << "Failed to set processor affinity. Ignore processor "
"affinity setting for now."; "affinity setting for now.";
} }
} }
int error = pthread_setname_np(pthread_self(), name.c_str()); int error = pthread_setname_np(pthread_self(), name.c_str());
if (error != 0) { if (error != 0) {
LOG(ERROR) << "Error : " << strerror(error) << std::endl ABSL_LOG(ERROR) << "Error : " << strerror(error) << std::endl
<< "Failed to set name for thread: " << name; << "Failed to set name for thread: " << name;
} }
#else #else
const std::string name = internal::CreateThreadName(thread->name_prefix_, 0); const std::string name = internal::CreateThreadName(thread->name_prefix_, 0);
if (nice_priority_level != 0 || !selected_cpus.empty()) { if (nice_priority_level != 0 || !selected_cpus.empty()) {
LOG(ERROR) << "Thread priority and processor affinity feature aren't " ABSL_LOG(ERROR) << "Thread priority and processor affinity feature aren't "
"supported on the current platform."; "supported on the current platform.";
} }
#if __APPLE__ #if __APPLE__
int error = pthread_setname_np(name.c_str()); int error = pthread_setname_np(name.c_str());
if (error != 0) { if (error != 0) {
LOG(ERROR) << "Error : " << strerror(error) << std::endl ABSL_LOG(ERROR) << "Error : " << strerror(error) << std::endl
<< "Failed to set name for thread: " << name; << "Failed to set name for thread: " << name;
} }
#endif // __APPLE__ #endif // __APPLE__
#endif // __linux__ #endif // __linux__

View File

@ -26,9 +26,9 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "absl/log/absl_log.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "absl/strings/str_join.h" #include "absl/strings/str_join.h"
#include "mediapipe/framework/port/logging.h"
namespace mediapipe { namespace mediapipe {
@ -67,8 +67,9 @@ void* ThreadPool::WorkerThread::ThreadBody(void* arg) {
thread->pool_->thread_options().nice_priority_level(); thread->pool_->thread_options().nice_priority_level();
const std::set<int> selected_cpus = thread->pool_->thread_options().cpu_set(); const std::set<int> selected_cpus = thread->pool_->thread_options().cpu_set();
if (nice_priority_level != 0 || !selected_cpus.empty()) { if (nice_priority_level != 0 || !selected_cpus.empty()) {
LOG(ERROR) << "Thread priority and processor affinity feature aren't " ABSL_LOG(ERROR)
"supported by the std::thread threadpool implementation."; << "Thread priority and processor affinity feature aren't "
"supported by the std::thread threadpool implementation.";
} }
thread->pool_->RunWorker(); thread->pool_->RunWorker();
return nullptr; return nullptr;

View File

@ -40,7 +40,7 @@ namespace mediapipe {
// if (cyclic) { // if (cyclic) {
// PrintCycleNodes(cycle_nodes); // PrintCycleNodes(cycle_nodes);
// } else { // } else {
// LOG(INFO) << idx; // ABSL_LOG(INFO) << idx;
// } // }
// } // }
class TopologicalSorter { class TopologicalSorter {

Some files were not shown because too many files have changed in this diff Show More