duoergun0729 / duoergun0729/adversarial_examples
计算L范数的相对值
- Dominant language
- Jupyter Notebook
- Stars
- 276
- Forks
- 111
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/duoergun0729/adversarial_examples/blob/master/code/tools.py
#计算相对量
#l0 = int(99*len(np.where(np.abs(img[0] - img_adv[0])>0.5)[0]) / size ) + 1
l0=int(_l0*99/size)+1
l1 = int(99*np.sum(np.abs(img[0] - img_adv[0])) / np.sum(np.abs(img[0]))) + 1
#l2 = int(99*np.linalg.norm(img[0] - img_adv[0]) / np.linalg.norm(img[0])) + 1
l2=int(99*_l2 / np.linalg.norm(img[0])) + 1
#linf = int(99*np.max(np.abs(img[0] - img_adv[0])) / 255) + 1
linf = int(99*_linf / 255) + 1
print('Noise L_0 norm: {} {}%'.format(_l0,l0) )
print('Noise L_2 norm: {} {}%'.format(_l2,l2) )
print('Noise L_inf norm: {} {}%'.format(_linf,linf) )
为什么要乘99,以及为什么要加1?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in tools.py, where the relative L0, L1, L2, and L-inf values are calculated from adversarial-image differences. Trace the values used in these formulas and inspect their callers to determine the intended scaling; done means the purpose of multiplying by 99 and adding 1 is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- machine-learning
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100