keisen / tf-keras-vis

Neural network visualization toolkit for tf.keras
https://keisen.github.io/tf-keras-vis-docs/
MIT License
313 stars 45 forks source link

Is it really N-dim ? #44

Closed IsmailAlaouiAbdellaoui closed 3 years ago

IsmailAlaouiAbdellaoui commented 3 years ago

Hey, thanks for the great repository. I have a NN that needs a 4 dimensional input because it uses a ConvLSTM2D, so the input shape is (Time,Row,Cols,Channels). However, when using the activation maximization feature, it leads to a TF error : 'images' must be either 3 or 4-dimensional. I guess another dimension is added for the batch size of 1. Can you please help me figure out how to fix this issue ?

Note : using the activation maximization for a 3 dimensional input (other model without ConvLSTM2D) works perfectly.

IsmailAlaouiAbdellaoui commented 3 years ago

If anyone has the same issue, it has to do with line 25 in the regularizers file (TotalVariation class), more specifically the total_variation function. This function comes directly from the TF library. You have to write your own that makes the same computations while handling more dimensions.