Internal change
PiperOrigin-RevId: 486805777
This commit is contained in:
parent
c3bb4bb5da
commit
716c7e3b8a
|
@ -1324,6 +1324,7 @@ cc_test(
|
||||||
name = "image_to_tensor_utils_test",
|
name = "image_to_tensor_utils_test",
|
||||||
srcs = ["image_to_tensor_utils_test.cc"],
|
srcs = ["image_to_tensor_utils_test.cc"],
|
||||||
deps = [
|
deps = [
|
||||||
|
":image_to_tensor_calculator_cc_proto",
|
||||||
":image_to_tensor_utils",
|
":image_to_tensor_utils",
|
||||||
"//mediapipe/framework/formats:rect_cc_proto",
|
"//mediapipe/framework/formats:rect_cc_proto",
|
||||||
"//mediapipe/framework/port:gtest_main",
|
"//mediapipe/framework/port:gtest_main",
|
||||||
|
|
|
@ -330,9 +330,8 @@ class GlProcessor : public ImageToTensorConverter {
|
||||||
absl::Status ValidateTensorShape(const Tensor::Shape& output_shape) {
|
absl::Status ValidateTensorShape(const Tensor::Shape& output_shape) {
|
||||||
RET_CHECK_EQ(output_shape.dims.size(), 4)
|
RET_CHECK_EQ(output_shape.dims.size(), 4)
|
||||||
<< "Wrong output dims size: " << output_shape.dims.size();
|
<< "Wrong output dims size: " << output_shape.dims.size();
|
||||||
RET_CHECK_EQ(output_shape.dims[0], 1)
|
RET_CHECK_GE(output_shape.dims[0], 1)
|
||||||
<< "Handling batch dimension not equal to 1 is not implemented in this "
|
<< "The batch dimension needs to be greater or equal to 1.";
|
||||||
"converter.";
|
|
||||||
RET_CHECK_EQ(output_shape.dims[3], 3)
|
RET_CHECK_EQ(output_shape.dims[3], 3)
|
||||||
<< "Wrong output channel: " << output_shape.dims[3];
|
<< "Wrong output channel: " << output_shape.dims[3];
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
|
|
|
@ -172,7 +172,7 @@ constexpr char kValidIntProto[] = R"(
|
||||||
output_tensor_height: 200
|
output_tensor_height: 200
|
||||||
)";
|
)";
|
||||||
|
|
||||||
TEST(ValidateOptionOutputDims, ValidProtos) {
|
TEST(ValidateOptionOutputDims, ImageToTensorCalcOptions) {
|
||||||
const auto float_options =
|
const auto float_options =
|
||||||
mediapipe::ParseTextProtoOrDie<mediapipe::ImageToTensorCalculatorOptions>(
|
mediapipe::ParseTextProtoOrDie<mediapipe::ImageToTensorCalculatorOptions>(
|
||||||
kValidFloatProto);
|
kValidFloatProto);
|
||||||
|
@ -202,7 +202,7 @@ TEST(ValidateOptionOutputDims, EmptyProto) {
|
||||||
HasSubstr("Valid output tensor width is required")));
|
HasSubstr("Valid output tensor width is required")));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(GetOutputTensorParams, SetValues) {
|
TEST(GetOutputTensorParams, ImageToTensorCalcOptionsSetValues) {
|
||||||
// Test int range with ImageToTensorCalculatorOptions.
|
// Test int range with ImageToTensorCalculatorOptions.
|
||||||
const auto int_options =
|
const auto int_options =
|
||||||
mediapipe::ParseTextProtoOrDie<mediapipe::ImageToTensorCalculatorOptions>(
|
mediapipe::ParseTextProtoOrDie<mediapipe::ImageToTensorCalculatorOptions>(
|
||||||
|
|
BIN
mediapipe/calculators/tensor/testdata/image_to_tensor/crop_empty.png
vendored
Normal file
BIN
mediapipe/calculators/tensor/testdata/image_to_tensor/crop_empty.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 319 B |
BIN
mediapipe/calculators/tensor/testdata/image_to_tensor/crop_rect1.png
vendored
Normal file
BIN
mediapipe/calculators/tensor/testdata/image_to_tensor/crop_rect1.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
mediapipe/calculators/tensor/testdata/image_to_tensor/crop_rect2.png
vendored
Normal file
BIN
mediapipe/calculators/tensor/testdata/image_to_tensor/crop_rect2.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
BIN
mediapipe/calculators/tensor/testdata/image_to_tensor/crop_rect3.png
vendored
Normal file
BIN
mediapipe/calculators/tensor/testdata/image_to_tensor/crop_rect3.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Loading…
Reference in New Issue
Block a user