1 # Description: 2 # TensorFlow Lite Example Label Image. 3 4 package(default_visibility = ["//visibility:public"]) 5 6 licenses(["notice"]) # Apache 2.0 7 8 load("//tensorflow:tensorflow.bzl", "tf_cc_binary") 9 load("//tensorflow/contrib/lite:build_def.bzl", "tflite_linkopts") 10 11 exports_files(glob([ 12 "testdata/*.bmp", 13 ])) 14 15 tf_cc_binary( 16 name = "label_image", 17 srcs = [ 18 "get_top_n.h", 19 "get_top_n_impl.h", 20 "label_image.cc", 21 ], 22 linkopts = tflite_linkopts() + select({ 23 "//tensorflow:android": [ 24 "-pie", # Android 5.0 and later supports only PIE 25 "-lm", # some builtin ops, e.g., tanh, need -lm 26 ], 27 "//conditions:default": [], 28 }), 29 deps = [ 30 ":bitmap_helpers", 31 "//tensorflow/contrib/lite:framework", 32 "//tensorflow/contrib/lite:string_util", 33 "//tensorflow/contrib/lite/kernels:builtin_ops", 34 ], 35 ) 36 37 cc_library( 38 name = "bitmap_helpers", 39 srcs = ["bitmap_helpers.cc"], 40 hdrs = [ 41 "bitmap_helpers.h", 42 "bitmap_helpers_impl.h", 43 "label_image.h", 44 ], 45 deps = [ 46 "//tensorflow/contrib/lite:builtin_op_data", 47 "//tensorflow/contrib/lite:framework", 48 "//tensorflow/contrib/lite:schema_fbs_version", 49 "//tensorflow/contrib/lite:string", 50 "//tensorflow/contrib/lite:string_util", 51 "//tensorflow/contrib/lite/kernels:builtin_ops", 52 "//tensorflow/contrib/lite/schema:schema_fbs", 53 ], 54 ) 55 56 # TODO(ahentz): Test disabled as it has a memory leek from read_bmp 57 # cc_test( 58 # name = "label_image_test", 59 # srcs = [ 60 # "get_top_n.h", 61 # "get_top_n_impl.h", 62 # "label_image_test.cc", 63 # ], 64 # data = [ 65 # "testdata/grace_hopper.bmp", 66 # ], 67 # deps = [ 68 # ":bitmap_helpers", 69 # "//testing/base/public:gunit", 70 # ], 71 # ) 72 73 filegroup( 74 name = "all_files", 75 srcs = glob( 76 ["**/*"], 77 exclude = [ 78 "**/METADATA", 79 "**/OWNERS", 80 ], 81 ), 82 visibility = ["//tensorflow:__subpackages__"], 83 ) 84