gallettilance / kviz

https://pypi.org/project/kviz/ Visualization library for keras neural networks. Contributions welcome

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change of `animate_activations`

mcxxmc opened this issue · comments

The 0.0.5 release changes the function of the animate_activations. Now the resulted new gif is sometimes confusing and I think the old gif is more illustrative.

To slow down the gif, I think we can adjust the way we stack the gif. For example, for each image we stack it twice, it may slow down the gif by half. The number of times each images is stacked can be an parameter with default value as 1 or something bigger (or the number can grow as the input size grows).

Furthur more, the user can also use some online gif viewer to examine their gif frame by frame; or we can convert the gif to something like a mp4 file, though I think the former option is more practical.

stacked here is that one image is stacked on top of the other. The goal being to see which data point is going through the network at the same time that you see the activations for that point. I'm not sure I see how you can change the way they are stacked

Did you mean the number of frames in the gif? If so, I agree and have a fix locally where you can specify a parameter that limits the number of frames used. Ideally I would like to specify a size (like 25Mb since this is a common limit for gifs / images) and translate that to a number of frames. What do you think?

Oh I see.
I was saying the old gif shows the process of activation, while the new one shows all the activations at the same time. For example, if we have data point x and a model of 3 layers, then there were 3 sequential images showing each step of the activation; now all the activations are displayed in a single image, so basically 1 image for 1 data point x.
This is just a difference in displaying and I think I am ok with that change. I think the main point is the speed. The maximum size is a great idea, and I think we can also introduce another new parameter like the number of frames for each input data x.
Since we are stacking img of the same model, I believe the size of each img will not differ too much. So, by the time we get our first img, we can use the parameter to estimate the total size of the gif. I suggest that if the total size is smaller than the maximum size, then we use the total size; otherwise, we cut the parameter (number of frames for each x) to control the total size. Since we can easily figure out how many input data points we have, the trick should be some math here.
Please let me know if you have any questions.