Internal change
PiperOrigin-RevId: 522282159
This commit is contained in:
parent
8d8ab9a972
commit
3c083f5d2b
|
@ -163,7 +163,7 @@ absl::StatusOr<ImageEmbedderResult> ImageEmbedder::Embed(
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::StatusOr<ImageEmbedderResult> ImageEmbedder::EmbedForVideo(
|
absl::StatusOr<ImageEmbedderResult> ImageEmbedder::EmbedForVideo(
|
||||||
Image image, int64 timestamp_ms,
|
Image image, int64_t timestamp_ms,
|
||||||
std::optional<core::ImageProcessingOptions> image_processing_options) {
|
std::optional<core::ImageProcessingOptions> image_processing_options) {
|
||||||
if (image.UsesGpu()) {
|
if (image.UsesGpu()) {
|
||||||
return CreateStatusWithPayload(
|
return CreateStatusWithPayload(
|
||||||
|
@ -187,7 +187,7 @@ absl::StatusOr<ImageEmbedderResult> ImageEmbedder::EmbedForVideo(
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::Status ImageEmbedder::EmbedAsync(
|
absl::Status ImageEmbedder::EmbedAsync(
|
||||||
Image image, int64 timestamp_ms,
|
Image image, int64_t timestamp_ms,
|
||||||
std::optional<core::ImageProcessingOptions> image_processing_options) {
|
std::optional<core::ImageProcessingOptions> image_processing_options) {
|
||||||
if (image.UsesGpu()) {
|
if (image.UsesGpu()) {
|
||||||
return CreateStatusWithPayload(
|
return CreateStatusWithPayload(
|
||||||
|
|
|
@ -150,7 +150,7 @@ TEST_F(CreateTest, FailsWithIllegalCallbackInImageOrVideoMode) {
|
||||||
JoinPath("./", kTestDataDirectory, kMobileNetV3Embedder);
|
JoinPath("./", kTestDataDirectory, kMobileNetV3Embedder);
|
||||||
options->running_mode = running_mode;
|
options->running_mode = running_mode;
|
||||||
options->result_callback = [](absl::StatusOr<ImageEmbedderResult>,
|
options->result_callback = [](absl::StatusOr<ImageEmbedderResult>,
|
||||||
const Image& image, int64 timestamp_ms) {};
|
const Image& image, int64_t timestamp_ms) {};
|
||||||
|
|
||||||
auto image_embedder = ImageEmbedder::Create(std::move(options));
|
auto image_embedder = ImageEmbedder::Create(std::move(options));
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ TEST_F(LiveStreamModeTest, FailsWithCallingWrongMethod) {
|
||||||
JoinPath("./", kTestDataDirectory, kMobileNetV3Embedder);
|
JoinPath("./", kTestDataDirectory, kMobileNetV3Embedder);
|
||||||
options->running_mode = core::RunningMode::LIVE_STREAM;
|
options->running_mode = core::RunningMode::LIVE_STREAM;
|
||||||
options->result_callback = [](absl::StatusOr<ImageEmbedderResult>,
|
options->result_callback = [](absl::StatusOr<ImageEmbedderResult>,
|
||||||
const Image& image, int64 timestamp_ms) {};
|
const Image& image, int64_t timestamp_ms) {};
|
||||||
MP_ASSERT_OK_AND_ASSIGN(std::unique_ptr<ImageEmbedder> image_embedder,
|
MP_ASSERT_OK_AND_ASSIGN(std::unique_ptr<ImageEmbedder> image_embedder,
|
||||||
ImageEmbedder::Create(std::move(options)));
|
ImageEmbedder::Create(std::move(options)));
|
||||||
|
|
||||||
|
@ -536,7 +536,7 @@ TEST_F(LiveStreamModeTest, FailsWithOutOfOrderInputTimestamps) {
|
||||||
JoinPath("./", kTestDataDirectory, kMobileNetV3Embedder);
|
JoinPath("./", kTestDataDirectory, kMobileNetV3Embedder);
|
||||||
options->running_mode = core::RunningMode::LIVE_STREAM;
|
options->running_mode = core::RunningMode::LIVE_STREAM;
|
||||||
options->result_callback = [](absl::StatusOr<ImageEmbedderResult>,
|
options->result_callback = [](absl::StatusOr<ImageEmbedderResult>,
|
||||||
const Image& image, int64 timestamp_ms) {};
|
const Image& image, int64_t timestamp_ms) {};
|
||||||
MP_ASSERT_OK_AND_ASSIGN(std::unique_ptr<ImageEmbedder> image_embedder,
|
MP_ASSERT_OK_AND_ASSIGN(std::unique_ptr<ImageEmbedder> image_embedder,
|
||||||
ImageEmbedder::Create(std::move(options)));
|
ImageEmbedder::Create(std::move(options)));
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ TEST_F(LiveStreamModeTest, FailsWithOutOfOrderInputTimestamps) {
|
||||||
struct LiveStreamModeResults {
|
struct LiveStreamModeResults {
|
||||||
ImageEmbedderResult embedding_result;
|
ImageEmbedderResult embedding_result;
|
||||||
std::pair<int, int> image_size;
|
std::pair<int, int> image_size;
|
||||||
int64 timestamp_ms;
|
int64_t timestamp_ms;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(LiveStreamModeTest, Succeeds) {
|
TEST_F(LiveStreamModeTest, Succeeds) {
|
||||||
|
@ -570,7 +570,7 @@ TEST_F(LiveStreamModeTest, Succeeds) {
|
||||||
options->running_mode = core::RunningMode::LIVE_STREAM;
|
options->running_mode = core::RunningMode::LIVE_STREAM;
|
||||||
options->result_callback =
|
options->result_callback =
|
||||||
[&results](absl::StatusOr<ImageEmbedderResult> embedding_result,
|
[&results](absl::StatusOr<ImageEmbedderResult> embedding_result,
|
||||||
const Image& image, int64 timestamp_ms) {
|
const Image& image, int64_t timestamp_ms) {
|
||||||
MP_ASSERT_OK(embedding_result.status());
|
MP_ASSERT_OK(embedding_result.status());
|
||||||
results.push_back(
|
results.push_back(
|
||||||
{.embedding_result = std::move(embedding_result).value(),
|
{.embedding_result = std::move(embedding_result).value(),
|
||||||
|
@ -589,7 +589,7 @@ TEST_F(LiveStreamModeTest, Succeeds) {
|
||||||
// number of iterations.
|
// number of iterations.
|
||||||
ASSERT_LE(results.size(), iterations);
|
ASSERT_LE(results.size(), iterations);
|
||||||
ASSERT_GT(results.size(), 0);
|
ASSERT_GT(results.size(), 0);
|
||||||
int64 timestamp_ms = -1;
|
int64_t timestamp_ms = -1;
|
||||||
for (int i = 0; i < results.size(); ++i) {
|
for (int i = 0; i < results.size(); ++i) {
|
||||||
const auto& result = results[i];
|
const auto& result = results[i];
|
||||||
EXPECT_GT(result.timestamp_ms, timestamp_ms);
|
EXPECT_GT(result.timestamp_ms, timestamp_ms);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user