Help with R code using keras for visualizing convnet filters

Dear members,

As a beginner, I read the book of François Chollet with J.J. Allaire "Deep Learning with R". While trying to reproduce the code of the book allowing to visualize the convnet filters, R returns an error (cf. code/reprex below).

I would be very grateful if any of you could help me.

Kind regards
Loïc

REPREX:

library(keras)

model <- application_vgg16(
  weights = "imagenet",
  include_top = FALSE
)

layer_name <- "block3_conv1" 
filter_index <- 1            

layer_output <- get_layer(model, layer_name)$output
loss <- k_mean(layer_output[,,,filter_index])
#> Error in `[.python.builtin.object`(layer_output, , , , filter_index): unused arguments (alist(, , filter_index))

Hello, sincerely I havent read the text, but in the Github repository you can find the code of the book in a better format, and see what is the problem.

Hope this helps

Dear Andy,

Thanks for this suggestion (I didn't know about this github repository dedicated to the book), but unfortunately the problem is not solved because the code is exactly the same as the one I gave in my first message. So, I get the same error message (cf. my first post).

Anyway, thank you for making this suggestion. And I hope someone else can help me find the correct code to make it work.

Cheers,
Loïc

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.