本文主要是介绍AST: Asymmetric Student-Teacher Networks for Industrial Anomaly Detection代码运行,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
环境
設置遠程路徑
conda create --name zgp_ast python=3.7.7
pip install -r requirements.txt
PIL>=7.1.2改爲Pillow>=7.1.2
Building wheels for collected packages: efficientnet-pytorchBuilding wheel for efficientnet-pytorch (setup.py) ... doneCreated wheel for efficientnet-pytorch: filename=efficientnet_pytorch-0.7.1-py3-none-any.whl size=16429 sha256=6bfca4c176917cd6dd09b95e03683dd0d110a70732cb96c2b4a759aa2b0093edStored in directory: /home/cszx/.cache/pip/wheels/6e/17/87/3941ed5f9b2bb0cbfa508d1596b68f294d8f1bdec3160ec1a1
Successfully built efficientnet-pytorch
Installing collected packages: urllib3, typing-extensions, tqdm, threadpoolctl, six, pyparsing, Pillow, packaging, nvidia-cuda-runtime-cu11, nvidia-cuda-nvrtc-cu11, nvidia-cublas-cu11, numpy, joblib, idna, fonttools, cycler, charset-normalizer, tifffile, scipy, requests, python-dateutil, nvidia-cudnn-cu11, kiwisolver, torch, scikit-learn, matplotlib, torchvision, efficientnet-pytorch
Successfully installed Pillow-9.5.0 charset-normalizer-3.3.2 cycler-0.11.0 efficientnet-pytorch-0.7.1 fonttools-4.38.0 idna-3.7 joblib-1.3.2 kiwisolver-1.4.5 matplotlib-3.5.3 numpy-1.21.6 nvidia-cublas-cu11-11.10.3.66 nvidia-cuda-nvrtc-cu11-11.7.99 nvidia-cuda-runtime-cu11-11.7.99 nvidia-cudnn-cu11-8.5.0.96 packaging-24.0 pyparsing-3.1.2 python-dateutil-2.9.0.post0 requests-2.31.0 scikit-learn-1.0.2 scipy-1.7.3 six-1.16.0 threadpoolctl-3.1.0 tifffile-2021.11.2 torch-1.13.1 torchvision-0.14.1 tqdm-4.66.5 typing-extensions-4.7.1 urllib3-2.0.7
設置config.py
pre_extracted=True
dataset_dir = ‘/home/cszx/c1/zgp/mvtec_3d_anomaly_detection.tar’
下載
放到/home/cszx/.cache/torch/hub/checkpoints
preprocess.py
pycharm直接运行
(時間16:53-19:37前)
ssh://cszx@172.29.6.20:22/home/cszx/miniconda3/envs/zgp_ast/bin/python -u /home/cszx/c1/zgp/AST-main/AST-main/preprocess.py
my_experiment
Loaded pretrained weights for efficientnet-b5
cable_gland
100%|███████████████████████████████████████████| 28/28 [00:10<00:00, 2.61it/s]
data/features/cable_gland
100%|█████████████████████████████████████████████| 7/7 [00:04<00:00, 1.46it/s]
data/features/cable_gland
bagel
100%|███████████████████████████████████████████| 31/31 [00:14<00:00, 2.10it/s]
data/features/bagel
100%|█████████████████████████████████████████████| 7/7 [00:06<00:00, 1.08it/s]
data/features/bagel
peach
100%|███████████████████████████████████████████| 46/46 [00:17<00:00, 2.57it/s]
data/features/peach
100%|█████████████████████████████████████████████| 9/9 [00:06<00:00, 1.40it/s]
data/features/peach
carrot
100%|███████████████████████████████████████████| 36/36 [00:16<00:00, 2.16it/s]
data/features/carrot
100%|███████████████████████████████████████████| 10/10 [00:09<00:00, 1.10it/s]
data/features/carrot
dowel
100%|███████████████████████████████████████████| 36/36 [00:12<00:00, 2.88it/s]
data/features/dowel
100%|█████████████████████████████████████████████| 9/9 [00:05<00:00, 1.65it/s]
data/features/dowel
foam
100%|███████████████████████████████████████████| 30/30 [00:15<00:00, 1.96it/s]
data/features/foam
100%|█████████████████████████████████████████████| 7/7 [00:06<00:00, 1.08it/s]
data/features/foam
cookie
100%|███████████████████████████████████████████| 27/27 [00:09<00:00, 2.75it/s]
data/features/cookie
100%|█████████████████████████████████████████████| 9/9 [00:06<00:00, 1.50it/s]
data/features/cookie
rope
100%|███████████████████████████████████████████| 38/38 [00:14<00:00, 2.57it/s]
data/features/rope
100%|█████████████████████████████████████████████| 7/7 [00:04<00:00, 1.42it/s]
data/features/rope
potato
100%|███████████████████████████████████████████| 38/38 [00:17<00:00, 2.19it/s]
data/features/potato
100%|█████████████████████████████████████████████| 8/8 [00:06<00:00, 1.21it/s]
data/features/potato
tire
100%|███████████████████████████████████████████| 27/27 [00:11<00:00, 2.39it/s]
data/features/tire
100%|█████████████████████████████████████████████| 7/7 [00:06<00:00, 1.15it/s]
data/features/tire
cable_glandtraingood
100%|█████████████████████████████████████████| 223/223 [04:40<00:00, 1.26s/it]testcut
100%|███████████████████████████████████████████| 22/22 [00:33<00:00, 1.53s/it]good
100%|███████████████████████████████████████████| 21/21 [00:27<00:00, 1.30s/it]hole
100%|███████████████████████████████████████████| 22/22 [00:33<00:00, 1.52s/it]bent
100%|███████████████████████████████████████████| 21/21 [00:32<00:00, 1.53s/it]thread
100%|███████████████████████████████████████████| 22/22 [00:33<00:00, 1.53s/it]
bageltraingood
100%|█████████████████████████████████████████| 244/244 [09:46<00:00, 2.40s/it]testcrack
100%|███████████████████████████████████████████| 22/22 [00:52<00:00, 2.41s/it]good
100%|███████████████████████████████████████████| 22/22 [00:51<00:00, 2.34s/it]hole
100%|███████████████████████████████████████████| 21/21 [00:49<00:00, 2.35s/it]contamination
100%|███████████████████████████████████████████| 22/22 [00:53<00:00, 2.42s/it]combined
100%|███████████████████████████████████████████| 23/23 [00:57<00:00, 2.49s/it]
peachtraingood
100%|█████████████████████████████████████████| 361/361 [07:31<00:00, 1.25s/it]testcut
100%|███████████████████████████████████████████| 25/25 [00:30<00:00, 1.23s/it]good
100%|███████████████████████████████████████████| 26/26 [00:34<00:00, 1.34s/it]hole
100%|███████████████████████████████████████████| 29/29 [00:36<00:00, 1.27s/it]contamination
100%|███████████████████████████████████████████| 27/27 [00:33<00:00, 1.22s/it]combined
100%|███████████████████████████████████████████| 25/25 [00:32<00:00, 1.28s/it]
carrottraingood
100%|█████████████████████████████████████████| 286/286 [01:09<00:00, 4.09it/s]testcrack
100%|███████████████████████████████████████████| 26/26 [00:06<00:00, 4.23it/s]cut
100%|███████████████████████████████████████████| 26/26 [00:06<00:00, 3.81it/s]good
100%|███████████████████████████████████████████| 27/27 [00:06<00:00, 3.90it/s]hole
100%|███████████████████████████████████████████| 26/26 [00:07<00:00, 3.69it/s]contamination
100%|███████████████████████████████████████████| 27/27 [00:06<00:00, 4.35it/s]combined
100%|███████████████████████████████████████████| 27/27 [00:07<00:00, 3.76it/s]
doweltraingood
100%|█████████████████████████████████████████| 288/288 [00:13<00:00, 22.15it/s]testcut
100%|███████████████████████████████████████████| 25/25 [00:01<00:00, 21.07it/s]good
100%|███████████████████████████████████████████| 26/26 [00:01<00:00, 22.80it/s]bent
100%|███████████████████████████████████████████| 27/27 [00:01<00:00, 21.38it/s]contamination
100%|███████████████████████████████████████████| 26/26 [00:01<00:00, 21.81it/s]combined
100%|███████████████████████████████████████████| 26/26 [00:01<00:00, 21.38it/s]
foamtraingood
100%|█████████████████████████████████████████| 236/236 [04:47<00:00, 1.22s/it]testcut
100%|███████████████████████████████████████████| 20/20 [00:24<00:00, 1.23s/it]good
100%|███████████████████████████████████████████| 20/20 [00:24<00:00, 1.23s/it]contamination
100%|███████████████████████████████████████████| 20/20 [00:24<00:00, 1.22s/it]combined
100%|███████████████████████████████████████████| 20/20 [00:24<00:00, 1.22s/it]color
100%|███████████████████████████████████████████| 20/20 [00:24<00:00, 1.22s/it]
cookietraingood
100%|█████████████████████████████████████████| 210/210 [02:00<00:00, 1.74it/s]testcrack
100%|███████████████████████████████████████████| 27/27 [00:15<00:00, 1.74it/s]good
100%|███████████████████████████████████████████| 28/28 [00:14<00:00, 1.97it/s]hole
100%|███████████████████████████████████████████| 26/26 [00:15<00:00, 1.65it/s]contamination
100%|███████████████████████████████████████████| 25/25 [00:14<00:00, 1.78it/s]combined
100%|███████████████████████████████████████████| 25/25 [00:13<00:00, 1.80it/s]
ropetraingood
100%|█████████████████████████████████████████| 298/298 [00:18<00:00, 15.82it/s]testcut
100%|███████████████████████████████████████████| 27/27 [00:01<00:00, 15.76it/s]good
100%|███████████████████████████████████████████| 32/32 [00:02<00:00, 14.51it/s]open
100%|███████████████████████████████████████████| 17/17 [00:01<00:00, 12.58it/s]contamination
100%|███████████████████████████████████████████| 25/25 [00:01<00:00, 15.46it/s]
potatotraingood
100%|█████████████████████████████████████████| 300/300 [05:52<00:00, 1.18s/it]testcut
100%|███████████████████████████████████████████| 23/23 [00:23<00:00, 1.01s/it]good
100%|███████████████████████████████████████████| 22/22 [00:30<00:00, 1.41s/it]hole
100%|███████████████████████████████████████████| 23/23 [00:23<00:00, 1.02s/it]contamination
100%|███████████████████████████████████████████| 23/23 [00:20<00:00, 1.13it/s]combined
100%|███████████████████████████████████████████| 23/23 [00:30<00:00, 1.33s/it]
tiretraingood
100%|█████████████████████████████████████████| 210/210 [07:42<00:00, 2.20s/it]testcut
100%|███████████████████████████████████████████| 27/27 [00:59<00:00, 2.20s/it]good
100%|███████████████████████████████████████████| 25/25 [00:54<00:00, 2.19s/it]hole
100%|███████████████████████████████████████████| 27/27 [00:59<00:00, 2.19s/it]contamination
100%|███████████████████████████████████████████| 28/28 [01:01<00:00, 2.21s/it]combined
100%|█████████████████████████████████████████████| 5/5 [00:11<00:00, 2.21s/it]Process finished with exit code 0
train_teacher.py
ssh://cszx@172.29.6.20:22/home/cszx/miniconda3/envs/zgp_ast/bin/python -u /home/cszx/c1/zgp/AST-main/AST-main/train_teacher.py
my_experimentTrain class cable_glandTrain epoch 0
Epoch: 0.0 train loss: 1428.7606
Epoch: 0.4 train loss: 152.5859
Epoch: 0.8 train loss: 142.6143
Epoch: 0.12 train loss: 135.0330
Epoch: 0.16 train loss: 129.3598
Epoch: 0.20 train loss: 125.2070Compute loss and scores on test set:
Epoch: 0 test_loss: 124.6476
AUROC mean over maps: last: 59.17 best: 59.17
AUROC max over maps: last: 68.09 best: 68.09Train epoch 1
Epoch: 1.0 train loss: 121.2998
Epoch: 1.4 train loss: 117.9424
Epoch: 1.8 train loss: 115.0188
Epoch: 1.12 train loss: 111.8316
Epoch: 1.16 train loss: 108.9810
Epoch: 1.20 train loss: 105.7233Compute loss and scores on test set:
Epoch: 1 test_loss: 108.7641
AUROC mean over maps: last: 67.43 best: 67.43
AUROC max over maps: last: 81.83 best: 81.83Train epoch 2
Epoch: 2.0 train loss: 102.8643
Epoch: 2.4 train loss: 100.1945
Epoch: 2.8 train loss: 97.5472
Epoch: 2.12 train loss: 95.1442
Epoch: 2.16 train loss: 93.1793
Epoch: 2.20 train loss: 91.3104Compute loss and scores on test set:
Epoch: 2 test_loss: 98.4839
AUROC mean over maps: last: 76.08 best: 76.08
AUROC max over maps: last: 87.52 best: 87.52
student savedTrain class bagelTrain epoch 0
Epoch: 0.0 train loss: 1628.9048
Epoch: 0.4 train loss: 240.1958
Epoch: 0.8 train loss: 207.1606
Epoch: 0.12 train loss: 191.1231
Epoch: 0.16 train loss: 180.6131
Epoch: 0.20 train loss: 172.6140Compute loss and scores on test set:
Epoch: 0 test_loss: 495.8700
AUROC mean over maps: last: 87.24 best: 87.24
AUROC max over maps: last: 98.92 best: 98.92Train epoch 1
Epoch: 1.0 train loss: 165.9658
Epoch: 1.4 train loss: 159.2075
Epoch: 1.8 train loss: 153.7780
Epoch: 1.12 train loss: 149.0566
Epoch: 1.16 train loss: 144.5442
Epoch: 1.20 train loss: 140.2185Compute loss and scores on test set:
Epoch: 1 test_loss: 7545.4372
AUROC mean over maps: last: 91.89 best: 91.89
AUROC max over maps: last: 97.21 best: 98.92Train epoch 2
Epoch: 2.0 train loss: 136.3188
Epoch: 2.4 train loss: 133.3591
Epoch: 2.8 train loss: 129.7109
Epoch: 2.12 train loss: 126.7757
Epoch: 2.16 train loss: 123.7185
Epoch: 2.20 train loss: 121.0764Compute loss and scores on test set:
Epoch: 2 test_loss: 20937.3579
AUROC mean over maps: last: 90.39 best: 91.89
AUROC max over maps: last: 95.25 best: 98.92
student savedTrain class peachTrain epoch 0
Epoch: 0.0 train loss: 813.2115
Epoch: 0.4 train loss: 138.1477
Epoch: 0.8 train loss: 119.7025
Epoch: 0.12 train loss: 109.7347
Epoch: 0.16 train loss: 103.1757
Epoch: 0.20 train loss: 97.5845Compute loss and scores on test set:
Epoch: 0 test_loss: 102.9406
AUROC mean over maps: last: 66.84 best: 66.84
AUROC max over maps: last: 96.30 best: 96.30Train epoch 1
Epoch: 1.0 train loss: 92.6392
Epoch: 1.4 train loss: 87.9831
Epoch: 1.8 train loss: 84.3091
Epoch: 1.12 train loss: 80.6787
Epoch: 1.16 train loss: 77.6049
Epoch: 1.20 train loss: 74.7313Compute loss and scores on test set:
Epoch: 1 test_loss: 85.4764
AUROC mean over maps: last: 77.32 best: 77.32
AUROC max over maps: last: 98.51 best: 98.51Train epoch 2
Epoch: 2.0 train loss: 72.1046
Epoch: 2.4 train loss: 69.7148
Epoch: 2.8 train loss: 67.5666
Epoch: 2.12 train loss: 65.5892
Epoch: 2.16 train loss: 63.6702
Epoch: 2.20 train loss: 61.9145Compute loss and scores on test set:
Epoch: 2 test_loss: 76.6544
AUROC mean over maps: last: 82.95 best: 82.95
AUROC max over maps: last: 99.27 best: 99.27
student savedTrain class carrotTrain epoch 0
Epoch: 0.0 train loss: 510.4417
Epoch: 0.4 train loss: 53.7685
Epoch: 0.8 train loss: 47.5511
Epoch: 0.12 train loss: 43.6778
Epoch: 0.16 train loss: 40.3238
Epoch: 0.20 train loss: 37.4852Compute loss and scores on test set:
Epoch: 0 test_loss: 44.7910
AUROC mean over maps: last: 71.24 best: 71.24
AUROC max over maps: last: 91.44 best: 91.44Train epoch 1
Epoch: 1.0 train loss: 35.1095
Epoch: 1.4 train loss: 33.0163
Epoch: 1.8 train loss: 31.2473
Epoch: 1.12 train loss: 29.7911
Epoch: 1.16 train loss: 28.4091
Epoch: 1.20 train loss: 26.9724Compute loss and scores on test set:
Epoch: 1 test_loss: 40.3216
AUROC mean over maps: last: 83.33 best: 83.33
AUROC max over maps: last: 96.86 best: 96.86Train epoch 2
Epoch: 2.0 train loss: 25.7731
Epoch: 2.4 train loss: 24.6105
Epoch: 2.8 train loss: 23.5178
Epoch: 2.12 train loss: 22.6717
Epoch: 2.16 train loss: 21.8394
Epoch: 2.20 train loss: 21.1530Compute loss and scores on test set:
Epoch: 2 test_loss: 38.7690
AUROC mean over maps: last: 87.82 best: 87.82
AUROC max over maps: last: 97.73 best: 97.73
student savedTrain class dowelTrain epoch 0
Epoch: 0.0 train loss: 625.0942
Epoch: 0.4 train loss: 65.2493
Epoch: 0.8 train loss: 57.8682
Epoch: 0.12 train loss: 53.3894
Epoch: 0.16 train loss: 49.3961
Epoch: 0.20 train loss: 45.6534Compute loss and scores on test set:
Epoch: 0 test_loss: 46.0253
AUROC mean over maps: last: 91.86 best: 91.86
AUROC max over maps: last: 88.83 best: 88.83Train epoch 1
Epoch: 1.0 train loss: 42.0591
Epoch: 1.4 train loss: 38.4128
Epoch: 1.8 train loss: 35.2950
Epoch: 1.12 train loss: 32.6539
Epoch: 1.16 train loss: 30.4266
Epoch: 1.20 train loss: 28.5939Compute loss and scores on test set:
Epoch: 1 test_loss: 35.5890
AUROC mean over maps: last: 95.60 best: 95.60
AUROC max over maps: last: 98.22 best: 98.22Train epoch 2
Epoch: 2.0 train loss: 26.9810
Epoch: 2.4 train loss: 25.4965
Epoch: 2.8 train loss: 24.2059
Epoch: 2.12 train loss: 23.0218
Epoch: 2.16 train loss: 21.7920
Epoch: 2.20 train loss: 20.7449Compute loss and scores on test set:
Epoch: 2 test_loss: 33.1004
AUROC mean over maps: last: 96.38 best: 96.38
AUROC max over maps: last: 98.30 best: 98.30
student savedTrain class foamTrain epoch 0
Epoch: 0.0 train loss: 1803.6814
Epoch: 0.4 train loss: 256.9068
Epoch: 0.8 train loss: 237.8092
Epoch: 0.12 train loss: 217.6799
Epoch: 0.16 train loss: 200.7390
Epoch: 0.20 train loss: 189.6523Compute loss and scores on test set:
Epoch: 0 test_loss: 188.3751
AUROC mean over maps: last: 69.62 best: 69.62
AUROC max over maps: last: 81.06 best: 81.06Train epoch 1
Epoch: 1.0 train loss: 180.5969
Epoch: 1.4 train loss: 172.2224
Epoch: 1.8 train loss: 164.5099
Epoch: 1.12 train loss: 158.1079
Epoch: 1.16 train loss: 152.4902
Epoch: 1.20 train loss: 147.9156Compute loss and scores on test set:
Epoch: 1 test_loss: 153.9179
AUROC mean over maps: last: 74.75 best: 74.75
AUROC max over maps: last: 83.38 best: 83.38Train epoch 2
Epoch: 2.0 train loss: 143.4146
Epoch: 2.4 train loss: 139.5553
Epoch: 2.8 train loss: 136.0524
Epoch: 2.12 train loss: 132.6063
Epoch: 2.16 train loss: 129.6812
Epoch: 2.20 train loss: 126.9911Compute loss and scores on test set:
Epoch: 2 test_loss: 136.7932
AUROC mean over maps: last: 76.00 best: 76.00
AUROC max over maps: last: 86.81 best: 86.81
student savedTrain class cookieTrain epoch 0
Epoch: 0.0 train loss: 1782.8553
Epoch: 0.4 train loss: 232.7387
Epoch: 0.8 train loss: 200.1909
Epoch: 0.12 train loss: 185.4901
Epoch: 0.16 train loss: 175.8931
Epoch: 0.20 train loss: 167.9045Compute loss and scores on test set:
Epoch: 0 test_loss: 173.7123
AUROC mean over maps: last: 74.93 best: 74.93
AUROC max over maps: last: 96.64 best: 96.64Train epoch 1
Epoch: 1.0 train loss: 161.2892
Epoch: 1.4 train loss: 155.1882
Epoch: 1.8 train loss: 149.2065
Epoch: 1.12 train loss: 144.1039
Epoch: 1.16 train loss: 139.5222
Epoch: 1.20 train loss: 135.0471Compute loss and scores on test set:
Epoch: 1 test_loss: 145.9559
AUROC mean over maps: last: 78.78 best: 78.78
AUROC max over maps: last: 98.20 best: 98.20Train epoch 2
Epoch: 2.0 train loss: 130.8761
Epoch: 2.4 train loss: 126.9279
Epoch: 2.8 train loss: 123.9564
Epoch: 2.12 train loss: 120.6194
Epoch: 2.16 train loss: 118.3332
Epoch: 2.20 train loss: 114.8934Compute loss and scores on test set:
Epoch: 2 test_loss: 130.8849
AUROC mean over maps: last: 83.04 best: 83.04
AUROC max over maps: last: 98.13 best: 98.20
student savedTrain class ropeTrain epoch 0
Epoch: 0.0 train loss: 685.7194
Epoch: 0.4 train loss: 78.9130
Epoch: 0.8 train loss: 58.3577
Epoch: 0.12 train loss: 51.7182
Epoch: 0.16 train loss: 46.7987
Epoch: 0.20 train loss: 43.4292Compute loss and scores on test set:
Epoch: 0 test_loss: 81.0114
AUROC mean over maps: last: 99.14 best: 99.14
AUROC max over maps: last: 99.73 best: 99.73Train epoch 1
Epoch: 1.0 train loss: 40.7731
Epoch: 1.4 train loss: 38.4770
Epoch: 1.8 train loss: 36.5572
Epoch: 1.12 train loss: 34.5402
Epoch: 1.16 train loss: 32.5070
Epoch: 1.20 train loss: 30.7293Compute loss and scores on test set:
Epoch: 1 test_loss: 104.2694
AUROC mean over maps: last: 99.23 best: 99.23
AUROC max over maps: last: 98.28 best: 99.73Train epoch 2
Epoch: 2.0 train loss: 28.8456
Epoch: 2.4 train loss: 27.1801
Epoch: 2.8 train loss: 25.6590
Epoch: 2.12 train loss: 24.2425
Epoch: 2.16 train loss: 22.8058
Epoch: 2.20 train loss: 21.4199Compute loss and scores on test set:
Epoch: 2 test_loss: 131.7585
AUROC mean over maps: last: 98.96 best: 99.23
AUROC max over maps: last: 97.37 best: 99.73
student savedTrain class potatoTrain epoch 0
Epoch: 0.0 train loss: 575.9104
Epoch: 0.4 train loss: 76.3959
Epoch: 0.8 train loss: 67.3652
Epoch: 0.12 train loss: 61.2599
Epoch: 0.16 train loss: 57.5594
Epoch: 0.20 train loss: 54.6413Compute loss and scores on test set:
Epoch: 0 test_loss: 59.2487
AUROC mean over maps: last: 53.36 best: 53.36
AUROC max over maps: last: 96.20 best: 96.20Train epoch 1
Epoch: 1.0 train loss: 51.9432
Epoch: 1.4 train loss: 49.5469
Epoch: 1.8 train loss: 47.4526
Epoch: 1.12 train loss: 45.3539
Epoch: 1.16 train loss: 43.8155
Epoch: 1.20 train loss: 41.8991Compute loss and scores on test set:
Epoch: 1 test_loss: 49.1459
AUROC mean over maps: last: 59.49 best: 59.49
AUROC max over maps: last: 97.53 best: 97.53Train epoch 2
Epoch: 2.0 train loss: 40.3873
Epoch: 2.4 train loss: 39.1562
Epoch: 2.8 train loss: 37.8419
Epoch: 2.12 train loss: 36.7338
Epoch: 2.16 train loss: 35.5961
Epoch: 2.20 train loss: 34.6050Compute loss and scores on test set:
Epoch: 2 test_loss: 44.2994
AUROC mean over maps: last: 63.34 best: 63.34
AUROC max over maps: last: 96.64 best: 97.53
student savedTrain class tireTrain epoch 0
Epoch: 0.0 train loss: 1268.9452
Epoch: 0.4 train loss: 165.4561
Epoch: 0.8 train loss: 148.5384
Epoch: 0.12 train loss: 138.5010
Epoch: 0.16 train loss: 130.8241
Epoch: 0.20 train loss: 124.2485Compute loss and scores on test set:
Epoch: 0 test_loss: 122.2500
AUROC mean over maps: last: 46.11 best: 46.11
AUROC max over maps: last: 67.22 best: 67.22Train epoch 1
Epoch: 1.0 train loss: 118.7098
Epoch: 1.4 train loss: 114.0856
Epoch: 1.8 train loss: 109.3179
Epoch: 1.12 train loss: 105.0755
Epoch: 1.16 train loss: 101.0346
Epoch: 1.20 train loss: 97.2061Compute loss and scores on test set:
Epoch: 1 test_loss: 100.4169
AUROC mean over maps: last: 56.64 best: 56.64
AUROC max over maps: last: 68.64 best: 68.64Train epoch 2
Epoch: 2.0 train loss: 93.9064
Epoch: 2.4 train loss: 90.7649
Epoch: 2.8 train loss: 87.9450
Epoch: 2.12 train loss: 85.4541
Epoch: 2.16 train loss: 83.2304
Epoch: 2.20 train loss: 81.0927Compute loss and scores on test set:
Epoch: 2 test_loss: 88.3829
AUROC mean over maps: last: 60.05 best: 60.05
AUROC max over maps: last: 68.46 best: 68.64
student savedAUROC % after last epochmean over maps: 81.50 max over maps: 92.55
best AUROC %mean over maps: 81.68 max over maps: 93.26Process finished with exit code 0
train_student.py
ssh://cszx@172.29.6.20:22/home/cszx/miniconda3/envs/zgp_ast/bin/python -u /home/cszx/c1/zgp/AST-main/AST-main/train_student.py
my_experimentTrain class cable_glandTrain epoch 0
Epoch: 0.0 train loss: 0.5756
Epoch: 0.4 train loss: 0.2079
Epoch: 0.8 train loss: 0.2045
Epoch: 0.12 train loss: 0.1780
Epoch: 0.16 train loss: 0.1403
Epoch: 0.20 train loss: 0.1154Compute loss and scores on test set:
Epoch: 0 test_loss: 0.1613
AUROC mean over maps: last: 85.88 best: 85.88
AUROC max over maps: last: 95.40 best: 95.40Train epoch 1
Epoch: 1.0 train loss: 0.0983
Epoch: 1.4 train loss: 0.0848
Epoch: 1.8 train loss: 0.0742
Epoch: 1.12 train loss: 0.0640
Epoch: 1.16 train loss: 0.0552
Epoch: 1.20 train loss: 0.0478Compute loss and scores on test set:
Epoch: 1 test_loss: 0.1483
AUROC mean over maps: last: 86.81 best: 86.81
AUROC max over maps: last: 95.73 best: 95.73Train epoch 2
Epoch: 2.0 train loss: 0.0416
Epoch: 2.4 train loss: 0.0362
Epoch: 2.8 train loss: 0.0324
Epoch: 2.12 train loss: 0.0281
Epoch: 2.16 train loss: 0.0254
Epoch: 2.20 train loss: 0.0220Compute loss and scores on test set:
Epoch: 2 test_loss: 0.1520
AUROC mean over maps: last: 87.30 best: 87.30
AUROC max over maps: last: 95.57 best: 95.73
student savedTrain class bagelTrain epoch 0
Epoch: 0.0 train loss: 0.8018
Epoch: 0.4 train loss: 0.4100
Epoch: 0.8 train loss: 0.4074
Epoch: 0.12 train loss: 0.3762
Epoch: 0.16 train loss: 0.3177
Epoch: 0.20 train loss: 0.2642Compute loss and scores on test set:
Epoch: 0 test_loss: 113.2161
AUROC mean over maps: last: 89.72 best: 89.72
AUROC max over maps: last: 94.27 best: 94.27Train epoch 1
Epoch: 1.0 train loss: 0.2218
Epoch: 1.4 train loss: 0.1894
Epoch: 1.8 train loss: 0.1635
Epoch: 1.12 train loss: 0.1425
Epoch: 1.16 train loss: 0.1243
Epoch: 1.20 train loss: 0.1093Compute loss and scores on test set:
Epoch: 1 test_loss: 113.1789
AUROC mean over maps: last: 91.32 best: 91.32
AUROC max over maps: last: 93.75 best: 94.27Train epoch 2
Epoch: 2.0 train loss: 0.0976
Epoch: 2.4 train loss: 0.0879
Epoch: 2.8 train loss: 0.0789
Epoch: 2.12 train loss: 0.0714
Epoch: 2.16 train loss: 0.0648
Epoch: 2.20 train loss: 0.0588Compute loss and scores on test set:
Epoch: 2 test_loss: 113.1820
AUROC mean over maps: last: 92.15 best: 92.15
AUROC max over maps: last: 93.75 best: 94.27
student savedTrain class peachTrain epoch 0
Epoch: 0.0 train loss: 0.4312
Epoch: 0.4 train loss: 0.2394
Epoch: 0.8 train loss: 0.2337
Epoch: 0.12 train loss: 0.2090
Epoch: 0.16 train loss: 0.1759
Epoch: 0.20 train loss: 0.1475Compute loss and scores on test set:
Epoch: 0 test_loss: 0.2279
AUROC mean over maps: last: 87.59 best: 87.59
AUROC max over maps: last: 99.24 best: 99.24Train epoch 1
Epoch: 1.0 train loss: 0.1244
Epoch: 1.4 train loss: 0.1041
Epoch: 1.8 train loss: 0.0861
Epoch: 1.12 train loss: 0.0721
Epoch: 1.16 train loss: 0.0600
Epoch: 1.20 train loss: 0.0509Compute loss and scores on test set:
Epoch: 1 test_loss: 0.2195
AUROC mean over maps: last: 88.13 best: 88.13
AUROC max over maps: last: 99.27 best: 99.27Train epoch 2
Epoch: 2.0 train loss: 0.0436
Epoch: 2.4 train loss: 0.0374
Epoch: 2.8 train loss: 0.0327
Epoch: 2.12 train loss: 0.0285
Epoch: 2.16 train loss: 0.0253
Epoch: 2.20 train loss: 0.0227Compute loss and scores on test set:
Epoch: 2 test_loss: 0.2250
AUROC mean over maps: last: 87.92 best: 88.13
AUROC max over maps: last: 99.24 best: 99.27
student savedTrain class carrotTrain epoch 0
Epoch: 0.0 train loss: 0.2496
Epoch: 0.4 train loss: 0.0871
Epoch: 0.8 train loss: 0.0864
Epoch: 0.12 train loss: 0.0838
Epoch: 0.16 train loss: 0.0737
Epoch: 0.20 train loss: 0.0595Compute loss and scores on test set:
Epoch: 0 test_loss: 0.1468
AUROC mean over maps: last: 88.41 best: 88.41
AUROC max over maps: last: 99.19 best: 99.19Train epoch 1
Epoch: 1.0 train loss: 0.0462
Epoch: 1.4 train loss: 0.0340
Epoch: 1.8 train loss: 0.0246
Epoch: 1.12 train loss: 0.0180
Epoch: 1.16 train loss: 0.0133
Epoch: 1.20 train loss: 0.0105Compute loss and scores on test set:
Epoch: 1 test_loss: 0.1464
AUROC mean over maps: last: 88.58 best: 88.58
AUROC max over maps: last: 99.13 best: 99.19Train epoch 2
Epoch: 2.0 train loss: 0.0081
Epoch: 2.4 train loss: 0.0069
Epoch: 2.8 train loss: 0.0059
Epoch: 2.12 train loss: 0.0053
Epoch: 2.16 train loss: 0.0050
Epoch: 2.20 train loss: 0.0043Compute loss and scores on test set:
Epoch: 2 test_loss: 0.1447
AUROC mean over maps: last: 88.61 best: 88.61
AUROC max over maps: last: 99.16 best: 99.19
student savedTrain class dowelTrain epoch 0
Epoch: 0.0 train loss: 0.2697
Epoch: 0.4 train loss: 0.0966
Epoch: 0.8 train loss: 0.0960
Epoch: 0.12 train loss: 0.0949
Epoch: 0.16 train loss: 0.0898
Epoch: 0.20 train loss: 0.0741Compute loss and scores on test set:
Epoch: 0 test_loss: 0.1446
AUROC mean over maps: last: 98.56 best: 98.56
AUROC max over maps: last: 98.48 best: 98.48Train epoch 1
Epoch: 1.0 train loss: 0.0587
Epoch: 1.4 train loss: 0.0451
Epoch: 1.8 train loss: 0.0347
Epoch: 1.12 train loss: 0.0246
Epoch: 1.16 train loss: 0.0182
Epoch: 1.20 train loss: 0.0138Compute loss and scores on test set:
Epoch: 1 test_loss: 0.1394
AUROC mean over maps: last: 98.71 best: 98.71
AUROC max over maps: last: 98.37 best: 98.48Train epoch 2
Epoch: 2.0 train loss: 0.0108
Epoch: 2.4 train loss: 0.0090
Epoch: 2.8 train loss: 0.0073
Epoch: 2.12 train loss: 0.0067
Epoch: 2.16 train loss: 0.0061
Epoch: 2.20 train loss: 0.0053Compute loss and scores on test set:
Epoch: 2 test_loss: 0.1378
AUROC mean over maps: last: 98.67 best: 98.71
AUROC max over maps: last: 98.30 best: 98.48
student savedTrain class foamTrain epoch 0
Epoch: 0.0 train loss: 0.7689
Epoch: 0.4 train loss: 0.4029
Epoch: 0.8 train loss: 0.4001
Epoch: 0.12 train loss: 0.3740
Epoch: 0.16 train loss: 0.3271
Epoch: 0.20 train loss: 0.2813Compute loss and scores on test set:
Epoch: 0 test_loss: 0.3547
AUROC mean over maps: last: 82.69 best: 82.69
AUROC max over maps: last: 86.06 best: 86.06Train epoch 1
Epoch: 1.0 train loss: 0.2412
Epoch: 1.4 train loss: 0.2080
Epoch: 1.8 train loss: 0.1789
Epoch: 1.12 train loss: 0.1568
Epoch: 1.16 train loss: 0.1372
Epoch: 1.20 train loss: 0.1206Compute loss and scores on test set:
Epoch: 1 test_loss: 0.4004
AUROC mean over maps: last: 83.88 best: 83.88
AUROC max over maps: last: 86.12 best: 86.12Train epoch 2
Epoch: 2.0 train loss: 0.1064
Epoch: 2.4 train loss: 0.0949
Epoch: 2.8 train loss: 0.0839
Epoch: 2.12 train loss: 0.0757
Epoch: 2.16 train loss: 0.0685
Epoch: 2.20 train loss: 0.0604Compute loss and scores on test set:
Epoch: 2 test_loss: 0.3517
AUROC mean over maps: last: 84.00 best: 84.00
AUROC max over maps: last: 85.75 best: 86.12
student savedTrain class cookieTrain epoch 0
Epoch: 0.0 train loss: 0.7955
Epoch: 0.4 train loss: 0.4147
Epoch: 0.8 train loss: 0.4100
Epoch: 0.12 train loss: 0.3769
Epoch: 0.16 train loss: 0.3212
Epoch: 0.20 train loss: 0.2724Compute loss and scores on test set:
Epoch: 0 test_loss: 0.3825
AUROC mean over maps: last: 95.15 best: 95.15
AUROC max over maps: last: 100.00 best: 100.00Train epoch 1
Epoch: 1.0 train loss: 0.2334
Epoch: 1.4 train loss: 0.1996
Epoch: 1.8 train loss: 0.1726
,anKHEpoch: 1.12 train loss: 0.1489
HHHHHHHHHHHHHHLEpoch: 1.16 train loss: 0.1304
Epoch: 1.20 train loss: 0.1120Compute loss and scores on test set:
Epoch: 1 test_loss: 0.3212
AUROC mean over maps: last: 95.56 best: 95.56
AUROC max over maps: last: 100.00 best: 100.00Train epoch 2
Epoch: 2.0 train loss: 0.0992
Epoch: 2.4 train loss: 0.0872
Epoch: 2.8 train loss: 0.0777
Epoch: 2.12 train loss: 0.0692
Epoch: 2.16 train loss: 0.0625
Epoch: 2.20 train loss: 0.0554Compute loss and scores on test set:
Epoch: 2 test_loss: 0.3207
AUROC mean over maps: last: 94.66 best: 95.56
AUROC max over maps: last: 99.79 best: 100.00
student savedTrain class ropeTrain epoch 0
Epoch: 0.0 train loss: 0.3141
Epoch: 0.4 train loss: 0.1676
Epoch: 0.8 train loss: 0.1649
Epoch: 0.12 train loss: 0.1554
Epoch: 0.16 train loss: 0.1374
Epoch: 0.20 train loss: 0.1165Compute loss and scores on test set:
Epoch: 0 test_loss: 0.6708
AUROC mean over maps: last: 98.19 best: 98.19
AUROC max over maps: last: 96.38 best: 96.38Train epoch 1
Epoch: 1.0 train loss: 0.0987
Epoch: 1.4 train loss: 0.0834
Epoch: 1.8 train loss: 0.0700
Epoch: 1.12 train loss: 0.0582
Epoch: 1.16 train loss: 0.0465
Epoch: 1.20 train loss: 0.0374Compute loss and scores on test set:
Epoch: 1 test_loss: 0.6479
AUROC mean over maps: last: 98.46 best: 98.46
AUROC max over maps: last: 96.06 best: 96.38Train epoch 2
Epoch: 2.0 train loss: 0.0300
Epoch: 2.4 train loss: 0.0233
Epoch: 2.8 train loss: 0.0190
Epoch: 2.12 train loss: 0.0158
Epoch: 2.16 train loss: 0.0132
Epoch: 2.20 train loss: 0.0116Compute loss and scores on test set:
Epoch: 2 test_loss: 0.6503
AUROC mean over maps: last: 98.46 best: 98.46
AUROC max over maps: last: 96.06 best: 96.38
student savedTrain class potatoTrain epoch 0
Epoch: 0.0 train loss: 0.2972
Epoch: 0.4 train loss: 0.1213
Epoch: 0.8 train loss: 0.1207
Epoch: 0.12 train loss: 0.1164
Epoch: 0.16 train loss: 0.1032
Epoch: 0.20 train loss: 0.0856Compute loss and scores on test set:
Epoch: 0 test_loss: 0.1373
AUROC mean over maps: last: 69.96 best: 69.96
AUROC max over maps: last: 99.01 best: 99.01Train epoch 1
Epoch: 1.0 train loss: 0.0695
Epoch: 1.4 train loss: 0.0553
Epoch: 1.8 train loss: 0.0430
Epoch: 1.12 train loss: 0.0336
Epoch: 1.16 train loss: 0.0264
Epoch: 1.20 train loss: 0.0210Compute loss and scores on test set:
Epoch: 1 test_loss: 0.1388
AUROC mean over maps: last: 68.82 best: 69.96
AUROC max over maps: last: 99.16 best: 99.16Train epoch 2
Epoch: 2.0 train loss: 0.0173
Epoch: 2.4 train loss: 0.0141
Epoch: 2.8 train loss: 0.0122
Epoch: 2.12 train loss: 0.0108
Epoch: 2.16 train loss: 0.0094
Epoch: 2.20 train loss: 0.0088Compute loss and scores on test set:
Epoch: 2 test_loss: 0.1393
AUROC mean over maps: last: 69.12 best: 69.96
AUROC max over maps: last: 99.26 best: 99.26
student savedTrain class tireTrain epoch 0
Epoch: 0.0 train loss: 0.5844
Epoch: 0.4 train loss: 0.2577
Epoch: 0.8 train loss: 0.2566
Epoch: 0.12 train loss: 0.2541
Epoch: 0.16 train loss: 0.2445
Epoch: 0.20 train loss: 0.2168Compute loss and scores on test set:
Epoch: 0 test_loss: 0.2498
AUROC mean over maps: last: 68.97 best: 68.97
AUROC max over maps: last: 73.93 best: 73.93Train epoch 1
Epoch: 1.0 train loss: 0.1854
Epoch: 1.4 train loss: 0.1579
Epoch: 1.8 train loss: 0.1356
Epoch: 1.12 train loss: 0.1166
Epoch: 1.16 train loss: 0.0992
Epoch: 1.20 train loss: 0.0834Compute loss and scores on test set:
Epoch: 1 test_loss: 0.2078
AUROC mean over maps: last: 71.40 best: 71.40
AUROC max over maps: last: 77.06 best: 77.06Train epoch 2
Epoch: 2.0 train loss: 0.0719
Epoch: 2.4 train loss: 0.0594
Epoch: 2.8 train loss: 0.0514
Epoch: 2.12 train loss: 0.0424
Epoch: 2.16 train loss: 0.0356
Epoch: 2.20 train loss: 0.0309Compute loss and scores on test set:
Epoch: 2 test_loss: 0.2128
AUROC mean over maps: last: 70.57 best: 71.40
AUROC max over maps: last: 76.60 best: 77.06
student savedAUROC % after last epochmean over maps: 87.15 max over maps: 94.35
best AUROC %mean over maps: 87.43 max over maps: 94.58Process finished with exit code 0
eval.py
ssh://cszx@172.29.6.20:22/home/cszx/miniconda3/envs/zgp_ast/bin/python -u /home/cszx/c1/zgp/AST-main/AST-main/eval.py
my_experimentEvaluate class cable_gland
AUROC % mean over maps: 87.30 max over maps: 96.44 pixel: 97.73Evaluate class bagel
AUROC % mean over maps: 92.15 max over maps: 93.90 pixel: 98.47Evaluate class peach
AUROC % mean over maps: 87.92 max over maps: 99.27 pixel: 99.64Evaluate class carrot
AUROC % mean over maps: 88.61 max over maps: 99.19 pixel: 99.75Evaluate class dowel
AUROC % mean over maps: 98.67 max over maps: 98.22 pixel: 93.05Evaluate class foam
AUROC % mean over maps: 84.00 max over maps: 86.31 pixel: 97.00Evaluate class cookie
AUROC % mean over maps: 94.66 max over maps: 99.79 pixel: 95.53Evaluate class rope
AUROC % mean over maps: 98.46 max over maps: 96.20 pixel: 94.56Evaluate class potato
AUROC % mean over maps: 69.12 max over maps: 99.31 pixel: 99.85Evaluate class tire
AUROC % mean over maps: 70.57 max over maps: 77.75 pixel: 98.79mean AUROC % over all classesmean over maps: 87.15 max over maps: 94.64 pixel: 97.44Process finished with exit code 0
后台运行的方法运行报错
nohup: ignoring input
my_experiment
Traceback (most recent call last):File "eval.py", line 9, in <module>from model import *File "/home/cszx/c1/zgp/AST-main/AST-main/model.py", line 5, in <module>from efficientnet_pytorch import EfficientNet
ModuleNotFoundError: No module named 'efficientnet_pytorch'
退出所有虚拟环境,再重新激活使用的虚拟环境,取消一下base的影响
可以了。
这篇关于AST: Asymmetric Student-Teacher Networks for Industrial Anomaly Detection代码运行的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!