• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Description:
2# TensorFlow Lite Example Label Image.
3
4package(default_visibility = ["//visibility:public"])
5
6licenses(["notice"])  # Apache 2.0
7
8load("//tensorflow/lite:build_def.bzl", "tflite_linkopts")
9
10exports_files(glob([
11    "testdata/*.bmp",
12]))
13
14cc_binary(
15    name = "label_image",
16    srcs = [
17        "get_top_n.h",
18        "get_top_n_impl.h",
19        "label_image.cc",
20    ],
21    linkopts = tflite_linkopts() + select({
22        "//tensorflow:android": [
23            "-pie",  # Android 5.0 and later supports only PIE
24            "-lm",  # some builtin ops, e.g., tanh, need -lm
25        ],
26        "//conditions:default": [],
27    }),
28    deps = [
29        ":bitmap_helpers",
30        "//tensorflow/lite:framework",
31        "//tensorflow/lite:string_util",
32        "//tensorflow/lite/kernels:builtin_ops",
33    ],
34)
35
36cc_library(
37    name = "bitmap_helpers",
38    srcs = ["bitmap_helpers.cc"],
39    hdrs = [
40        "bitmap_helpers.h",
41        "bitmap_helpers_impl.h",
42        "label_image.h",
43    ],
44    deps = [
45        "//tensorflow/lite:builtin_op_data",
46        "//tensorflow/lite:framework",
47        "//tensorflow/lite:schema_fbs_version",
48        "//tensorflow/lite:string",
49        "//tensorflow/lite:string_util",
50        "//tensorflow/lite/kernels:builtin_ops",
51        "//tensorflow/lite/schema:schema_fbs",
52    ],
53)
54
55cc_test(
56    name = "label_image_test",
57    srcs = [
58        "get_top_n.h",
59        "get_top_n_impl.h",
60        "label_image_test.cc",
61    ],
62    data = [
63        "testdata/grace_hopper.bmp",
64    ],
65    deps = [
66        ":bitmap_helpers",
67        "@com_google_googletest//:gtest",
68    ],
69)
70