Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-executions of activation_maximization generate different results for same graph/weights #33

Open
omerbrandis opened this issue Nov 4, 2020 · 1 comment

Comments

@omerbrandis
Copy link

hello,

I've made the following minor change to the visualize dense layer example:

for CurrentAttempt in range(0,4):
        print('attempt number {}'.format(CurrentAttempt))
        activation = activation_maximization(loss,callbacks=[Print(interval=50)])
        image = activation[0].astype(np.uint8)

        subplot_args = { 'nrows': 1, 'ncols': 1, 'figsize': (3, 3),
                         'subplot_kw': {'xticks': [], 'yticks': []} }
        f, ax = plt.subplots(**subplot_args)
        ax.imshow(image)
        ax.set_title('Ouzel', fontsize=14)
        plt.tight_layout()
        plt.show()


the generated images for ouzel class are different for each execution.
( i can upload the images if that will help ).

I'm not sure if this is an error of some kind or expected behavior .
can someone please shed some light on this ?
Omer.

@keisen
Copy link
Owner

keisen commented Nov 4, 2020

Hi, @omerbrandis .

the generated images for ouzel class are different for each execution.

It's exactly expected behavior. There are two reasons for that.
First, in default, the initial values of the image is randomly generated.
(If you don't want that, you can gave arbitrary values as initial values to tf-keras-vis using seed_input option.)

Second, in default, the image is randomly modified each step using InputModifiers.

input_modifiers=[Jitter(2), Rotate(2)],

For that reason, the image during activation maximization is changing as follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants