Convert CHECK macro to ABSL_CHECK.
Chrome can't use Absl's CHECK because of collisions with its own version. PiperOrigin-RevId: 561740965
This commit is contained in:
committed by
Copybara-Service
parent
30802b80cd
commit
7c2d654d67
@@ -135,6 +135,7 @@ cc_library(
|
||||
"//mediapipe/framework/port:opencv_core",
|
||||
"//mediapipe/framework/port:opencv_imgproc",
|
||||
"//mediapipe/util/tracking:box_tracker_cc_proto",
|
||||
"@com_google_absl//absl/log:absl_check",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -149,6 +150,7 @@ cc_library(
|
||||
"//mediapipe/util/tracking:box_tracker_cc_proto",
|
||||
"@com_google_absl//absl/container:btree",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/log:absl_check",
|
||||
"@com_google_absl//absl/log:absl_log",
|
||||
],
|
||||
)
|
||||
@@ -163,6 +165,7 @@ cc_library(
|
||||
],
|
||||
deps = [
|
||||
"//mediapipe/framework/port:logging",
|
||||
"@com_google_absl//absl/log:absl_check",
|
||||
"@com_google_absl//absl/status",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"@eigen_archive//:eigen3",
|
||||
@@ -185,6 +188,7 @@ cc_library(
|
||||
"//mediapipe/framework/port:opencv_core",
|
||||
"//mediapipe/framework/port:opencv_imgproc",
|
||||
"//mediapipe/framework/port:status",
|
||||
"@com_google_absl//absl/log:absl_check",
|
||||
"@com_google_absl//absl/log:absl_log",
|
||||
"@com_google_absl//absl/status",
|
||||
"@eigen_archive//:eigen3",
|
||||
@@ -203,6 +207,7 @@ cc_library(
|
||||
"//mediapipe/framework/formats:tensor",
|
||||
"//mediapipe/framework/port:logging",
|
||||
"//mediapipe/framework/port:opencv_core",
|
||||
"@com_google_absl//absl/log:absl_check",
|
||||
"@org_tensorflow//tensorflow/lite:framework",
|
||||
],
|
||||
)
|
||||
@@ -223,6 +228,7 @@ cc_library(
|
||||
":annotation_cc_proto",
|
||||
":object_cc_proto",
|
||||
"//mediapipe/framework/port:logging",
|
||||
"@com_google_absl//absl/log:absl_check",
|
||||
"@eigen_archive//:eigen3",
|
||||
],
|
||||
)
|
||||
@@ -277,6 +283,7 @@ cc_library(
|
||||
"//mediapipe/framework/deps:file_path",
|
||||
"//mediapipe/framework/port:opencv_core",
|
||||
"//mediapipe/framework/port:ret_check",
|
||||
"@com_google_absl//absl/log:absl_check",
|
||||
"@com_google_absl//absl/log:absl_log",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
@@ -302,6 +309,7 @@ cc_library(
|
||||
"//mediapipe/framework/formats:tensor",
|
||||
"//mediapipe/framework/port:opencv_core",
|
||||
"//mediapipe/framework/port:ret_check",
|
||||
"@com_google_absl//absl/log:absl_check",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"@com_google_absl//absl/types:span",
|
||||
@@ -419,5 +427,6 @@ cc_test(
|
||||
"//mediapipe/framework/port:logging",
|
||||
"//mediapipe/util/tracking:box_tracker_cc_proto",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/log:absl_check",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "mediapipe/modules/objectron/calculators/box.h"
|
||||
|
||||
#include "Eigen/Core"
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "mediapipe/framework/port/logging.h"
|
||||
|
||||
namespace mediapipe {
|
||||
@@ -107,12 +108,12 @@ void Box::Adjust(const std::vector<float>& variables) {
|
||||
}
|
||||
|
||||
float* Box::GetVertex(size_t vertex_id) {
|
||||
CHECK_LT(vertex_id, kNumKeypoints);
|
||||
ABSL_CHECK_LT(vertex_id, kNumKeypoints);
|
||||
return bounding_box_[vertex_id].data();
|
||||
}
|
||||
|
||||
const float* Box::GetVertex(size_t vertex_id) const {
|
||||
CHECK_LT(vertex_id, kNumKeypoints);
|
||||
ABSL_CHECK_LT(vertex_id, kNumKeypoints);
|
||||
return bounding_box_[vertex_id].data();
|
||||
}
|
||||
|
||||
@@ -135,7 +136,7 @@ bool Box::InsideTest(const Eigen::Vector3f& point, int check_axis) const {
|
||||
}
|
||||
|
||||
void Box::Deserialize(const Object& obj) {
|
||||
CHECK_EQ(obj.keypoints_size(), kNumKeypoints);
|
||||
ABSL_CHECK_EQ(obj.keypoints_size(), kNumKeypoints);
|
||||
Model::Deserialize(obj);
|
||||
}
|
||||
|
||||
@@ -222,7 +223,7 @@ std::pair<Vector3f, Vector3f> Box::GetGroundPlane() const {
|
||||
|
||||
template <typename T>
|
||||
void Box::Fit(const std::vector<T>& vertices) {
|
||||
CHECK_EQ(vertices.size(), kNumKeypoints);
|
||||
ABSL_CHECK_EQ(vertices.size(), kNumKeypoints);
|
||||
scale_.setZero();
|
||||
// The scale would remain invariant under rotation and translation.
|
||||
// We can safely estimate the scale from the oriented box.
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "mediapipe/framework/port/logging.h"
|
||||
#include "mediapipe/framework/port/opencv_core_inc.h"
|
||||
#include "mediapipe/framework/port/opencv_imgproc_inc.h"
|
||||
@@ -24,7 +25,7 @@
|
||||
namespace mediapipe {
|
||||
void ComputeBoundingRect(const std::vector<cv::Point2f>& points,
|
||||
mediapipe::TimedBoxProto* box) {
|
||||
CHECK(box != nullptr);
|
||||
ABSL_CHECK(box != nullptr);
|
||||
float top = 1.0f;
|
||||
float bottom = 0.0f;
|
||||
float left = 1.0f;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "Eigen/Core"
|
||||
#include "Eigen/Dense"
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "absl/log/absl_log.h"
|
||||
#include "absl/status/status.h"
|
||||
#include "mediapipe/framework/port/canonical_errors.h"
|
||||
@@ -46,10 +47,10 @@ inline void SetPoint3d(const Eigen::Vector3f& point_vec, Point3D* point_3d) {
|
||||
|
||||
FrameAnnotation Decoder::DecodeBoundingBoxKeypoints(
|
||||
const cv::Mat& heatmap, const cv::Mat& offsetmap) const {
|
||||
CHECK_EQ(1, heatmap.channels());
|
||||
CHECK_EQ(kNumOffsetmaps, offsetmap.channels());
|
||||
CHECK_EQ(heatmap.cols, offsetmap.cols);
|
||||
CHECK_EQ(heatmap.rows, offsetmap.rows);
|
||||
ABSL_CHECK_EQ(1, heatmap.channels());
|
||||
ABSL_CHECK_EQ(kNumOffsetmaps, offsetmap.channels());
|
||||
ABSL_CHECK_EQ(heatmap.cols, offsetmap.cols);
|
||||
ABSL_CHECK_EQ(heatmap.rows, offsetmap.rows);
|
||||
|
||||
const float offset_scale = std::min(offsetmap.cols, offsetmap.rows);
|
||||
const std::vector<cv::Point> center_points = ExtractCenterKeypoints(heatmap);
|
||||
@@ -201,10 +202,10 @@ std::vector<cv::Point> Decoder::ExtractCenterKeypoints(
|
||||
absl::Status Decoder::Lift2DTo3D(
|
||||
const Eigen::Matrix<float, 4, 4, Eigen::RowMajor>& projection_matrix,
|
||||
bool portrait, FrameAnnotation* estimated_box) const {
|
||||
CHECK(estimated_box != nullptr);
|
||||
ABSL_CHECK(estimated_box != nullptr);
|
||||
|
||||
for (auto& annotation : *estimated_box->mutable_annotations()) {
|
||||
CHECK_EQ(kNumKeypoints, annotation.keypoints_size());
|
||||
ABSL_CHECK_EQ(kNumKeypoints, annotation.keypoints_size());
|
||||
|
||||
// Fill input 2D Points;
|
||||
std::vector<Vector2f> input_points_2d;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "mediapipe/modules/objectron/calculators/epnp.h"
|
||||
|
||||
#include "absl/log/absl_check.h"
|
||||
|
||||
namespace mediapipe {
|
||||
|
||||
namespace {
|
||||
@@ -126,7 +128,7 @@ absl::Status SolveEpnp(const float focal_x, const float focal_y,
|
||||
if (eigen_solver.info() != Eigen::Success) {
|
||||
return absl::AbortedError("Eigen decomposition failed.");
|
||||
}
|
||||
CHECK_EQ(12, eigen_solver.eigenvalues().size());
|
||||
ABSL_CHECK_EQ(12, eigen_solver.eigenvalues().size());
|
||||
|
||||
// Eigenvalues are sorted in increasing order for SelfAdjointEigenSolver
|
||||
// only! If you use other Eigen Solvers, it's not guaranteed to be in
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "mediapipe/modules/objectron/calculators/frame_annotation_tracker.h"
|
||||
|
||||
#include "absl/container/flat_hash_set.h"
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "absl/log/absl_log.h"
|
||||
#include "mediapipe/modules/objectron/calculators/annotation_data.pb.h"
|
||||
#include "mediapipe/modules/objectron/calculators/box_util.h"
|
||||
@@ -35,7 +36,7 @@ void FrameAnnotationTracker::AddDetectionResult(
|
||||
FrameAnnotation FrameAnnotationTracker::ConsolidateTrackingResult(
|
||||
const TimedBoxProtoList& tracked_boxes,
|
||||
absl::flat_hash_set<int>* cancel_object_ids) {
|
||||
CHECK(cancel_object_ids != nullptr);
|
||||
ABSL_CHECK(cancel_object_ids != nullptr);
|
||||
FrameAnnotation frame_annotation;
|
||||
std::vector<int64_t> keys_to_be_deleted;
|
||||
for (const auto& detected_obj : detected_objects_) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "mediapipe/modules/objectron/calculators/frame_annotation_tracker.h"
|
||||
|
||||
#include "absl/container/flat_hash_set.h"
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
#include "mediapipe/framework/port/logging.h"
|
||||
@@ -53,7 +54,7 @@ ObjectAnnotation ConstructFixedObject(
|
||||
ObjectAnnotation obj;
|
||||
for (const auto& point : points) {
|
||||
auto* keypoint = obj.add_keypoints();
|
||||
CHECK_EQ(2, point.size());
|
||||
ABSL_CHECK_EQ(2, point.size());
|
||||
keypoint->mutable_point_2d()->set_x(point[0]);
|
||||
keypoint->mutable_point_2d()->set_y(point[1]);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "mediapipe/modules/objectron/calculators/model.h"
|
||||
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "mediapipe/framework/port/logging.h"
|
||||
|
||||
namespace mediapipe {
|
||||
@@ -66,9 +67,9 @@ const Eigen::Ref<const Eigen::Matrix3f> Model::GetRotation() const {
|
||||
const std::string& Model::GetCategory() const { return category_; }
|
||||
|
||||
void Model::Deserialize(const Object& obj) {
|
||||
CHECK_EQ(obj.rotation_size(), 9);
|
||||
CHECK_EQ(obj.translation_size(), 3);
|
||||
CHECK_EQ(obj.scale_size(), 3);
|
||||
ABSL_CHECK_EQ(obj.rotation_size(), 9);
|
||||
ABSL_CHECK_EQ(obj.translation_size(), 3);
|
||||
ABSL_CHECK_EQ(obj.scale_size(), 3);
|
||||
category_ = obj.category();
|
||||
|
||||
using RotationMatrix = Eigen::Matrix<float, 3, 3, Eigen::RowMajor>;
|
||||
|
||||
@@ -14,14 +14,16 @@
|
||||
|
||||
#include "mediapipe/modules/objectron/calculators/tensor_util.h"
|
||||
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "mediapipe/framework/port/logging.h"
|
||||
|
||||
namespace mediapipe {
|
||||
|
||||
cv::Mat ConvertTfliteTensorToCvMat(const TfLiteTensor& tensor) {
|
||||
// Check tensor is BxCxWxH (size = 4) and the batch size is one(data[0] = 1)
|
||||
CHECK(tensor.dims->size == 4 && tensor.dims->data[0] == 1);
|
||||
CHECK_EQ(kTfLiteFloat32, tensor.type) << "tflite_tensor type is not float";
|
||||
ABSL_CHECK(tensor.dims->size == 4 && tensor.dims->data[0] == 1);
|
||||
ABSL_CHECK_EQ(kTfLiteFloat32, tensor.type)
|
||||
<< "tflite_tensor type is not float";
|
||||
|
||||
const size_t num_output_channels = tensor.dims->data[3];
|
||||
const int dims = 2;
|
||||
@@ -32,9 +34,9 @@ cv::Mat ConvertTfliteTensorToCvMat(const TfLiteTensor& tensor) {
|
||||
|
||||
cv::Mat ConvertTensorToCvMat(const mediapipe::Tensor& tensor) {
|
||||
// Check tensor is BxCxWxH (size = 4) and the batch size is one(data[0] = 1)
|
||||
CHECK(tensor.shape().dims.size() == 4 && tensor.shape().dims[0] == 1);
|
||||
CHECK_EQ(mediapipe::Tensor::ElementType::kFloat32 == tensor.element_type(),
|
||||
true)
|
||||
ABSL_CHECK(tensor.shape().dims.size() == 4 && tensor.shape().dims[0] == 1);
|
||||
ABSL_CHECK_EQ(
|
||||
mediapipe::Tensor::ElementType::kFloat32 == tensor.element_type(), true)
|
||||
<< "tensor type is not float";
|
||||
|
||||
const size_t num_output_channels = tensor.shape().dims[3];
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "Eigen/Dense"
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "absl/log/absl_log.h"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
@@ -171,7 +172,7 @@ absl::Status TensorsToObjectsCalculator::LoadOptions(CalculatorContext* cc) {
|
||||
num_keypoints_ = options_.num_keypoints();
|
||||
|
||||
// Currently only support 2D when num_values_per_keypoint equals to 2.
|
||||
CHECK_EQ(options_.num_values_per_keypoint(), 2);
|
||||
ABSL_CHECK_EQ(options_.num_values_per_keypoint(), 2);
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "Eigen/Dense"
|
||||
#include "absl/log/absl_check.h"
|
||||
#include "absl/log/absl_log.h"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
@@ -179,7 +180,7 @@ absl::Status TfLiteTensorsToObjectsCalculator::LoadOptions(
|
||||
num_keypoints_ = options_.num_keypoints();
|
||||
|
||||
// Currently only support 2D when num_values_per_keypoint equals to 2.
|
||||
CHECK_EQ(options_.num_values_per_keypoint(), 2);
|
||||
ABSL_CHECK_EQ(options_.num_values_per_keypoint(), 2);
|
||||
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user