diff options
author | 2017-05-18 18:02:32 -0700 | |
---|---|---|
committer | 2017-05-18 18:06:21 -0700 | |
commit | 53cb26d05a5c2080d8022124178b1cc43a30ffe5 (patch) | |
tree | ba11f5e078e8300e0a88f96f1029c549ade2a6c0 /tensorflow/examples/label_image | |
parent | c311af00f2d72940c75ab0fc125ba2949858b2a9 (diff) |
Merge changes from github.
END_PUBLIC
---
Commit c2b8927f2 authored by Dandelion Man?<dandelion@google.com>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
Fix another d3v4 regression in the graph visualizer.
PiperOrigin-RevId: 156343038
---
Commit 170f0b350 authored by Peter Hawkins<phawkins@google.com>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
[TF:XLA] Add XLA implementation of ResourceStridedSliceAssign.
PiperOrigin-RevId: 156341053
---
Commit 1390dd68f authored by Vijay Vasudevan<vrv@google.com>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
When Op Type is not registered, log the hostname of the machine that
it is running on in the error message, since the message could be routed
back during a failure on a remote binary, and it is hard to tell which
machine it came from.
Ideally, we'd somehow log the name of the binary running instead, but
we don't have a function to get that right now.
PiperOrigin-RevId: 156337679
---
Commit 9ca8a151b authored by A. Unique TensorFlower<gardener@tensorflow.org>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
Internal change.
PiperOrigin-RevId: 156335942
---
Commit 40255434c authored by Martin Wicke<wicke@google.com>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
Deprecate contrib/learn/dataframe. To be removed June 15.
PiperOrigin-RevId: 156333930
---
Commit 7f71b7fbe authored by A. Unique TensorFlower<gardener@tensorflow.org>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
BEGIN_PUBLIC
Automated g4 rollback of changelist 156123287
PiperOrigin-RevId: 156503903
Diffstat (limited to 'tensorflow/examples/label_image')
-rw-r--r-- | tensorflow/examples/label_image/BUILD | 32 | ||||
-rw-r--r-- | tensorflow/examples/label_image/main.cc | 10 |
2 files changed, 35 insertions, 7 deletions
diff --git a/tensorflow/examples/label_image/BUILD b/tensorflow/examples/label_image/BUILD index 021372fa7b..d677e58ac3 100644 --- a/tensorflow/examples/label_image/BUILD +++ b/tensorflow/examples/label_image/BUILD @@ -12,12 +12,32 @@ cc_binary( srcs = [ "main.cc", ], - linkopts = ["-lm"], - deps = [ - "//tensorflow/cc:cc_ops", - "//tensorflow/core:framework_internal", - "//tensorflow/core:tensorflow", - ], + linkopts = select({ + "//tensorflow:android": [ + "-pie", + "-landroid", + "-ljnigraphics", + "-llog", + "-lm", + "-z defs", + "-s", + "-Wl,--exclude-libs,ALL", + ], + "//conditions:default": ["-lm"], + }), + deps = select({ + "//tensorflow:android": [ + # cc:cc_ops is used to include image ops (for label_image) + # Jpg, gif, and png related code won't be included + "//tensorflow/cc:cc_ops", + "//tensorflow/core:android_tensorflow_lib", + ], + "//conditions:default": [ + "//tensorflow/cc:cc_ops", + "//tensorflow/core:framework_internal", + "//tensorflow/core:tensorflow", + ], + }), ) filegroup( diff --git a/tensorflow/examples/label_image/main.cc b/tensorflow/examples/label_image/main.cc index 3351109f45..90454bd7ac 100644 --- a/tensorflow/examples/label_image/main.cc +++ b/tensorflow/examples/label_image/main.cc @@ -30,6 +30,9 @@ limitations under the License. // the top of the main() function. // // The googlenet_graph.pb file included by default is created from Inception. +// +// Note that, for GIF inputs, to reuse existing code, only single-frame ones +// are supported. #include <fstream> #include <utility> @@ -103,7 +106,12 @@ Status ReadTensorFromImageFile(const string& file_name, const int input_height, image_reader = DecodePng(root.WithOpName("png_reader"), file_reader, DecodePng::Channels(wanted_channels)); } else if (tensorflow::StringPiece(file_name).ends_with(".gif")) { - image_reader = DecodeGif(root.WithOpName("gif_reader"), file_reader); + // gif decoder returns 4-D tensor, remove the first dim + image_reader = + Squeeze(root.WithOpName("squeeze_first_dim"), + DecodeGif(root.WithOpName("gif_reader"), file_reader)); + } else if (tensorflow::StringPiece(file_name).ends_with(".bmp")) { + image_reader = DecodeBmp(root.WithOpName("bmp_reader"), file_reader); } else { // Assume if it's neither a PNG nor a GIF then it must be a JPEG. image_reader = DecodeJpeg(root.WithOpName("jpeg_reader"), file_reader, |