[{"data":1,"prerenderedAt":815},["ShallowReactive",2],{"content-query-mJMB7gcJLS":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"category":13,"body":14,"_type":809,"_id":810,"_source":811,"_file":812,"_stem":813,"_extension":814},"/technology-blogs/zh/1474","zh",false,"","昇思MindSpore Vision套件数据可视化","为了方便对网络模型的训练损失、验证精度等结果进行展示，以及对不同模型之间的结果进行对比分析，数据可视化的工作就显得尤为重要。","2022-05-07","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/e7ff5c0964e548938389d102b2d65331.png","technology-blogs","实践",{"type":15,"children":16,"toc":806},"root",[17,25,34,38,43,48,59,71,79,87,92,100,112,123,134,145,156,167,178,186,191,196,203,210,218,223,230,235,240,245,250,255,260,265,272,277,284,291,299,304,311,316,320,324,328,332,336,340,347,352,362,369,377,382,389,394,399,403,407,411,415,419,423,430,435,440,445,450,458,465,473,478,485,490,495,499,503,507,511,515,519,526,531,536,541,549,556,564,569,576,581,585,589,593,597,601,605,612,617,622,627,632,640,647,655,660,667,672,676,680,684,688,693,700,705,710,718,725,732,740,750,766,776,791],{"type":18,"tag":19,"props":20,"children":22},"element","h1",{"id":21},"昇思mindspore-vision套件数据可视化",[23],{"type":24,"value":8},"text",{"type":18,"tag":26,"props":27,"children":28},"p",{},[29],{"type":18,"tag":30,"props":31,"children":33},"img",{"alt":7,"src":32},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/82ee03d07bc0451e8ce2309907efe0e5.gif",[],{"type":18,"tag":26,"props":35,"children":36},{},[37],{"type":24,"value":9},{"type":18,"tag":26,"props":39,"children":40},{},[41],{"type":24,"value":42},"昇思MindSpore Vision套件对外提供了相关的数据可视化API，可以方便开发者在做网络模型实验、学习、更好的助力科研等工作。",{"type":18,"tag":26,"props":44,"children":45},{},[46],{"type":24,"value":47},"下面将对昇思MindSpore Vision套件所提供的数据可视化API的功能以及应用场景进行介绍",{"type":18,"tag":26,"props":49,"children":50},{},[51,57],{"type":18,"tag":52,"props":53,"children":54},"strong",{},[55],{"type":24,"value":56},"源代码链接",{"type":24,"value":58},"：",{"type":18,"tag":26,"props":60,"children":61},{},[62],{"type":18,"tag":63,"props":64,"children":68},"a",{"href":65,"rel":66},"https://gitee.com/mindspore/vision/blob/master/docs/visualization%5C_of%5C_experience.ipynb",[67],"nofollow",[69],{"type":24,"value":70},"https://gitee.com/mindspore/vision/blob/master/docs/visualization\\_of\\_experience.ipynb",{"type":18,"tag":26,"props":72,"children":73},{},[74],{"type":18,"tag":52,"props":75,"children":76},{},[77],{"type":24,"value":78},"实验数据可视化",{"type":18,"tag":26,"props":80,"children":81},{},[82],{"type":18,"tag":52,"props":83,"children":84},{},[85],{"type":24,"value":86},"topn_accuracy_chart",{"type":18,"tag":26,"props":88,"children":89},{},[90],{"type":24,"value":91},"函数topn_accuracy_chart主要用于绘制在不同AI框架下，模型精度的对比。",{"type":18,"tag":26,"props":93,"children":94},{},[95],{"type":18,"tag":52,"props":96,"children":97},{},[98],{"type":24,"value":99},"参数说明",{"type":18,"tag":26,"props":101,"children":102},{},[103,105,110],{"type":24,"value":104},"【",{"type":18,"tag":52,"props":106,"children":107},{},[108],{"type":24,"value":109},"accuracy_data",{"type":24,"value":111},"】用于绘制折线图的模型数据，其中数据包括不同AI框架下的模型精度。",{"type":18,"tag":26,"props":113,"children":114},{},[115,116,121],{"type":24,"value":104},{"type":18,"tag":52,"props":117,"children":118},{},[119],{"type":24,"value":120},"save_path",{"type":24,"value":122},"】图表的保存路径。",{"type":18,"tag":26,"props":124,"children":125},{},[126,127,132],{"type":24,"value":104},{"type":18,"tag":52,"props":128,"children":129},{},[130],{"type":24,"value":131},"ylim",{"type":24,"value":133},"】图表y坐标的刻度范围。",{"type":18,"tag":26,"props":135,"children":136},{},[137,138,143],{"type":24,"value":104},{"type":18,"tag":52,"props":139,"children":140},{},[141],{"type":24,"value":142},"figsize",{"type":24,"value":144},"】图表的尺寸。",{"type":18,"tag":26,"props":146,"children":147},{},[148,149,154],{"type":24,"value":104},{"type":18,"tag":52,"props":150,"children":151},{},[152],{"type":24,"value":153},"title",{"type":24,"value":155},"】图表的标题。",{"type":18,"tag":26,"props":157,"children":158},{},[159,160,165],{"type":24,"value":104},{"type":18,"tag":52,"props":161,"children":162},{},[163],{"type":24,"value":164},"xlabel",{"type":24,"value":166},"】图表x坐标的标签。",{"type":18,"tag":26,"props":168,"children":169},{},[170,171,176],{"type":24,"value":104},{"type":18,"tag":52,"props":172,"children":173},{},[174],{"type":24,"value":175},"ylabel",{"type":24,"value":177},"】图表y坐标的标签。",{"type":18,"tag":26,"props":179,"children":180},{},[181],{"type":18,"tag":52,"props":182,"children":183},{},[184],{"type":24,"value":185},"样例",{"type":18,"tag":26,"props":187,"children":188},{},[189],{"type":24,"value":190},"以下样例绘制了Resnet系列模型分别在MindSpore、Pytorch、Paper下的模型精度对比。结论如下：",{"type":18,"tag":26,"props":192,"children":193},{},[194],{"type":24,"value":195},"基于MindSpore框架下训练的Resnet系列模型，在ImageNet验证数据集的精度要比Pytorch略高。",{"type":18,"tag":26,"props":197,"children":198},{},[199],{"type":18,"tag":30,"props":200,"children":202},{"alt":7,"src":201},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/d19802116abb4ae282740a71adb5cd14.png",[],{"type":18,"tag":26,"props":204,"children":205},{},[206],{"type":18,"tag":30,"props":207,"children":209},{"alt":7,"src":208},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/7f5a8d245bb045c88bcba6749dcb4287.png",[],{"type":18,"tag":26,"props":211,"children":212},{},[213],{"type":18,"tag":52,"props":214,"children":215},{},[216],{"type":24,"value":217},"accuracy_on_dataset_chart_v1",{"type":18,"tag":26,"props":219,"children":220},{},[221],{"type":24,"value":222},"函数accuracy_on_dataset_chart_v1主要用于绘制在不同预训练数据集上模型精度的区间范围。",{"type":18,"tag":26,"props":224,"children":225},{},[226],{"type":18,"tag":52,"props":227,"children":228},{},[229],{"type":24,"value":99},{"type":18,"tag":26,"props":231,"children":232},{},[233],{"type":24,"value":234},"【accuracy_data】用于绘制折线图的模型数据，其中数据包括不同预训练数据集的模型精度和marker的大小。",{"type":18,"tag":26,"props":236,"children":237},{},[238],{"type":24,"value":239},"【save_path】图表的保存路径。",{"type":18,"tag":26,"props":241,"children":242},{},[243],{"type":24,"value":244},"【ylim】图表y坐标的刻度范围。",{"type":18,"tag":26,"props":246,"children":247},{},[248],{"type":24,"value":249},"【figsize】图表的尺寸。",{"type":18,"tag":26,"props":251,"children":252},{},[253],{"type":24,"value":254},"【title】图表的标题。",{"type":18,"tag":26,"props":256,"children":257},{},[258],{"type":24,"value":259},"【xlabel】图表x坐标的标签。",{"type":18,"tag":26,"props":261,"children":262},{},[263],{"type":24,"value":264},"【ylabel】图表y坐标的标签。",{"type":18,"tag":26,"props":266,"children":267},{},[268],{"type":18,"tag":52,"props":269,"children":270},{},[271],{"type":24,"value":185},{"type":18,"tag":26,"props":273,"children":274},{},[275],{"type":24,"value":276},"以下样例绘制了Resnet系列模型分别在ImageNet、ImageNet21K、JFT-300M预训练数据集训练，然后在ImageNet数据集上进行finetune后的Top1精度的区间范围。",{"type":18,"tag":26,"props":278,"children":279},{},[280],{"type":18,"tag":30,"props":281,"children":283},{"alt":7,"src":282},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/5ff9b8b6055c46d8825239bfb7496814.png",[],{"type":18,"tag":26,"props":285,"children":286},{},[287],{"type":18,"tag":30,"props":288,"children":290},{"alt":7,"src":289},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/a5071df3336f42a4a337f8b4b834683d.png",[],{"type":18,"tag":26,"props":292,"children":293},{},[294],{"type":18,"tag":52,"props":295,"children":296},{},[297],{"type":24,"value":298},"accuracy_on_dataset_chart_v2",{"type":18,"tag":26,"props":300,"children":301},{},[302],{"type":24,"value":303},"函数accuracy_on_dataset_chart_v2主要用于绘制在不同预训练数据集上模型精度的对比。",{"type":18,"tag":26,"props":305,"children":306},{},[307],{"type":18,"tag":52,"props":308,"children":309},{},[310],{"type":24,"value":99},{"type":18,"tag":26,"props":312,"children":313},{},[314],{"type":24,"value":315},"【accuracy_data】用于绘制点状图的模型数据，其中数据包括不同预训练数据集的模型精度和marker的大小。",{"type":18,"tag":26,"props":317,"children":318},{},[319],{"type":24,"value":239},{"type":18,"tag":26,"props":321,"children":322},{},[323],{"type":24,"value":244},{"type":18,"tag":26,"props":325,"children":326},{},[327],{"type":24,"value":249},{"type":18,"tag":26,"props":329,"children":330},{},[331],{"type":24,"value":254},{"type":18,"tag":26,"props":333,"children":334},{},[335],{"type":24,"value":259},{"type":18,"tag":26,"props":337,"children":338},{},[339],{"type":24,"value":264},{"type":18,"tag":26,"props":341,"children":342},{},[343],{"type":18,"tag":52,"props":344,"children":345},{},[346],{"type":24,"value":185},{"type":18,"tag":26,"props":348,"children":349},{},[350],{"type":24,"value":351},"以下样例绘制了ViT系列模型分别在ImageNet、ImageNet21K、JFT-300M预训练数据集训练，然后在ImageNet数据集上进行finetune后的Top1精度对比。",{"type":18,"tag":353,"props":354,"children":356},"pre",{"code":355},"accuracy_data = {\n    'ViT-B_16': {\n        'accuracy': {\n            'ImageNet': 77.91,\n            'ImageNet21K': 80.99,\n            'JFT-300M': 84.15,\n        },\n        'marker_size': 100\n    },\n    'ViT-B_32': {\n        'accuracy': {\n            'ImageNet': 73.38,\n            'ImageNet21K': 81.28,\n            'JFT-300M': 80.73,\n        },\n        'marker_size': 50\n    },\n    'ViT-L_16': {\n        'accuracy': {\n            'ImageNet': 76.53,\n            'ImageNet21K': 85.15,\n            'JFT-300M': 87.12,\n        },\n        'marker_size': 200\n    },\n    'ViT-L_32': {\n        'accuracy': {\n            'ImageNet': 71.16,\n            'ImageNet21K': 83.97,\n            'JFT-300M': 84.37,\n        },\n        'marker_size': 150\n    },\n\n    'ViT-H_14': {\n        'accuracy': {\n            'JFT-300M': 88.12,\n        },\n        'marker_size': 250\n    }\n}\n\naccuracy_on_dataset_chart_v2(accuracy_data=accuracy_data,\n                             ylim=[69.5, 90],\n                             figsize=(8, 6),\n                             xlabel='Pre-training dataset',\n                             ylabel='ImageNet Top1 Accuracy[%]')\n",[357],{"type":18,"tag":358,"props":359,"children":360},"code",{"__ignoreMap":7},[361],{"type":24,"value":355},{"type":18,"tag":26,"props":363,"children":364},{},[365],{"type":18,"tag":30,"props":366,"children":368},{"alt":7,"src":367},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/2242e67105e343fe9745c4a4e9673b63.png",[],{"type":18,"tag":26,"props":370,"children":371},{},[372],{"type":18,"tag":52,"props":373,"children":374},{},[375],{"type":24,"value":376},"accuracy_on_dataset_chart_v3",{"type":18,"tag":26,"props":378,"children":379},{},[380],{"type":24,"value":381},"函数accuracy_on_dataset_chart_v3主要用于绘制在不同预训练数据集上不同模型架构之间的精度对比。",{"type":18,"tag":26,"props":383,"children":384},{},[385],{"type":18,"tag":52,"props":386,"children":387},{},[388],{"type":24,"value":99},{"type":18,"tag":26,"props":390,"children":391},{},[392],{"type":24,"value":393},"【line_models_data】用于绘制折线图的模型数据，其中数据包括不同预训练数据集的模型精度和marker的大小。",{"type":18,"tag":26,"props":395,"children":396},{},[397],{"type":24,"value":398},"【scatter_models_data】用于绘制点状图的模型数据，其中数据包括不同预训练数据集的模型精度和marker的大小。",{"type":18,"tag":26,"props":400,"children":401},{},[402],{"type":24,"value":239},{"type":18,"tag":26,"props":404,"children":405},{},[406],{"type":24,"value":244},{"type":18,"tag":26,"props":408,"children":409},{},[410],{"type":24,"value":249},{"type":18,"tag":26,"props":412,"children":413},{},[414],{"type":24,"value":254},{"type":18,"tag":26,"props":416,"children":417},{},[418],{"type":24,"value":259},{"type":18,"tag":26,"props":420,"children":421},{},[422],{"type":24,"value":264},{"type":18,"tag":26,"props":424,"children":425},{},[426],{"type":18,"tag":52,"props":427,"children":428},{},[429],{"type":24,"value":185},{"type":18,"tag":26,"props":431,"children":432},{},[433],{"type":24,"value":434},"以下样例绘制了Resnet系列模型和ViT系列模型分别在ImageNet、ImageNet21K、JFT-300M预训练数据集训练，然后在ImageNet数据集上进行finetune后的Top1精度对比。结论如下：",{"type":18,"tag":26,"props":436,"children":437},{},[438],{"type":24,"value":439},"1、其中图表的阴影部分代表了ResNet50和Resnet152的精度范围。",{"type":18,"tag":26,"props":441,"children":442},{},[443],{"type":24,"value":444},"2、ViT系列的模型在中小型数据集预训练的效果不好，精度全面不如ResNet系列的模型。",{"type":18,"tag":26,"props":446,"children":447},{},[448],{"type":24,"value":449},"3、随着预训练数据集的增大，ViT系列的模型精度表现越来越好。",{"type":18,"tag":353,"props":451,"children":453},{"code":452},"line_models_data = {\n    'ResNet50': {\n        'accuracy': {\n            'ImageNet': 76.8,\n            'ImageNet21K': 80.2,\n            'JFT-300M': 79.2,\n        },\n        'marker_size': 4\n    },\n    'ResNet152': {\n        'accuracy': {\n            'ImageNet': 81.2,\n            'ImageNet21K': 85.5,\n            'JFT-300M': 87.8,\n        },\n        'marker_size': 6\n    }\n}\n\nscatter_models_data = {\n    'ViT-B_16': {\n        'accuracy': {\n            'ImageNet': 77.91,\n            'ImageNet21K': 80.99,\n            'JFT-300M': 84.15,\n        },\n        'marker_size': 100\n    },\n    'ViT-B_32': {\n        'accuracy': {\n            'ImageNet': 73.38,\n            'ImageNet21K': 81.28,\n            'JFT-300M': 80.73,\n        },\n        'marker_size': 50\n    },\n    'ViT-L_16': {\n        'accuracy': {\n            'ImageNet': 76.53,\n            'ImageNet21K': 85.15,\n            'JFT-300M': 87.12,\n        },\n        'marker_size': 200\n    },\n    'ViT-L_32': {\n        'accuracy': {\n            'ImageNet': 71.16,\n            'ImageNet21K': 83.97,\n            'JFT-300M': 84.37,\n        },\n        'marker_size': 150\n    },\n\n    'ViT-H_14': {\n        'accuracy': {\n            'JFT-300M': 88.12,\n        },\n        'marker_size': 250\n    }\n}\n\naccuracy_on_dataset_chart_v3(line_models_data=line_models_data,\n                             scatter_models_data=scatter_models_data,\n                             ylim=[69.5, 90],\n                             figsize=(8, 6),\n                             xlabel='Pre-training dataset',\n                             ylabel='ImageNet Top1 Accuracy[%]')\n",[454],{"type":18,"tag":358,"props":455,"children":456},{"__ignoreMap":7},[457],{"type":24,"value":452},{"type":18,"tag":26,"props":459,"children":460},{},[461],{"type":18,"tag":30,"props":462,"children":464},{"alt":7,"src":463},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/b26d6790e81b4214b07910f4179b0c35.png",[],{"type":18,"tag":26,"props":466,"children":467},{},[468],{"type":18,"tag":52,"props":469,"children":470},{},[471],{"type":24,"value":472},"accuracy_model_size_chart",{"type":18,"tag":26,"props":474,"children":475},{},[476],{"type":24,"value":477},"函数accuracy_model_size_chart主要用于绘制在不同大小的预训练数据集上模型之间的精度对比。",{"type":18,"tag":26,"props":479,"children":480},{},[481],{"type":18,"tag":52,"props":482,"children":483},{},[484],{"type":24,"value":99},{"type":18,"tag":26,"props":486,"children":487},{},[488],{"type":24,"value":489},"【accuracy_data】用于绘制折线图的模型数据，其中数据包括不同大小的预训练数据集的精度。",{"type":18,"tag":26,"props":491,"children":492},{},[493],{"type":24,"value":494},"【size_unit】数据集大小的单位。",{"type":18,"tag":26,"props":496,"children":497},{},[498],{"type":24,"value":239},{"type":18,"tag":26,"props":500,"children":501},{},[502],{"type":24,"value":244},{"type":18,"tag":26,"props":504,"children":505},{},[506],{"type":24,"value":249},{"type":18,"tag":26,"props":508,"children":509},{},[510],{"type":24,"value":254},{"type":18,"tag":26,"props":512,"children":513},{},[514],{"type":24,"value":259},{"type":18,"tag":26,"props":516,"children":517},{},[518],{"type":24,"value":264},{"type":18,"tag":26,"props":520,"children":521},{},[522],{"type":18,"tag":52,"props":523,"children":524},{},[525],{"type":24,"value":185},{"type":18,"tag":26,"props":527,"children":528},{},[529],{"type":24,"value":530},"以下样例绘制了Resnet系列模型和ViT系列模型分别在10M、30M、100M、300M的JFT-300M预训练数据集训练，将ImageNet数据集1000类中的每一类随机采样5张图片作为验证数据集，然后将不同大小预训练数据集的预训练模型作为特征提取层，在验证数据集上直接进行精度对比。结论如下：",{"type":18,"tag":26,"props":532,"children":533},{},[534],{"type":24,"value":535},"1、在预训练数据集比较少的情况下ViT系列模型的精度不如ResNet系列。",{"type":18,"tag":26,"props":537,"children":538},{},[539],{"type":24,"value":540},"2、随着预训练数据集的增多，ViT系列模型的精度越来越高，效果要比ResNet系列要好。",{"type":18,"tag":353,"props":542,"children":544},{"code":543},"accuracy_data = {\n    'ResNet50': {\n        10: 48,\n        30: 51,\n        100: 52,\n        300: 52.5\n    },\n    'ResNet152': {\n        10: 53,\n        30: 67,\n        100: 68,\n        300: 69\n    },\n    'ViT-B_32': {\n        10: 37,\n        30: 41,\n        100: 41.5,\n        300: 42\n    },\n    'ViT-B_16': {\n        10: 38,\n        30: 53,\n        100: 54,\n        300: 55\n    },\n    'ViT-L_32': {\n        10: 36,\n        30: 54,\n        100: 64,\n        300: 65\n    },\n    'ViT-L_16': {\n        10: 42,\n        30: 58,\n        100: 70,\n        300: 72\n    }\n}\n\naccuracy_model_size_chart(accuracy_data=accuracy_data,\n                          size_unit='M',\n                          ylim=[28, 74],\n                          figsize=(8, 6),\n                          xlabel='Number of JFT pre-training samples',\n                          ylabel='Linear 5-shot ImageNet Top1 [%]')\n",[545],{"type":18,"tag":358,"props":546,"children":547},{"__ignoreMap":7},[548],{"type":24,"value":543},{"type":18,"tag":26,"props":550,"children":551},{},[552],{"type":18,"tag":30,"props":553,"children":555},{"alt":7,"src":554},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/894c5cd211b443d9805565cd7b78e10d.png",[],{"type":18,"tag":26,"props":557,"children":558},{},[559],{"type":18,"tag":52,"props":560,"children":561},{},[562],{"type":24,"value":563},"accuracy_model_flops_chart",{"type":18,"tag":26,"props":565,"children":566},{},[567],{"type":24,"value":568},"函数accuracy_model_flops_chart主要用于绘制在不同的计算复杂度下，不同架构的模型之间的精度对比。",{"type":18,"tag":26,"props":570,"children":571},{},[572],{"type":18,"tag":52,"props":573,"children":574},{},[575],{"type":24,"value":99},{"type":18,"tag":26,"props":577,"children":578},{},[579],{"type":24,"value":580},"【accuracy_data】用于绘制点状图的模型数据，其中数据包括不同架构下的模型，以及模型的计算复杂度和精度。",{"type":18,"tag":26,"props":582,"children":583},{},[584],{"type":24,"value":239},{"type":18,"tag":26,"props":586,"children":587},{},[588],{"type":24,"value":244},{"type":18,"tag":26,"props":590,"children":591},{},[592],{"type":24,"value":249},{"type":18,"tag":26,"props":594,"children":595},{},[596],{"type":24,"value":254},{"type":18,"tag":26,"props":598,"children":599},{},[600],{"type":24,"value":259},{"type":18,"tag":26,"props":602,"children":603},{},[604],{"type":24,"value":264},{"type":18,"tag":26,"props":606,"children":607},{},[608],{"type":18,"tag":52,"props":609,"children":610},{},[611],{"type":24,"value":185},{"type":18,"tag":26,"props":613,"children":614},{},[615],{"type":24,"value":616},"以下样例绘制了Transform、ResNet、Hybrid三种不同网络架构下的模型，在不同计算复杂度下的精度对比。其中所有的模型精度都是在JFT-300M预训练数据集进行预训练，然后在ImageNet数据集进行finetune后的Top1精度。结论如下：",{"type":18,"tag":26,"props":618,"children":619},{},[620],{"type":24,"value":621},"1、在同等的计算复杂度下，Transformer架构的模型精度要比ResNet架构的模型精度高，所以ViT系列的模型比较便宜。",{"type":18,"tag":26,"props":623,"children":624},{},[625],{"type":24,"value":626},"2、在模型比较小的情况下，Hybrid架构的模型精度最高，但是随着模型越来越大，精度就和Transformer架构的模型差不多，甚至不如它。",{"type":18,"tag":26,"props":628,"children":629},{},[630],{"type":24,"value":631},"3、Transformer架构的模型扩展性比较强，随着模型越来越大，精度没有呈现饱和的趋势。",{"type":18,"tag":353,"props":633,"children":635},{"code":634},"accuracy_data = {\n    'Transform(ViT)': {\n        \"vit-B_32_7\": {55: 80.73},\n        \"ViT-B_16_7\": {224: 84.15},\n        \"ViT-L_32_7\": {196: 84.37},\n        \"ViT-L_16_7\": {783: 86.30},\n        \"ViT-L_16_14\": {1567: 87.12},\n        \"ViT-H_14_14\": {4262: 88.08}\n    },\n    'ResNet(BiT)': {\n        \"ResNet50x1_7\": {50: 77.54},\n        \"ResNet50x2_7\": {199: 82.12},\n        \"ResNet101x1_7\": {96: 80.67},\n        \"ResNet152x1_7\": {141: 81.88},\n        \"ResNet152x2_7\": {563: 84.97},\n        \"ResNet152x2_14\": {1126: 85.56},\n        \"ResNet200x3_14\": {3306: 87.22}\n    },\n    'Hybrid': {\n        \"R50x1+Vit-B_32_7\": {106: 84.90},\n        \"R50x1+Vit-B_16_7\": {274: 85.58},\n        \"R50x1+Vit-L_32_7\": {246: 85.68},\n        \"R50x1+Vit-L_16_7\": {859: 86.60},\n        \"R50x1+Vit-L_16_14\": {1668: 87.12}\n    }\n}\n\naccuracy_model_flops_chart(accuracy_data=accuracy_data,\n                           ylim=[75, 90],\n                           figsize=(8, 6),\n                           title='ImageNet',\n                           xlabel='Total pre-training compute [exaFLOPs]',\n                           ylabel='Transfer accuracy [%]')\n",[636],{"type":18,"tag":358,"props":637,"children":638},{"__ignoreMap":7},[639],{"type":24,"value":634},{"type":18,"tag":26,"props":641,"children":642},{},[643],{"type":18,"tag":30,"props":644,"children":646},{"alt":7,"src":645},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/64fe63b7c72747cd89450e8ee39c8a8f.png",[],{"type":18,"tag":26,"props":648,"children":649},{},[650],{"type":18,"tag":52,"props":651,"children":652},{},[653],{"type":24,"value":654},"pos_embedding_cosine_chart",{"type":18,"tag":26,"props":656,"children":657},{},[658],{"type":24,"value":659},"函数pos_embedding_cosine_chart主要用于绘制图像patches之后的位置编码之间的余弦相似度。",{"type":18,"tag":26,"props":661,"children":662},{},[663],{"type":18,"tag":52,"props":664,"children":665},{},[666],{"type":24,"value":99},{"type":18,"tag":26,"props":668,"children":669},{},[670],{"type":24,"value":671},"【pos_embedding】位置编码。",{"type":18,"tag":26,"props":673,"children":674},{},[675],{"type":24,"value":239},{"type":18,"tag":26,"props":677,"children":678},{},[679],{"type":24,"value":254},{"type":18,"tag":26,"props":681,"children":682},{},[683],{"type":24,"value":259},{"type":18,"tag":26,"props":685,"children":686},{},[687],{"type":24,"value":264},{"type":18,"tag":26,"props":689,"children":690},{},[691],{"type":24,"value":692},"【colorbar_label】图表彩条的标签。",{"type":18,"tag":26,"props":694,"children":695},{},[696],{"type":18,"tag":52,"props":697,"children":698},{},[699],{"type":24,"value":185},{"type":18,"tag":26,"props":701,"children":702},{},[703],{"type":24,"value":704},"以下样例绘制了ViT-B_32模型预训练好的位置编码之间的余弦相似度。下载好的位置编码的维度为(1, 50, 768)，该函数会先将数据维度进行压缩，然后去除掉最开始用来分类token的位置编码，只保留图像patches之后的位置编码，然后进行图像绘制。结论如下：",{"type":18,"tag":26,"props":706,"children":707},{},[708],{"type":24,"value":709},"每一个位置编码都和自己的同一行或者同一列有较高的余弦相似度，说明图像的同一行或者同一列具有较强的位置关系。",{"type":18,"tag":353,"props":711,"children":713},{"code":712},"pos_embedding = np.load('./data/pos_embedding.npy')\npos_embedding_cosine_chart(pos_embedding=pos_embedding,\n                           title='Position embedding similarity',\n                           xlabel='Input patch column',\n                           ylabel='Input patch row',\n                           colorbar_label='Cosine similarity')\n",[714],{"type":18,"tag":358,"props":715,"children":716},{"__ignoreMap":7},[717],{"type":24,"value":712},{"type":18,"tag":26,"props":719,"children":720},{},[721],{"type":18,"tag":30,"props":722,"children":724},{"alt":7,"src":723},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/699f69027c6f4003a009f14c8f1d523e.png",[],{"type":18,"tag":26,"props":726,"children":727},{},[728],{"type":18,"tag":30,"props":729,"children":731},{"alt":7,"src":730},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/05/13/2e39646cf2a445b1bd59001f0ebbdfbf.jpg",[],{"type":18,"tag":26,"props":733,"children":734},{},[735],{"type":18,"tag":52,"props":736,"children":737},{},[738],{"type":24,"value":739},"MindSpore官方资料",{"type":18,"tag":26,"props":741,"children":742},{},[743,748],{"type":18,"tag":52,"props":744,"children":745},{},[746],{"type":24,"value":747},"官方QQ群",{"type":24,"value":749},": 486831414",{"type":18,"tag":26,"props":751,"children":752},{},[753,758,760],{"type":18,"tag":52,"props":754,"children":755},{},[756],{"type":24,"value":757},"官网",{"type":24,"value":759},": ",{"type":18,"tag":63,"props":761,"children":764},{"href":762,"rel":763},"https://www.mindspore.cn/",[67],[765],{"type":24,"value":762},{"type":18,"tag":26,"props":767,"children":768},{},[769,774],{"type":18,"tag":52,"props":770,"children":771},{},[772],{"type":24,"value":773},"Gitee",{"type":24,"value":775},": https : //gitee.com/mindspore/mindspore",{"type":18,"tag":26,"props":777,"children":778},{},[779,784,785],{"type":18,"tag":52,"props":780,"children":781},{},[782],{"type":24,"value":783},"GitHub",{"type":24,"value":759},{"type":18,"tag":63,"props":786,"children":789},{"href":787,"rel":788},"https://github.com/mindspore-ai/mindspore",[67],[790],{"type":24,"value":787},{"type":18,"tag":26,"props":792,"children":793},{},[794,799,800],{"type":18,"tag":52,"props":795,"children":796},{},[797],{"type":24,"value":798},"官方论坛",{"type":24,"value":759},{"type":18,"tag":63,"props":801,"children":804},{"href":802,"rel":803},"https://bbs.huaweicloud.com/forum/forum-1076-1.html",[67],[805],{"type":24,"value":802},{"title":7,"searchDepth":807,"depth":807,"links":808},4,[],"markdown","content:technology-blogs:zh:1474.md","content","technology-blogs/zh/1474.md","technology-blogs/zh/1474","md",1776506112749]