| 24 | namespace label_image { |
| 25 | |
| 26 | TEST(LabelImageTest, GraceHopper) { |
| 27 | std::string lena_file = |
| 28 | "tensorflow/lite/examples/label_image/testdata/" |
| 29 | "grace_hopper.bmp"; |
| 30 | int height, width, channels; |
| 31 | Settings s; |
| 32 | std::vector<uint8_t> input = |
| 33 | read_bmp(lena_file, &width, &height, &channels, &s); |
| 34 | ASSERT_EQ(height, 606); |
| 35 | ASSERT_EQ(width, 517); |
| 36 | ASSERT_EQ(channels, 3); |
| 37 | |
| 38 | std::vector<uint8_t> output(606 * 517 * 3); |
| 39 | resize<uint8_t>(output.data(), input.data(), 606, 517, 3, 214, 214, 3, &s); |
| 40 | ASSERT_EQ(output[0], 0x15); |
| 41 | ASSERT_EQ(output[214 * 214 * 3 - 1], 0x11); |
| 42 | } |
| 43 | |
| 44 | TEST(LabelImageTest, GetTopN) { |
| 45 | uint8_t in[] = {1, 1, 2, 2, 4, 4, 16, 32, 128, 64}; |