论文链接:https://link.zhihu.com/?target=https%3A//openreview.net/forum%3Fid%3DLzQQ89U1qm_
代码地址:https://github.com/thuml/Anomaly-Transformer
1、环境配置(需要cuda)
![](https://img-blog.csdnimg.cn/img_convert/601961eb8c6c9216069eb6ffae456cb2.png)
2、数据集下载
github里README.md文件的get started里第二点可以自行下载
3、代码运行
之前运行main.py一直出现ValueError: too many values to unpack (expected 2)或者就是AttributeError: 'int' object has no attribute 'float'一直寻求解决方法都未解决。
后来发现是自己的参数未配置,后来就使用conda activate虚拟环境后在命令行中运行
bash ./scripts/SMD.sh
bash ./scripts/MSL.sh
bash ./scripts/SMAP.sh
bash ./scripts/PSM.sh
里的带参数的命令就能跑出结果了
4、成功跑出结果
这是跑MSL的结果比作者文中的结果要高
![](https://img-blog.csdnimg.cn/img_convert/6c664ecd304aaf2826fbe705f17802e1.png)
这是跑SMAP的结果比作者文中的结果要低
![](https://img-blog.csdnimg.cn/img_convert/a6ea65ec43439077586107838d3769b6.png)
这是跑SMD的结果比作者文中的结果要低,PSM没拍到结果还是要低一些。
![](https://img-blog.csdnimg.cn/img_convert/94156d1242fcb7628c4820b146a83821.png)