You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which make me think that the categorical_crossentropy function of the package keras could be updated too, to reflect the one of the python version of keras, which can use label_smoothing.
Running the following would create an error :
model <- load_model_tf("../input/efficientnetb7-label-smoothing-imagenet/EfficientB7_image_net/")
ValueError: ('Unknown loss function', ':smoothie')
And this is when things began to be puzzling. Looking at keras-team/keras#5916 in the main keras, it appeared to me that I must use custom_objects. But the documentation is totally clueless about how and using standard R data-structure did not worked (I tried a list without success). Finally looking at the solution provided on github, and the code of the function of the github repository, I remembered that there is some conversion to the dictionary format via reticulate, and indeed there is a function to do it. Using :
model <- load_model_tf("../input/efficientnetb7-label-smoothing-imagenet/EfficientB7_image_net/", custom_objects = dict(smoothie = "smoothie"))
Worked perfectly.
I would suggest an update to the documentation or a way to pass a list as an argument, which the first logical attempt of a R user.
The text was updated successfully, but these errors were encountered:
I put this here if someone else run into the trouble, it is more problem of documentation.
I created a model with a custom loss function :
Which make me think that the categorical_crossentropy function of the package keras could be updated too, to reflect the one of the python version of keras, which can use label_smoothing.
Running the following would create an error :
model <- load_model_tf("../input/efficientnetb7-label-smoothing-imagenet/EfficientB7_image_net/")
And this is when things began to be puzzling. Looking at keras-team/keras#5916 in the main keras, it appeared to me that I must use custom_objects. But the documentation is totally clueless about how and using standard R data-structure did not worked (I tried a list without success). Finally looking at the solution provided on github, and the code of the function of the github repository, I remembered that there is some conversion to the dictionary format via reticulate, and indeed there is a function to do it. Using :
model <- load_model_tf("../input/efficientnetb7-label-smoothing-imagenet/EfficientB7_image_net/", custom_objects = dict(smoothie = "smoothie"))
Worked perfectly.
I would suggest an update to the documentation or a way to pass a list as an argument, which the first logical attempt of a R user.
The text was updated successfully, but these errors were encountered: