YoloV7改進(jìn)策略:SwiftFormer,全網(wǎng)首發(fā),獨家改進(jìn)的高效加性注意力用于實時移動視覺
摘要
本文提出了新型高效加性注意力機(jī)制,替代傳統(tǒng)自注意力機(jī)制中的二次矩陣乘法操作,線性元素級乘法可實現(xiàn)關(guān)鍵-值交互的替換。該高效自注意力機(jī)制可在網(wǎng)絡(luò)所有階段使用,不會犧牲準(zhǔn)確性。同時介紹了名為“SwiftFormer”的模型系列,在準(zhǔn)確性和移動推理速度方面達(dá)到了最先進(jìn)的性能。其中一種小規(guī)模變體在iPhone 14上以僅0.8毫秒的延遲實現(xiàn)了78.5%的ImageNet-1K準(zhǔn)確率,比MobileViT-v2更準(zhǔn)確且快兩倍,可用于分類、檢測和分割等視覺應(yīng)用。與EfficientFormer-L1相比,SwiftFormer-L1在準(zhǔn)確率方面絕對增加了1.7%,同時保持相同的延遲,且不需要任何神經(jīng)架構(gòu)搜索。

將其引入到Y(jié)oloV7中,會有什么樣的效果呢?
YoloV7官方代碼測試結(jié)果
?????????????????all?????????229????????1407???????0.966????????0.99???????0.993???????0.734
?????????????????c17?????????229?????????131???????0.977???????0.992???????0.991???????0.828
??????????????????c5?????????229??????????68???????0.941???????????1????????0.99???????0.837
??????????helicopter?????????229??????????43???????0.949???????????1????????0.98???????0.628
????????????????c130?????????229??????????85???????0.994???????????1???????0.997???????0.691
?????????????????f16?????????229??????????57????????0.99???????0.965???????0.994???????0.694
??????????????????b2?????????229???????????2???????0.904???????????1???????0.995???????0.796
???????????????other?????????229??????????86???????0.988???????0.955???????0.992???????0.565
?????????????????b52?????????229??????????65????????0.98???????0.969???????0.985???????0.819
????????????????kc10?????????229??????????62???????0.995???????0.984???????0.986????????0.83
?????????????command?????????229??????????40???????0.991???????????1???????0.996???????0.835
?????????????????f15?????????229?????????123???????0.992???????0.992???????0.997???????0.652
???????????????kc135?????????229??????????91???????0.986???????0.989???????0.987???????0.707
?????????????????a10?????????229??????????27???????????1???????0.889???????0.997???????0.454
??????????????????b1?????????229??????????20???????0.989???????????1???????0.996????????0.74
?????????????????aew?????????229??????????25???????0.949???????????1???????0.981???????0.751
?????????????????f22?????????229??????????17???????0.977???????????1???????0.996???????0.754
??????????????????p3?????????229?????????105???????0.998???????????1???????0.998???????0.797
??????????????????p8?????????229???????????1???????0.853???????????1???????0.995???????0.597
?????????????????f35?????????229??????????32???????0.994???????????1???????0.996????????0.58
?????????????????f18?????????229?????????125???????0.991???????0.992???????0.993???????0.822
?????????????????v22?????????229??????????41???????0.995???????????1???????0.996???????0.696
???????????????su-27?????????229??????????31???????0.992???????????1???????0.996???????0.829
???????????????il-38?????????229??????????27???????0.962???????????1???????0.996???????0.857
??????????????tu-134?????????229???????????1???????0.846???????????1???????0.995???????0.896
???????????????su-33?????????229???????????2???????0.939???????????1???????0.995???????0.498
???????????????an-70?????????229???????????2???????0.904???????????1???????0.995???????0.846
???????????????tu-22?????????229??????????98???????0.998???????????1???????0.998????????0.81
改進(jìn)一
測試結(jié)果
??Class??????Images??????Labels???????????P???????????R??????mAP@.5??mAP@.5:.95:?100%|██████████|?15/15?[00:02<00:00,??5.71it/s]
?????????????????all?????????229????????1407???????0.964???????0.929????????0.99???????0.711
?????????????????c17?????????229?????????131???????0.985???????0.994???????0.996???????0.812
??????????????????c5?????????229??????????68???????0.949???????????1???????0.994???????0.836
??????????helicopter?????????229??????????43???????0.953???????0.937???????0.961???????0.606
????????????????c130?????????229??????????85???????0.976???????0.969???????0.995???????0.662
?????????????????f16?????????229??????????57???????0.983???????0.965???????0.981???????0.655
??????????????????b2?????????229???????????2???????0.917???????????1???????0.995???????0.622
???????????????other?????????229??????????86???????0.987???????0.898???????0.975???????0.534
?????????????????b52?????????229??????????65???????0.969???????0.969???????0.973???????0.788
????????????????kc10?????????229??????????62???????????1???????0.984???????0.986???????0.807
?????????????command?????????229??????????40???????0.995???????????1???????0.996???????0.771
?????????????????f15?????????229?????????123???????0.938???????0.983???????0.994???????0.645
???????????????kc135?????????229??????????91???????0.987???????0.989???????0.986???????0.678
?????????????????a10?????????229??????????27???????????1???????0.515????????0.98???????0.456
??????????????????b1?????????229??????????20????????0.99???????????1???????0.995????????0.68
?????????????????aew?????????229??????????25???????0.954???????????1???????0.993???????0.758
?????????????????f22?????????229??????????17???????0.844???????????1???????0.993???????0.738
??????????????????p3?????????229?????????105???????0.997???????????1???????0.997???????0.789
??????????????????p8?????????229???????????1???????0.867???????????1???????0.995???????0.697
?????????????????f35?????????229??????????32???????????1????????0.89???????0.977???????0.522
?????????????????f18?????????229?????????125???????0.978???????0.992???????0.994???????0.804
?????????????????v22?????????229??????????41???????0.994???????????1???????0.996???????0.658
???????????????su-27?????????229??????????31???????0.984???????????1???????0.996???????0.815
???????????????il-38?????????229??????????27???????0.993???????????1???????0.996???????0.838
??????????????tu-134?????????229???????????1???????0.865???????????1???????0.995???????0.896
???????????????su-33?????????229???????????2???????????1???????????0???????0.995???????0.597
???????????????an-70?????????229???????????2????????0.93???????????1???????0.995???????0.746
???????????????tu-22?????????229??????????98???????0.998???????????1???????0.996???????0.801
300?epochs?completed?in?4.461?hours.
Optimizer?stripped?from?runs\train\exp3\weights\last.pt,?52.2MB
Optimizer?stripped?from?runs\train\exp3\weights\best.pt,?52.2MB
改進(jìn)二
測試結(jié)果
???Class??????Images??????Labels???????????P???????????R??????mAP@.5??mAP@.5:.95:?100%|██████████|?15/15?[00:02<00:00,??5.14it/s]
?????????????????all?????????229????????1407???????0.969???????0.981???????0.993???????0.728
?????????????????c17?????????229?????????131???????0.975???????????1???????0.996????????0.84
??????????????????c5?????????229??????????68????????0.96???????????1???????0.994???????0.842
??????????helicopter?????????229??????????43???????0.954???????????1???????0.979???????0.637
????????????????c130?????????229??????????85???????????1???????0.995???????0.997???????0.676
?????????????????f16?????????229??????????57????????0.99???????0.965???????0.992???????0.679
??????????????????b2?????????229???????????2???????0.926???????????1???????0.995???????0.622
???????????????other?????????229??????????86???????????1???????0.903???????0.993???????0.584
?????????????????b52?????????229??????????65???????0.984????????0.97???????0.986???????0.821
????????????????kc10?????????229??????????62???????0.998???????0.984???????0.986???????0.831
?????????????command?????????229??????????40???????0.982???????????1???????0.996???????0.834
?????????????????f15?????????229?????????123???????????1???????0.987???????0.997????????0.68
???????????????kc135?????????229??????????91???????0.988???????0.989???????0.987?????????0.7
?????????????????a10?????????229??????????27???????????1???????0.713???????0.992???????0.441
??????????????????b1?????????229??????????20???????0.986???????????1???????0.996???????0.698
?????????????????aew?????????229??????????25???????0.957???????????1???????0.978???????0.769
?????????????????f22?????????229??????????17???????0.986???????????1???????0.995???????0.733
??????????????????p3?????????229?????????105???????0.989???????????1???????0.997???????0.808
??????????????????p8?????????229???????????1???????0.716???????????1???????0.995???????0.597
?????????????????f35?????????229??????????32???????????1???????0.991???????0.996???????0.578
?????????????????f18?????????229?????????125???????0.984???????0.992???????0.992???????0.812
?????????????????v22?????????229??????????41???????0.995???????????1???????0.996????????0.69
???????????????su-27?????????229??????????31???????0.996???????????1???????0.996???????0.836
???????????????il-38?????????229??????????27???????0.993???????????1???????0.996???????0.872
??????????????tu-134?????????229???????????1???????0.871???????????1???????0.995???????0.896
???????????????su-33?????????229???????????2???????????1???????0.999???????0.995???????0.547
???????????????an-70?????????229???????????2???????0.931???????????1???????0.995???????0.821
???????????????tu-22?????????229??????????98???????0.998???????????1???????0.998???????0.813
300?epochs?completed?in?8.737?hours.
Optimizer?stripped?from?runs\train\exp4\weights\last.pt,?83.5MB
Optimizer?stripped?from?runs\train\exp4\weights\best.pt,?83.5MB
改進(jìn)三
測試結(jié)果
??Class??????Images??????Labels???????????P???????????R??????mAP@.5??mAP@.5:.95:?100%|██████████|?15/15?[00:03<00:00,??4.70it/s]
?????????????????all?????????229????????1407???????0.934???????0.994???????0.992???????0.733
?????????????????c17?????????229?????????131???????0.965???????????1???????0.994???????0.839
??????????????????c5?????????229??????????68???????0.934???????????1???????0.997???????0.851
??????????helicopter?????????229??????????43???????0.938???????????1???????0.983???????0.636
????????????????c130?????????229??????????85???????0.991???????????1???????0.997???????0.663
?????????????????f16?????????229??????????57???????0.966???????0.965???????0.994???????0.683
??????????????????b2?????????229???????????2???????0.771???????????1???????0.995???????0.721
???????????????other?????????229??????????86???????0.979???????0.965????????0.99???????0.539
?????????????????b52?????????229??????????65???????0.989???????0.969???????0.979???????0.821
????????????????kc10?????????229??????????62???????0.987???????0.984???????0.986???????0.834
?????????????command?????????229??????????40???????0.982???????????1???????0.997???????0.829
?????????????????f15?????????229?????????123???????0.928???????????1???????0.996???????0.666
???????????????kc135?????????229??????????91????????0.98???????0.989???????0.987???????0.693
?????????????????a10?????????229??????????27???????0.939???????0.963???????0.954????????0.46
??????????????????b1?????????229??????????20????????0.97???????????1???????0.996???????0.701
?????????????????aew?????????229??????????25????????0.94???????????1???????0.984???????0.752
?????????????????f22?????????229??????????17???????0.963???????????1???????0.996???????0.728
??????????????????p3?????????229?????????105???????0.976???????????1???????0.998???????0.801
??????????????????p8?????????229???????????1???????0.681???????????1???????0.995???????0.498
?????????????????f35?????????229??????????32???????0.982???????????1???????0.996???????0.579
?????????????????f18?????????229?????????125???????0.972???????0.992???????0.989???????0.801
?????????????????v22?????????229??????????41???????0.983???????????1???????0.996???????0.706
???????????????su-27?????????229??????????31???????0.981???????????1???????0.996???????0.822
???????????????il-38?????????229??????????27???????0.974???????????1???????0.996???????0.859
??????????????tu-134?????????229???????????1???????0.663???????????1???????0.995???????0.896
???????????????su-33?????????229???????????2???????????1???????0.998???????0.995???????0.622
???????????????an-70?????????229???????????2???????0.791???????????1???????0.995???????0.945
???????????????tu-22?????????229??????????98???????0.993???????????1???????0.997???????0.838
300?epochs?completed?in?11.886?hours.
Optimizer?stripped?from?runs\train\exp2\weights\last.pt,?81.5MB
Optimizer?stripped?from?runs\train\exp2\weights\best.pt,?81.5MB
鏈接: