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

There are a few issues related to the code that need to be addressed. #4

Open
jelymewang opened this issue Feb 25, 2023 · 1 comment

Comments

@jelymewang
Copy link

for i, channel in enumerate(diff):
    perturb[i] -= np.dot(perturb[i], channel) * channel

The meaning of this code is unclear, particularly regarding the choice of subtraction over addition and why the matrix product is multiplied by the channel afterwards

@jelymewang
Copy link
Author

def get_diff(sample_1, sample_2):
sample_1 = sample_1.reshape(3, sample_1.shape[0], sample_1.shape[1])
sample_2 = sample_2.reshape(3, sample_2.shape[0], sample_2.shape[1])
sample_1 = np.resize(sample_1, (3, 271, 271))
sample_2 = np.resize(sample_2, (3, 271, 271))

diff = []
for i, channel in enumerate(sample_1):
    diff.append(np.linalg.norm((channel - sample_2[i]).astype(np.float32)))
return np.array(diff)

What is the reason for resizing to 271? I'm not entirely clear on the intention behind this.

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

1 participant