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

find errors in blind_watermark/blind_watermark.py, def extract_decrypt #147

Open
liehaoli opened this issue Oct 27, 2024 · 0 comments
Open

Comments

@liehaoli
Copy link

liehaoli commented Oct 27, 2024

p.random.RandomState(self.password_wm).shuffle(wm_index) 这行代码会原地打乱 wm_index。
接着,wm_avg[wm_index] = wm_avg.copy() 这行尝试用打乱后的 wm_index 来索引 wm_avg 并将其赋值为 wm_avg 的一个副本。这里的逻辑有误。这行代码的结果是,wm_avg 的值会按照 wm_index 的新顺序被赋值,但赋的值却是原始 wm_avg 的顺序的拷贝,这样做实际上并没有根据 wm_index 来“解密”或重置 wm_avg 的顺序。
改正如下:

def extract_decrypt(self, wm_avg):
        wm_index = np.arange(self.wm_size)
        np.random.RandomState(self.password_wm).shuffle(wm_index)
        decrypted_wm = np.zeros_like(wm_avg)
        decrypted_wm[wm_index] = wm_avg  # 根据打乱的索引恢复顺序
        return decrypted_wm
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