From eaf080784987a25aedcac8c7f77b735aba2a389f Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Fri, 27 Oct 2023 08:06:51 -0700 Subject: [PATCH] Fixes multiple typos in the calculator's internal files. PiperOrigin-RevId: 577202836 --- .../calculators/tensor/image_to_tensor_calculator.cc | 4 ++-- .../tensor/image_to_tensor_converter_gl_buffer.cc | 8 ++++---- .../tensor/image_to_tensor_converter_gl_texture.cc | 10 +++++----- .../tensor/image_to_tensor_converter_metal.cc | 10 +++++----- mediapipe/calculators/tensor/image_to_tensor_utils.cc | 8 ++++---- mediapipe/calculators/tensor/image_to_tensor_utils.h | 10 +++++----- .../tensor/tensor_converter_calculator.proto | 2 +- .../tensor/tensors_to_classification_calculator.proto | 2 +- .../tensor/tensors_to_detections_calculator.cc | 4 ++-- .../tensor/tensors_to_detections_calculator.proto | 2 +- .../tensor/tensors_to_segmentation_calculator.cc | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/mediapipe/calculators/tensor/image_to_tensor_calculator.cc b/mediapipe/calculators/tensor/image_to_tensor_calculator.cc index 171b28eb4..924df6af3 100644 --- a/mediapipe/calculators/tensor/image_to_tensor_calculator.cc +++ b/mediapipe/calculators/tensor/image_to_tensor_calculator.cc @@ -82,7 +82,7 @@ namespace api2 { // // Outputs: // TENSORS - std::vector -// Vector containing a single Tensor populated with an extrated RGB image. +// Vector containing a single Tensor populated with an extracted RGB image. // MATRIX - std::array @Optional // An std::array representing a 4x4 row-major-order matrix that // maps a point on the input image to a point on the output tensor, and @@ -212,7 +212,7 @@ class ImageToTensorCalculator : public Node { std::array matrix; GetRotatedSubRectToRectTransformMatrix( roi, image->width(), image->height(), - /*flip_horizontaly=*/false, &matrix); + /*flip_horizontally=*/false, &matrix); kOutMatrix(cc).Send(std::move(matrix)); } diff --git a/mediapipe/calculators/tensor/image_to_tensor_converter_gl_buffer.cc b/mediapipe/calculators/tensor/image_to_tensor_converter_gl_buffer.cc index b32b67869..04b791bd4 100644 --- a/mediapipe/calculators/tensor/image_to_tensor_converter_gl_buffer.cc +++ b/mediapipe/calculators/tensor/image_to_tensor_converter_gl_buffer.cc @@ -57,7 +57,7 @@ class SubRectExtractorGl { absl::Status ExtractSubRectToBuffer( const tflite::gpu::gl::GlTexture& texture, const tflite::gpu::HW& texture_size, const RotatedRect& sub_rect, - bool flip_horizontaly, float alpha, float beta, + bool flip_horizontally, float alpha, float beta, const tflite::gpu::HW& destination_size, tflite::gpu::gl::CommandQueue* command_queue, tflite::gpu::gl::GlBuffer* destination); @@ -154,13 +154,13 @@ void main() { absl::Status SubRectExtractorGl::ExtractSubRectToBuffer( const tflite::gpu::gl::GlTexture& texture, const tflite::gpu::HW& texture_size, const RotatedRect& texture_sub_rect, - bool flip_horizontaly, float alpha, float beta, + bool flip_horizontally, float alpha, float beta, const tflite::gpu::HW& destination_size, tflite::gpu::gl::CommandQueue* command_queue, tflite::gpu::gl::GlBuffer* destination) { std::array transform_mat; GetRotatedSubRectToRectTransformMatrix(texture_sub_rect, texture_size.w, - texture_size.h, flip_horizontaly, + texture_size.h, flip_horizontally, &transform_mat); MP_RETURN_IF_ERROR(texture.BindAsSampler2D(0)); @@ -308,7 +308,7 @@ class GlProcessor : public ImageToTensorConverter { input_texture, tflite::gpu::HW(source_texture.height(), source_texture.width()), roi, - /*flip_horizontaly=*/false, transform.scale, transform.offset, + /*flip_horizontally=*/false, transform.scale, transform.offset, tflite::gpu::HW(output_shape.dims[1], output_shape.dims[2]), command_queue_.get(), &output)); diff --git a/mediapipe/calculators/tensor/image_to_tensor_converter_gl_texture.cc b/mediapipe/calculators/tensor/image_to_tensor_converter_gl_texture.cc index 2522cae85..930d9fe21 100644 --- a/mediapipe/calculators/tensor/image_to_tensor_converter_gl_texture.cc +++ b/mediapipe/calculators/tensor/image_to_tensor_converter_gl_texture.cc @@ -199,7 +199,7 @@ class GlProcessor : public ImageToTensorConverter { range_min, range_max)); auto tensor_view = output_tensor.GetOpenGlTexture2dWriteView(); MP_RETURN_IF_ERROR(ExtractSubRect(input_texture, roi, - /*flip_horizontaly=*/false, + /*flip_horizontally=*/false, transform.scale, transform.offset, output_shape, &tensor_view)); return absl::OkStatus(); @@ -210,7 +210,7 @@ class GlProcessor : public ImageToTensorConverter { absl::Status ExtractSubRect(const mediapipe::GlTexture& texture, const RotatedRect& sub_rect, - bool flip_horizontaly, float alpha, float beta, + bool flip_horizontally, float alpha, float beta, const Tensor::Shape& output_shape, Tensor::OpenGlTexture2dView* output) { const int output_height = output_shape.dims[1]; @@ -263,13 +263,13 @@ class GlProcessor : public ImageToTensorConverter { ABSL_LOG_IF(FATAL, !gl_context) << "GlContext is not bound to the thread."; if (gl_context->GetGlVersion() == mediapipe::GlVersion::kGLES2) { GetTransposedRotatedSubRectToRectTransformMatrix( - sub_rect, texture.width(), texture.height(), flip_horizontaly, + sub_rect, texture.width(), texture.height(), flip_horizontally, &transform_mat); glUniformMatrix4fv(matrix_id_, 1, GL_FALSE, transform_mat.data()); } else { GetRotatedSubRectToRectTransformMatrix(sub_rect, texture.width(), - texture.height(), flip_horizontaly, - &transform_mat); + texture.height(), + flip_horizontally, &transform_mat); glUniformMatrix4fv(matrix_id_, 1, GL_TRUE, transform_mat.data()); } diff --git a/mediapipe/calculators/tensor/image_to_tensor_converter_metal.cc b/mediapipe/calculators/tensor/image_to_tensor_converter_metal.cc index cef2abcd7..f47d2da9a 100644 --- a/mediapipe/calculators/tensor/image_to_tensor_converter_metal.cc +++ b/mediapipe/calculators/tensor/image_to_tensor_converter_metal.cc @@ -179,13 +179,13 @@ class SubRectExtractorMetal { } absl::Status Execute(id input_texture, - const RotatedRect& sub_rect, bool flip_horizontaly, + const RotatedRect& sub_rect, bool flip_horizontally, float alpha, float beta, const tflite::gpu::HW& destination_size, id command_buffer, id destination) { auto output_texture = MTLTextureWithBuffer(destination_size, destination); - return InternalExecute(input_texture, sub_rect, flip_horizontaly, alpha, + return InternalExecute(input_texture, sub_rect, flip_horizontally, alpha, beta, destination_size, command_buffer, output_texture); } @@ -211,7 +211,7 @@ class SubRectExtractorMetal { absl::Status InternalExecute(id input_texture, const RotatedRect& sub_rect, - bool flip_horizontaly, float alpha, float beta, + bool flip_horizontally, float alpha, float beta, const tflite::gpu::HW& destination_size, id command_buffer, id output_texture) { @@ -223,7 +223,7 @@ class SubRectExtractorMetal { std::array transform_mat; GetRotatedSubRectToRectTransformMatrix(sub_rect, input_texture.width, input_texture.height, - flip_horizontaly, &transform_mat); + flip_horizontally, &transform_mat); id transform_mat_buffer = [device_ newBufferWithBytes:&transform_mat length:sizeof(transform_mat) @@ -383,7 +383,7 @@ class MetalProcessor : public ImageToTensorConverter { MtlBufferView::GetWriteView(output_tensor, command_buffer); MP_RETURN_IF_ERROR(extractor_->Execute( texture, roi, - /*flip_horizontaly=*/false, transform.scale, transform.offset, + /*flip_horizontally=*/false, transform.scale, transform.offset, tflite::gpu::HW(output_shape.dims[1], output_shape.dims[2]), command_buffer, buffer_view.buffer())); [command_buffer commit]; diff --git a/mediapipe/calculators/tensor/image_to_tensor_utils.cc b/mediapipe/calculators/tensor/image_to_tensor_utils.cc index 3f91f3dc2..b6ed5216c 100644 --- a/mediapipe/calculators/tensor/image_to_tensor_utils.cc +++ b/mediapipe/calculators/tensor/image_to_tensor_utils.cc @@ -92,7 +92,7 @@ absl::StatusOr GetValueRangeTransformation( void GetRotatedSubRectToRectTransformMatrix(const RotatedRect& sub_rect, int rect_width, int rect_height, - bool flip_horizontaly, + bool flip_horizontally, std::array* matrix_ptr) { std::array& matrix = *matrix_ptr; // The resulting matrix is multiplication of below commented out matrices: @@ -118,7 +118,7 @@ void GetRotatedSubRectToRectTransformMatrix(const RotatedRect& sub_rect, // {0.0f, 0.0f, a, 0.0f} // {0.0f, 0.0f, 0.0f, 1.0f} - const float flip = flip_horizontaly ? -1 : 1; + const float flip = flip_horizontally ? -1 : 1; // Matrix for optional horizontal flip around middle of output image. // { fl , 0.0f, 0.0f, 0.0f} // { 0.0f, 1.0f, 0.0f, 0.0f} @@ -177,13 +177,13 @@ void GetRotatedSubRectToRectTransformMatrix(const RotatedRect& sub_rect, void GetTransposedRotatedSubRectToRectTransformMatrix( const RotatedRect& sub_rect, int rect_width, int rect_height, - bool flip_horizontaly, std::array* matrix_ptr) { + bool flip_horizontally, std::array* matrix_ptr) { std::array& matrix = *matrix_ptr; // See comments in GetRotatedSubRectToRectTransformMatrix for detailed // calculations. const float a = sub_rect.width; const float b = sub_rect.height; - const float flip = flip_horizontaly ? -1 : 1; + const float flip = flip_horizontally ? -1 : 1; const float c = std::cos(sub_rect.rotation); const float d = std::sin(sub_rect.rotation); const float e = sub_rect.center_x; diff --git a/mediapipe/calculators/tensor/image_to_tensor_utils.h b/mediapipe/calculators/tensor/image_to_tensor_utils.h index a73529dce..63810923d 100644 --- a/mediapipe/calculators/tensor/image_to_tensor_utils.h +++ b/mediapipe/calculators/tensor/image_to_tensor_utils.h @@ -74,7 +74,7 @@ absl::StatusOr> PadRoi(int input_tensor_width, // Represents a transformation of value which involves scaling and offsetting. // To apply transformation: // ValueTransformation transform = ... -// float transformed_value = transform.scale * value + transfrom.offset; +// float transformed_value = transform.scale * value + transform.offset; struct ValueTransformation { float scale; float offset; @@ -99,11 +99,11 @@ absl::StatusOr GetValueRangeTransformation( // @sub_rect - rotated sub rect in absolute coordinates // @rect_width - rect width // @rect_height - rect height -// @flip_horizontaly - we need to flip the output buffer. +// @flip_horizontally - we need to flip the output buffer. // @matrix - 4x4 matrix (array of 16 elements) to populate void GetRotatedSubRectToRectTransformMatrix(const RotatedRect& sub_rect, int rect_width, int rect_height, - bool flip_horizontaly, + bool flip_horizontally, std::array* matrix); // Returns the transpose of the matrix found with @@ -118,11 +118,11 @@ void GetRotatedSubRectToRectTransformMatrix(const RotatedRect& sub_rect, // @sub_rect - rotated sub rect in absolute coordinates // @rect_width - rect width // @rect_height - rect height -// @flip_horizontaly - we need to flip the output buffer. +// @flip_horizontally - we need to flip the output buffer. // @matrix - 4x4 matrix (array of 16 elements) to populate void GetTransposedRotatedSubRectToRectTransformMatrix( const RotatedRect& sub_rect, int rect_width, int rect_height, - bool flip_horizontaly, std::array* matrix); + bool flip_horizontally, std::array* matrix); // Validates the output dimensions set in the option proto. The input option // proto is expected to have to following fields: diff --git a/mediapipe/calculators/tensor/tensor_converter_calculator.proto b/mediapipe/calculators/tensor/tensor_converter_calculator.proto index 2c5e0be56..b80d1e805 100644 --- a/mediapipe/calculators/tensor/tensor_converter_calculator.proto +++ b/mediapipe/calculators/tensor/tensor_converter_calculator.proto @@ -32,7 +32,7 @@ message TensorConverterCalculatorOptions { // Custom settings to override the internal scaling factors `div` and `sub`. // Both values must be set to non-negative values. Will only take effect on // CPU AND when |use_custom_normalization| is set to true. When these custom - // values take effect, the |zero_center| setting above will be overriden, and + // values take effect, the |zero_center| setting above will be overridden, and // the normalized_value will be calculated as: // normalized_value = input / custom_div - custom_sub. optional bool use_custom_normalization = 6 [default = false]; diff --git a/mediapipe/calculators/tensor/tensors_to_classification_calculator.proto b/mediapipe/calculators/tensor/tensors_to_classification_calculator.proto index 32bc4b63a..28012a455 100644 --- a/mediapipe/calculators/tensor/tensors_to_classification_calculator.proto +++ b/mediapipe/calculators/tensor/tensors_to_classification_calculator.proto @@ -34,7 +34,7 @@ message TensorsToClassificationCalculatorOptions { repeated Entry entries = 1; } - // Score threshold for perserving the class. + // Score threshold for preserving the class. optional float min_score_threshold = 1; // Number of highest scoring labels to output. If top_k is not positive then // all labels are used. diff --git a/mediapipe/calculators/tensor/tensors_to_detections_calculator.cc b/mediapipe/calculators/tensor/tensors_to_detections_calculator.cc index 8e649c0a1..aa2cfe734 100644 --- a/mediapipe/calculators/tensor/tensors_to_detections_calculator.cc +++ b/mediapipe/calculators/tensor/tensors_to_detections_calculator.cc @@ -147,7 +147,7 @@ BoxFormat GetBoxFormat(const TensorsToDetectionsCalculatorOptions& options) { // TENSORS - Vector of Tensors of type kFloat32. The vector of tensors can have // 2 or 3 tensors. First tensor is the predicted raw boxes/keypoints. // The size of the values must be (num_boxes * num_predicted_values). -// Second tensor is the score tensor. The size of the valuse must be +// Second tensor is the score tensor. The size of the values must be // (num_boxes * num_classes). It's optional to pass in a third tensor // for anchors (e.g. for SSD models) depend on the outputs of the // detection model. The size of anchor tensor must be (num_boxes * @@ -267,7 +267,7 @@ absl::Status TensorsToDetectionsCalculator::UpdateContract( if (CanUseGpu()) { #ifndef MEDIAPIPE_DISABLE_GL_COMPUTE MP_RETURN_IF_ERROR(mediapipe::GlCalculatorHelper::UpdateContract( - cc, /*requesst_gpu_as_optional=*/true)); + cc, /*request_gpu_as_optional=*/true)); #elif MEDIAPIPE_METAL_ENABLED MP_RETURN_IF_ERROR([MPPMetalHelper updateContract:cc]); #endif // !defined(MEDIAPIPE_DISABLE_GL_COMPUTE) diff --git a/mediapipe/calculators/tensor/tensors_to_detections_calculator.proto b/mediapipe/calculators/tensor/tensors_to_detections_calculator.proto index 5cedff6c7..49db8e3e7 100644 --- a/mediapipe/calculators/tensor/tensors_to_detections_calculator.proto +++ b/mediapipe/calculators/tensor/tensors_to_detections_calculator.proto @@ -75,7 +75,7 @@ message TensorsToDetectionsCalculatorOptions { // representation has a bottom-left origin (e.g., in OpenGL). optional bool flip_vertically = 18 [default = false]; - // Score threshold for perserving decoded detections. + // Score threshold for preserving decoded detections. optional float min_score_thresh = 19; // The maximum number of the detection results to return. If < 0, all diff --git a/mediapipe/calculators/tensor/tensors_to_segmentation_calculator.cc b/mediapipe/calculators/tensor/tensors_to_segmentation_calculator.cc index 6456126ae..24fd1bd52 100644 --- a/mediapipe/calculators/tensor/tensors_to_segmentation_calculator.cc +++ b/mediapipe/calculators/tensor/tensors_to_segmentation_calculator.cc @@ -208,7 +208,7 @@ absl::Status TensorsToSegmentationCalculator::GetContract( if (CanUseGpu()) { #if !MEDIAPIPE_DISABLE_GPU MP_RETURN_IF_ERROR(mediapipe::GlCalculatorHelper::UpdateContract( - cc, /*requesst_gpu_as_optional=*/true)); + cc, /*request_gpu_as_optional=*/true)); #if MEDIAPIPE_METAL_ENABLED MP_RETURN_IF_ERROR([MPPMetalHelper updateContract:cc]); #endif // MEDIAPIPE_METAL_ENABLED