We're following the code from tensorflow rstudio and using R 3.5.1, Keras 2.2.2, Tensorflow 1.11.0
Basically, it is working as expected. The code runs for a few seconds and if all goes right, you end up with
<tensorflow.python.keras.engine.training.Model>
It is a Model, as it says. If things don't go right, this is what is being attempted, and here a network failure:
> library(keras)
> library(tensorflow)
> model_resnet50 <- application_resnet50()
Error in py_call_impl(callable, dots$args, dots$keywords) :
RemoteDisconnected: Remote end closed connection without response
Then is works:
> model_resnet50 <- application_resnet50(weights = 'imagenet')
Downloading data from https://github.com/fchollet/deep-learning- models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5
Downloading data from https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5
102858752/102853048 [==============================] - 14s 0us/step
2018-09-30 18:20:12.316814: I
tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports
instructions that this TensorFlow binary was not compiled to use:
SSE4.1 SSE4.2
> model_resnet50
<tensorflow.python.keras.engine.training.Model>
The next part depends on where those/that elephant jpeg are or come from,
it isn't clear from the link above, though probably from image-net.org.
Anyway, absent an "elephant.jpg" in your working directory, you get:
> img_path <- "elephant.jpg"
> img <- image_load(img_path, target_size = c(224,224))
Error in py_call_impl(callable, dots$args, dots$keywords) :
FileNotFoundError: [Errno 2] No such file or directory:
'elephant.jpg'
Get some elephant jpegs and continue following the examples and have fun.