Closed YukiFan closed 1 year ago
You can carefully read section 3.3 of our paper.
For code:
anchor_nx_new = torch.gather(N_aug_new, 1, A_index.unsqueeze(2).expand([-1, -1, x.size(-1)])).mean(1).reshape(b // 2, n, -1).mean(1)
Thank you for your careful review of the code, we will correct this error.
For paper:
In equation(5). The first two terms $BCE(S_{k;n}^n,\mathbb yn^n)+BCE(S{k;a}^n,\mathbb ya^n)$ describe an normal video(no abnormal segments) input into the two memory block, so the output $S{k;n}^n$ of Nmem(normal) should be [1,1,...,1] all ones, $S{k;a}^n$ of A_mem(abnormal) should be [0,0,...,0] all zeros.
The last two terms $BCE(S_{k;n;k}^a,yn^n)+BCE(S{k;a;k}^a,ya^n)$ describe an abnormal video(et least one abnormal segment) input into the two memory blocks, $S{k;n}^a$ of Nmem(normal) should be [1,0,...,0] at least one, $S{k;n;k}^a$ chooses the topK score. $S_{k;a}^a$ of Amem(abnormal) also should be [0,0,...,1] at least ones, $S{k;a;k}^a$ chooses the topK score. You can think it with Fig.3.
You can carefully read section 3.3 of our paper.
For code:
anchor_nx_new = torch.gather(N_aug_new, 1, A_index.unsqueeze(2).expand([-1, -1, x.size(-1)])).mean(1).reshape(b // 2, n, -1).mean(1)
Thank you for your careful review of the code, we will correct this error.
For paper:
- In equation(5). The first two terms 𝕪𝕪BCE(Sk;nn,ynn)+BCE(Sk;an,yan) describe an normal video(no abnormal segments) input into the two memory block, so the output Sk;nn of N_mem(normal) should be [1,1,...,1] all ones, Sk;an of A_mem(abnormal) should be [0,0,...,0] all zeros.
- The last two terms BCE(Sk;n;ka,ynn)+BCE(Sk;a;ka,yan) describe an abnormal video(et least one abnormal segment) input into the two memory blocks, Sk;na of N_mem(normal) should be [1,0,...,0] at least one, Sk;n;ka chooses the topK score. Sk;aa of A_mem(abnormal) also should be [0,0,...,1] at least ones, Sk;a;ka chooses the topK score. You can think it with Fig.3.
Thank you for your thorough response. I'll re-read the paper. (^▽^)
Thanks for sharing the code of this excellent work. But I have some questions about the code and the paper. It will be much appreciated if you could resolve my puzzles.
for code: in model.py, "anchor_nx_new = torch.gather(N_aug_new, 1, A_index.unsqueeze(2).expand([-1, -1, x.size(-1)])).mean(1).reshape(b // 2, n, -1).mean(1) " "A_index" seems wrong, may be "N_index"?
for paper: In equation (5) y_nn, y_an, y_aa are all equal to 1, and yna is equal to 0. Although in paper there exists “The first two terms of Ldm limit the normal memory unit to learn normal patterns, and the last two terms ensure the abnormal pattern learning for abnormal memory unit.” I still can't understand (@@;), could you give me more explanation about why choose 1 or 0 for these four items?