Closed GMTSE closed 4 years ago
Hi,
can you try installing the very newest tensorflow
and keras
from CRAN?
install.packages("tensorflow")
install.packages("keras")
Thanks for your quick response! Sorry I was completing my answer when you responded I'm currently installing the new versions. I'll tell you the result when it's done.
Hello again,
I managed to get my code running using
remotes::install_github("rstudio/reticulate")
remotes::install_github("rstudio/tensorflow")
remotes::install_github("rstudio/keras")
library(reticulate)
library(tensorflow)
library(keras)
From: https://github.com/rstudio/reticulate/issues/724#issuecomment-619100262
Thanks a lot for your help!
Hi,
Thanks for your work on Keras for R, it is very useful!
Context: I'm trying to implement Siamese Networks in R+library(keras).
Of course, the first thing I imagined was to start simple, by working on something like MNIST-digit data. Also, before trying something myself, I wanted to see if there was a simple working example to test if my environment was OK. I found this simple code in Python that works well and that I understand well: https://github.com/rstudio/keras/blob/master/vignettes/examples/mnist_siamese_graph.py Unfortunately, it's equivalent in R is empty: https://github.com/rstudio/keras/blob/master/vignettes/examples/mnist_siamese_graph.R So I decided to translate the code, so that I can learn by doing and also I could contribute to the project in the end if the result is satisfying. The translation is not finished, but here is what I got for the moment: SiameseNetworks.txt (As can be noted, I modified a little the couples' generation, to work only on the indices first, then extract the images, because the original code, that [ac]binding pair by pair to the final data structure takes forever on my machine).
Everything works fine until I try to fit the model... I get the following error:
In more details:
I've tried to simplify the code so instead of comparing images of digits, I directly compare the digits themselves (i.e. the input_a and input_b layer consist in a single digit). But I get the same error.
I've search the web for other examples, the only one I found that was as simpe as I needed (*) was in the book "Deep Learning with R" by Francois Chollet and J. J. Allaire (MEAP). I added a few data to run it against, and obtained the following very simple code: SiameseNetworks_Cholet.txt But got again the same error...
I've search a lot for this error and I can't find anything apart that it seems related to the fact the I provide a list as
input
s when callingfit()
. Reference: https://github.com/keras-team/keras/issues/13827So I'm starting to think there is a bug in the keras lib. Can you confirm/infirm?
Thanks & stay safe! (*) I've found this one: https://www.kaggle.com/shih0430/mnist-siamese-neural-network-for-keras-r-code But the data generation is too complicated and I don't see a difference in the model part. EDIT: I tried this code and I also get the error
FYI: