Skip to content

Commit 328e51e

Browse files
authored
[#55] fix TFImageTransformer example in docs (#58)
1 parent f8d1574 commit 328e51e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,16 @@ Spark DataFrames are a natural construct for applying deep learning models to a
131131

132132
```python
133133
from sparkdl import readImages, TFImageTransformer
134+
import sparkdl.graph.utils as tfx
134135
from sparkdl.transformers import utils
135136
import tensorflow as tf
136137

137-
g = tf.Graph()
138-
with g.as_default():
138+
graph = tf.Graph()
139+
with tf.Session(graph=graph) as sess:
139140
image_arr = utils.imageInputPlaceholder()
140141
resized_images = tf.image.resize_images(image_arr, (299, 299))
141-
# the following step is not necessary for this graph, but can be for graphs with variables, etc
142-
frozen_graph = utils.stripAndFreezeGraph(g.as_graph_def(add_shapes=True), tf.Session(graph=g),
143-
[resized_images])
142+
frozen_graph = tfx.strip_and_freeze_until([resized_images], graph, sess,
143+
return_graph=True)
144144

145145
transformer = TFImageTransformer(inputCol="image", outputCol="predictions", graph=frozen_graph,
146146
inputTensor=image_arr, outputTensor=resized_images,
@@ -241,7 +241,7 @@ registerKerasImageUDF("my_keras_inception_udf", InceptionV3(weights="imagenet"),
241241

242242
```
243243

244+
### Estimator
244245

245246
## Releases:
246247
* 0.1.0 initial release
247-

0 commit comments

Comments
 (0)