[{"data":1,"prerenderedAt":1342},["ShallowReactive",2],{"content-query-Oano82kSJK":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":1336,"_id":1337,"_source":1338,"_file":1339,"_stem":1340,"_extension":1341},"/technology-blogs/zh/961","zh",false,"","昇思MindSpore入门--跑通DeepLabV3模型","基于GPU服务器安装MindSpore 1.5.0搭建基础开发环境","2022-01-25","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/01/29/7cc6698dfbaa4cf3b8d79a32d965b442.png","technology-blogs","开发者分享",{"type":15,"children":16,"toc":1313},"root",[17,25,34,52,60,65,79,96,106,111,119,128,136,144,153,158,245,250,258,268,276,284,292,297,305,313,321,329,337,341,349,357,361,369,379,387,391,399,408,413,421,426,434,438,446,451,459,464,472,480,489,497,506,511,520,528,537,542,547,555,560,568,573,581,586,594,602,607,625,632,637,642,650,655,660,668,673,681,685,693,698,706,711,719,724,731,736,745,749,767,771,779,787,791,807,811,819,827,836,841,849,854,863,867,875,880,889,893,901,906,911,916,925,929,937,941,946,950,958,963,968,993,998,1003,1008,1016,1021,1026,1034,1039,1044,1052,1057,1065,1070,1075,1080,1088,1092,1100,1105,1113,1118,1126,1134,1139,1147,1155,1160,1168,1173,1184,1192,1210,1237,1244,1252,1260,1266,1273,1276,1286,1295,1304],{"type":18,"tag":19,"props":20,"children":22},"element","h1",{"id":21},"昇思mindspore入门-跑通deeplabv3模型",[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/01/29/6a6f579d7d7f41b792b161b5e3e79a63.gif",[],{"type":18,"tag":26,"props":35,"children":36},{},[37,39,45,47],{"type":24,"value":38},"作者：",{"type":18,"tag":40,"props":41,"children":42},"strong",{},[43],{"type":24,"value":44},"kaierlong",{"type":24,"value":46}," ｜",{"type":18,"tag":40,"props":48,"children":49},{},[50],{"type":24,"value":51},"来源：开源博客",{"type":18,"tag":26,"props":53,"children":54},{},[55],{"type":18,"tag":40,"props":56,"children":57},{},[58],{"type":24,"value":59},"1、环境准备",{"type":18,"tag":26,"props":61,"children":62},{},[63],{"type":24,"value":64},"注意事项：",{"type":18,"tag":26,"props":66,"children":67},{},[68,70],{"type":24,"value":69},"先按照基于GPU服务器安装MindSpore 1.5.0（_",{"type":18,"tag":71,"props":72,"children":76},"a",{"href":73,"rel":74},"https://my.oschina.net/kaierlong/blog/5375003_%EF%BC%89%E6%90%AD%E5%BB%BA%E5%9F%BA%E7%A1%80%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83",[75],"nofollow",[77],{"type":24,"value":78},"https://my.oschina.net/kaierlong/blog/5375003_）搭建基础开发环境",{"type":18,"tag":80,"props":81,"children":83},"h3",{"id":82},"_11-克隆仓库并进入到本地-deeplabv3-目录",[84,89,91],{"type":18,"tag":40,"props":85,"children":86},{},[87],{"type":24,"value":88},"1.1 克隆仓库并进入到本地",{"type":24,"value":90}," deeplabv3 ",{"type":18,"tag":40,"props":92,"children":93},{},[94],{"type":24,"value":95},"目录",{"type":18,"tag":97,"props":98,"children":100},"pre",{"code":99},"git clone https://gitee.com/mindspore/models.git mindspore_models\ncd mindspore_models/official/cv/deeplabv3\n",[101],{"type":18,"tag":102,"props":103,"children":104},"code",{"__ignoreMap":7},[105],{"type":24,"value":99},{"type":18,"tag":26,"props":107,"children":108},{},[109],{"type":24,"value":110},"可以使用 tree 查看 deeplabv3 目录结构，目录结构如下所示。",{"type":18,"tag":97,"props":112,"children":114},{"code":113},".\n├── ascend310_infer\n│   ├── build.sh\n│   ├── CMakeLists.txt\n│   ├── fusion_switch.cfg\n│   ├── inc\n│   │   └── utils.h\n│   └── src\n│       ├── main.cc\n│       └── utils.cc\n├── ascend310_quant_infer\n│   ├── acc.py\n│   ├── config.cfg\n│   ├── export_bin.py\n│   ├── fusion_switch.cfg\n│   ├── inc\n│   │   ├── model_process.h\n│   │   ├── sample_process.h\n│   │   └── utils.h\n│   ├── post_quant.py\n│   ├── run_quant_infer.sh\n│   └── src\n│       ├── acl.json\n│       ├── build.sh\n│       ├── CMakeLists.txt\n│       ├── main.cpp\n│       ├── model_process.cpp\n│       ├── sample_process.cpp\n│       └── utils.cpp\n├── default_config.yaml\n├── Dockerfile\n├── eval.py\n├── export.py\n├── mindspore_hub_conf.py\n├── model_utils\n│   ├── config.py\n│   ├── device_adapter.py\n│   ├── __init__.py\n│   ├── local_adapter.py\n│   └── moxing_adapter.py\n├── postprocess.py\n├── README_CN.md\n├── README.md\n├── requirements.txt\n├── scripts\n│   ├── build_data.sh\n│   ├── docker_start.sh\n│   ├── run_distribute_train_s16_r1.sh\n│   ├── run_distribute_train_s8_r1.sh\n│   ├── run_distribute_train_s8_r2.sh\n│   ├── run_eval_s16.sh\n│   ├── run_eval_s8_multiscale_flip.sh\n│   ├── run_eval_s8_multiscale.sh\n│   ├── run_eval_s8.sh\n│   ├── run_infer_310.sh\n│   ├── run_standalone_train_cpu.sh\n│   └── run_standalone_train.sh\n├── src\n│   ├── data\n│   │   ├── build_seg_data.py\n│   │   ├── dataset.py\n│   │   ├── get_dataset_lst.py\n│   │   └── __init__.py\n│   ├── __init__.py\n│   ├── loss\n│   │   ├── __init__.py\n│   │   └── loss.py\n│   ├── nets\n│   │   ├── deeplab_v3\n│   │   │   ├── deeplab_v3.py\n│   │   │   └── __init__.py\n│   │   ├── __init__.py\n│   │   └── net_factory.py\n│   ├── tools\n│   │   ├── get_multicards_json.py\n│   │   └── __init__.py\n│   └── utils\n│       ├── __init__.py\n│       └── learning_rates.py\n└── train.py\n\n15 directories, 64 files\n",[115],{"type":18,"tag":102,"props":116,"children":117},{"__ignoreMap":7},[118],{"type":24,"value":113},{"type":18,"tag":80,"props":120,"children":122},{"id":121},"_12-准备开发环境",[123],{"type":18,"tag":40,"props":124,"children":125},{},[126],{"type":24,"value":127},"1.2 准备开发环境",{"type":18,"tag":97,"props":129,"children":131},{"code":130},"pip3 install -r requirements.txt\n",[132],{"type":18,"tag":102,"props":133,"children":134},{"__ignoreMap":7},[135],{"type":24,"value":130},{"type":18,"tag":26,"props":137,"children":138},{},[139],{"type":18,"tag":40,"props":140,"children":141},{},[142],{"type":24,"value":143},"2、数据准备",{"type":18,"tag":80,"props":145,"children":147},{"id":146},"_21-下载数据集",[148],{"type":18,"tag":40,"props":149,"children":150},{},[151],{"type":24,"value":152},"2.1 下载数据集",{"type":18,"tag":26,"props":154,"children":155},{},[156],{"type":24,"value":157},"数据集下载地址",{"type":18,"tag":159,"props":160,"children":161},"ul",{},[162,168,187,205,210,227],{"type":18,"tag":163,"props":164,"children":165},"li",{},[166],{"type":24,"value":167},"Pascal VOC数据集",{"type":18,"tag":163,"props":169,"children":170},{},[171,173,177],{"type":24,"value":172},"主页地址：",{"type":18,"tag":174,"props":175,"children":176},"br",{},[],{"type":18,"tag":178,"props":179,"children":180},"em",{},[181],{"type":18,"tag":71,"props":182,"children":185},{"href":183,"rel":184},"http://host.robots.ox.ac.uk/pascal/VOC/voc2012/index.html",[75],[186],{"type":24,"value":183},{"type":18,"tag":163,"props":188,"children":189},{},[190,192,195],{"type":24,"value":191},"下载地址：",{"type":18,"tag":174,"props":193,"children":194},{},[],{"type":18,"tag":178,"props":196,"children":197},{},[198],{"type":18,"tag":71,"props":199,"children":202},{"href":200,"rel":201},"http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval%5C_11-May-2012.tar",[75],[203],{"type":24,"value":204},"http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval\\_11-May-2012.tar",{"type":18,"tag":163,"props":206,"children":207},{},[208],{"type":24,"value":209},"语义边界数据集",{"type":18,"tag":163,"props":211,"children":212},{},[213,215,218],{"type":24,"value":214},"主页地址 ：",{"type":18,"tag":174,"props":216,"children":217},{},[],{"type":18,"tag":178,"props":219,"children":220},{},[221],{"type":18,"tag":71,"props":222,"children":225},{"href":223,"rel":224},"http://home.bharathh.info/pubs/codes/SBD/download.html",[75],[226],{"type":24,"value":223},{"type":18,"tag":163,"props":228,"children":229},{},[230,232,235],{"type":24,"value":231},"下载地址 ：",{"type":18,"tag":174,"props":233,"children":234},{},[],{"type":18,"tag":178,"props":236,"children":237},{},[238],{"type":18,"tag":71,"props":239,"children":242},{"href":240,"rel":241},"http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/semantic%5C_contours/benchmark.tgz",[75],[243],{"type":24,"value":244},"http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/semantic\\_contours/benchmark.tgz",{"type":18,"tag":26,"props":246,"children":247},{},[248],{"type":24,"value":249},"注意事项",{"type":18,"tag":159,"props":251,"children":252},{},[253],{"type":18,"tag":163,"props":254,"children":255},{},[256],{"type":24,"value":257},"如果使用wget下载速度慢，可以使用迅雷等下载工具下载完成后再上传到服务器。",{"type":18,"tag":259,"props":260,"children":262},"h4",{"id":261},"_211-创建原始数据保存目录并下载数据集",[263],{"type":18,"tag":40,"props":264,"children":265},{},[266],{"type":24,"value":267},"2.1.1 创建原始数据保存目录，并下载数据集",{"type":18,"tag":97,"props":269,"children":271},{"code":270},"mkdir raw_data && cd raw_data\nwget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar\nwget http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/semantic_contours/benchmark.tgz\n",[272],{"type":18,"tag":102,"props":273,"children":274},{"__ignoreMap":7},[275],{"type":24,"value":270},{"type":18,"tag":26,"props":277,"children":278},{},[279],{"type":18,"tag":40,"props":280,"children":281},{},[282],{"type":24,"value":283},"2.1.2 检测数据集MD5（可跳过）",{"type":18,"tag":97,"props":285,"children":287},{"code":286},"md5sum benchmark.tgz VOCtrainval_11-May-2012.tar\n",[288],{"type":18,"tag":102,"props":289,"children":290},{"__ignoreMap":7},[291],{"type":24,"value":286},{"type":18,"tag":26,"props":293,"children":294},{},[295],{"type":24,"value":296},"会输出如下内容",{"type":18,"tag":97,"props":298,"children":300},{"code":299},"82b4d87ceb2ed10f6038a1cba92111cb  benchmark.tgz\n6cd6e144f989b92b3379bac3b3de84fd  VOCtrainval_11-May-2012.tar\n",[301],{"type":18,"tag":102,"props":302,"children":303},{"__ignoreMap":7},[304],{"type":24,"value":299},{"type":18,"tag":26,"props":306,"children":307},{},[308],{"type":18,"tag":40,"props":309,"children":310},{},[311],{"type":24,"value":312},"2.1.3 解压数据集",{"type":18,"tag":97,"props":314,"children":316},{"code":315},"tar zxvf benchmark.tgz\ntar xvf VOCtrainval_11-May-2012.tar\n",[317],{"type":18,"tag":102,"props":318,"children":319},{"__ignoreMap":7},[320],{"type":24,"value":315},{"type":18,"tag":26,"props":322,"children":323},{},[324],{"type":18,"tag":40,"props":325,"children":326},{},[327],{"type":24,"value":328},"2.1.4 查看数据集目录结构",{"type":18,"tag":97,"props":330,"children":332},{"code":331},"tree -d benchmark_RELEASE/\n",[333],{"type":18,"tag":102,"props":334,"children":335},{"__ignoreMap":7},[336],{"type":24,"value":331},{"type":18,"tag":26,"props":338,"children":339},{},[340],{"type":24,"value":296},{"type":18,"tag":97,"props":342,"children":344},{"code":343},"benchmark_RELEASE/\n├── benchmark_code_RELEASE\n│   ├── cp_src\n│   └── demo\n│       ├── datadir\n│       │   ├── cls\n│       │   ├── img\n│       │   └── inst\n│       ├── indir\n│       └── outdir\n└── dataset\n    ├── cls\n    ├── img\n    └── inst\n",[345],{"type":18,"tag":102,"props":346,"children":347},{"__ignoreMap":7},[348],{"type":24,"value":343},{"type":18,"tag":97,"props":350,"children":352},{"code":351},"tree -d VOCdevkit\n",[353],{"type":18,"tag":102,"props":354,"children":355},{"__ignoreMap":7},[356],{"type":24,"value":351},{"type":18,"tag":26,"props":358,"children":359},{},[360],{"type":24,"value":296},{"type":18,"tag":97,"props":362,"children":364},{"code":363},"VOCdevkit\n└── VOC2012\n    ├── Annotations\n    ├── ImageSets\n    │   ├── Action\n    │   ├── Layout\n    │   ├── Main\n    │   └── Segmentation\n    ├── JPEGImages\n    ├── SegmentationClass\n    └── SegmentationObject\n",[365],{"type":18,"tag":102,"props":366,"children":367},{"__ignoreMap":7},[368],{"type":24,"value":363},{"type":18,"tag":26,"props":370,"children":371},{},[372,377],{"type":18,"tag":40,"props":373,"children":374},{},[375],{"type":24,"value":376},"2.1.5 生成数据清单文件",{"type":24,"value":378}," raw_data下生成三个新文件voc_train_lst.txt，voc_val_lst.txt，vocaug_train_lst.txt",{"type":18,"tag":97,"props":380,"children":382},{"code":381},"cd ..\npython3 src/data/get_dataset_lst.py --data_dir ./raw_data\n",[383],{"type":18,"tag":102,"props":384,"children":385},{"__ignoreMap":7},[386],{"type":24,"value":381},{"type":18,"tag":26,"props":388,"children":389},{},[390],{"type":24,"value":296},{"type":18,"tag":97,"props":392,"children":394},{"code":393},"Data dir is: ./raw_data\nconverting voc color png to gray png ...\nconverting done.\ngenerating voc train list success.\ngenerating voc val list success.\nconverting sbd annotations to png ...\nconverting done\ngenerating voc train aug list success.\n",[395],{"type":18,"tag":102,"props":396,"children":397},{"__ignoreMap":7},[398],{"type":24,"value":393},{"type":18,"tag":259,"props":400,"children":402},{"id":401},"_216-将数据集转换为mindrecords",[403],{"type":18,"tag":40,"props":404,"children":405},{},[406],{"type":24,"value":407},"2.1.6 将数据集转换为MindRecords",{"type":18,"tag":26,"props":409,"children":410},{},[411],{"type":24,"value":412},"创建保存目录",{"type":18,"tag":97,"props":414,"children":416},{"code":415},"mkdir vocaug_mindrecords\nmkdir voctrain_mindrecords\nmkdir vocval_mindrecords\n",[417],{"type":18,"tag":102,"props":418,"children":419},{"__ignoreMap":7},[420],{"type":24,"value":415},{"type":18,"tag":26,"props":422,"children":423},{},[424],{"type":24,"value":425},"转换 vocaug_train 数据",{"type":18,"tag":97,"props":427,"children":429},{"code":428},"# 注意data_root和dst_path\npython3 src/data/build_seg_data.py --data_root ./ --data_lst ./raw_data/vocaug_train_lst.txt --dst_path ./vocaug_mindrecords/mindrecord_ --num_shards 8 --shuffle True\n",[430],{"type":18,"tag":102,"props":431,"children":432},{"__ignoreMap":7},[433],{"type":24,"value":428},{"type":18,"tag":26,"props":435,"children":436},{},[437],{"type":24,"value":296},{"type":18,"tag":97,"props":439,"children":441},{"code":440},"number of samples: 10582\nnumber of samples written: 1000\nnumber of samples written: 2000\nnumber of samples written: 3000\nnumber of samples written: 4000\nnumber of samples written: 5000\nnumber of samples written: 6000\nnumber of samples written: 7000\nnumber of samples written: 8000\nnumber of samples written: 9000\nnumber of samples written: 10000\nnumber of samples written: 10582\n",[442],{"type":18,"tag":102,"props":443,"children":444},{"__ignoreMap":7},[445],{"type":24,"value":440},{"type":18,"tag":26,"props":447,"children":448},{},[449],{"type":24,"value":450},"可以使用 tree vocaug_mindrecords/ ，查看转换后的数据目录，输出如下内容",{"type":18,"tag":97,"props":452,"children":454},{"code":453},"vocaug_mindrecords/\n├── mindrecord_0\n├── mindrecord_0.db\n├── mindrecord_1\n├── mindrecord_1.db\n├── mindrecord_2\n├── mindrecord_2.db\n├── mindrecord_3\n├── mindrecord_3.db\n├── mindrecord_4\n├── mindrecord_4.db\n├── mindrecord_5\n├── mindrecord_5.db\n├── mindrecord_6\n├── mindrecord_6.db\n├── mindrecord_7\n└── mindrecord_7.db\n",[455],{"type":18,"tag":102,"props":456,"children":457},{"__ignoreMap":7},[458],{"type":24,"value":453},{"type":18,"tag":26,"props":460,"children":461},{},[462],{"type":24,"value":463},"依次转换 voc_train 和 voc_val 数据集",{"type":18,"tag":97,"props":465,"children":467},{"code":466},"python3 src/data/build_seg_data.py --data_root ./ --data_lst ./raw_data/voc_train_lst.txt --dst_path ./voctrain_mindrecords/mindrecord_ --num_shards 8 --shuffle True\npython3 src/data/build_seg_data.py --data_root ./ --data_lst ./raw_data/voc_val_lst.txt --dst_path ./vocval_mindrecords/mindrecord_ --num_shards 8 --shuffle True\n",[468],{"type":18,"tag":102,"props":469,"children":470},{"__ignoreMap":7},[471],{"type":24,"value":466},{"type":18,"tag":26,"props":473,"children":474},{},[475],{"type":18,"tag":40,"props":476,"children":477},{},[478],{"type":24,"value":479},"3、模型训练",{"type":18,"tag":80,"props":481,"children":483},{"id":482},"_31-预训练模型下载",[484],{"type":18,"tag":40,"props":485,"children":486},{},[487],{"type":24,"value":488},"3.1 预训练模型下载",{"type":18,"tag":97,"props":490,"children":492},{"code":491},"wget https://download.mindspore.cn/model_zoo/r1.2/resnet101_ascend_v120_imagenet2012_official_cv_bs32_acc78/resnet101_ascend_v120_imagenet2012_official_cv_bs32_acc78.ckpt\n",[493],{"type":18,"tag":102,"props":494,"children":495},{"__ignoreMap":7},[496],{"type":24,"value":491},{"type":18,"tag":80,"props":498,"children":500},{"id":499},"_32-gpu训练支持",[501],{"type":18,"tag":40,"props":502,"children":503},{},[504],{"type":24,"value":505},"3.2 GPU训练支持",{"type":18,"tag":26,"props":507,"children":508},{},[509],{"type":24,"value":510},"deeplabv3目前只支持CPU和Ascend，需要增加GPU支持。虽然笔者使用的机器有4张GPU，为保险起见，仅修改代码支持单机单卡GPU。",{"type":18,"tag":259,"props":512,"children":514},{"id":513},"_321-代码备份",[515],{"type":18,"tag":40,"props":516,"children":517},{},[518],{"type":24,"value":519},"3.2.1 代码备份",{"type":18,"tag":97,"props":521,"children":523},{"code":522},"cp train.py train.py.bak\ncp default_config.yaml default_config.yaml.bak\n",[524],{"type":18,"tag":102,"props":525,"children":526},{"__ignoreMap":7},[527],{"type":24,"value":522},{"type":18,"tag":259,"props":529,"children":531},{"id":530},"_322-代码修改",[532],{"type":18,"tag":40,"props":533,"children":534},{},[535],{"type":24,"value":536},"3.2.2 代码修改",{"type":18,"tag":26,"props":538,"children":539},{},[540],{"type":24,"value":541},"修改原 train.py 文件中109到113行为如下内容：",{"type":18,"tag":26,"props":543,"children":544},{},[545],{"type":24,"value":546},"注意：读者需要根据GPU实际显存，调整max_device_memory参数。",{"type":18,"tag":97,"props":548,"children":550},{"code":549},"    if args.device_target == \"CPU\":\n        context.set_context(mode=context.GRAPH_MODE, save_graphs=False, device_target=\"CPU\")\n    elif args.device_target == \"GPU\":\n        context.set_context(mode=context.GRAPH_MODE, save_graphs=False,\n                            device_target=\"GPU\", device_id=get_device_id(),\n                            max_device_memory=\"16GB\")\n    else:\n        context.set_context(mode=context.GRAPH_MODE, save_graphs=False,\n                            device_target=\"Ascend\", device_id=get_device_id())\n",[551],{"type":18,"tag":102,"props":552,"children":553},{"__ignoreMap":7},[554],{"type":24,"value":549},{"type":18,"tag":26,"props":556,"children":557},{},[558],{"type":24,"value":559},"修改原 train.py 文件中192行为如下内容：",{"type":18,"tag":97,"props":561,"children":563},{"code":562},"    if args.device_target == \"Ascend\":\n        amp_level = \"O3\"\n    else: # CPU GPU\n        amp_level = \"O0\"\n",[564],{"type":18,"tag":102,"props":565,"children":566},{"__ignoreMap":7},[567],{"type":24,"value":562},{"type":18,"tag":26,"props":569,"children":570},{},[571],{"type":24,"value":572},"修改原 train.py 中205行味如下内容：",{"type":18,"tag":97,"props":574,"children":576},{"code":575},"model.train(args.train_epochs, dataset, callbacks=cbs, dataset_sink_mode=(args.device_target == \"Ascend\"))\n",[577],{"type":18,"tag":102,"props":578,"children":579},{"__ignoreMap":7},[580],{"type":24,"value":575},{"type":18,"tag":26,"props":582,"children":583},{},[584],{"type":24,"value":585},"修改原 default_config.yaml 中第11行内容为",{"type":18,"tag":97,"props":587,"children":589},{"code":588},"device_target: \"GPU\" # ['Ascend', 'CPU', 'GPU']\n",[590],{"type":18,"tag":102,"props":591,"children":592},{"__ignoreMap":7},[593],{"type":24,"value":588},{"type":18,"tag":26,"props":595,"children":596},{},[597],{"type":18,"tag":40,"props":598,"children":599},{},[600],{"type":24,"value":601},"3.3 使用VOCaug数据集训练s16，微调ResNet-101预训练模型",{"type":18,"tag":26,"props":603,"children":604},{},[605],{"type":24,"value":606},"注意：",{"type":18,"tag":159,"props":608,"children":609},{},[610,615,620],{"type":18,"tag":163,"props":611,"children":612},{},[613],{"type":24,"value":614},"--data_file",{"type":18,"tag":163,"props":616,"children":617},{},[618],{"type":24,"value":619},"If dataset_file is a str, it represents for a file name of one component of a mindrecord source, other files with identical source in the same path will be found and loaded automatically.",{"type":18,"tag":163,"props":621,"children":622},{},[623],{"type":24,"value":624},"读者需要根据实际显存情况调整batch_size。具体大小可参考如下。",{"type":18,"tag":26,"props":626,"children":627},{},[628],{"type":18,"tag":30,"props":629,"children":631},{"alt":7,"src":630},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/01/29/b1a90506c2c3418caf9f25789d17c5f5.png",[],{"type":18,"tag":26,"props":633,"children":634},{},[635],{"type":24,"value":636},"步骤如下",{"type":18,"tag":26,"props":638,"children":639},{},[640],{"type":24,"value":641},"进入 deeplabv3 项目根目录，创建 ckpt 文件夹用来保存模型参数。",{"type":18,"tag":97,"props":643,"children":645},{"code":644},"mkdir ms_log\nmkdir -p s16_aug_train_1g/ckpt\n",[646],{"type":18,"tag":102,"props":647,"children":648},{"__ignoreMap":7},[649],{"type":24,"value":644},{"type":18,"tag":26,"props":651,"children":652},{},[653],{"type":24,"value":654},"设置指定GPU可见",{"type":18,"tag":26,"props":656,"children":657},{},[658],{"type":24,"value":659},"单卡GPU机器可跳过本步骤",{"type":18,"tag":97,"props":661,"children":663},{"code":662},"export CUDA_VISIBLE_DEVICES=1\n",[664],{"type":18,"tag":102,"props":665,"children":666},{"__ignoreMap":7},[667],{"type":24,"value":662},{"type":18,"tag":26,"props":669,"children":670},{},[671],{"type":24,"value":672},"检测指定GPU是否生效",{"type":18,"tag":97,"props":674,"children":676},{"code":675},"echo $CUDA_VISIBLE_DEVICES\n",[677],{"type":18,"tag":102,"props":678,"children":679},{"__ignoreMap":7},[680],{"type":24,"value":675},{"type":18,"tag":26,"props":682,"children":683},{},[684],{"type":24,"value":296},{"type":18,"tag":97,"props":686,"children":688},{"code":687},"1\n",[689],{"type":18,"tag":102,"props":690,"children":691},{"__ignoreMap":7},[692],{"type":24,"value":687},{"type":18,"tag":26,"props":694,"children":695},{},[696],{"type":24,"value":697},"使用如下命令进行GPU训练",{"type":18,"tag":97,"props":699,"children":701},{"code":700},"nohup python3 train.py --train_dir s16_aug_train_1g/ckpt --data_file ./vocaug_mindrecords/mindrecord_0 --device_target GPU --train_epochs=100 --batch_size=16 --crop_size=513 --base_lr=0.015 --lr_type=cos --min_scale=0.5 --max_scale=2.0 --ignore_label=255 --num_classes=21 --model=deeplab_v3_s16 --ckpt_pre_trained=./resnet101_ascend_v120_imagenet2012_official_cv_bs32_acc78.ckpt --save_steps=1500 --keep_checkpoint_max=20 > ms_log/s16_aug_train_1g.log 2>&1 &\n",[702],{"type":18,"tag":102,"props":703,"children":704},{"__ignoreMap":7},[705],{"type":24,"value":700},{"type":18,"tag":26,"props":707,"children":708},{},[709],{"type":24,"value":710},"训练过程中，可使用如下命令检测GPU使用情况",{"type":18,"tag":97,"props":712,"children":714},{"code":713},"watch -n 0.1 -d nvidia-smi\n",[715],{"type":18,"tag":102,"props":716,"children":717},{"__ignoreMap":7},[718],{"type":24,"value":713},{"type":18,"tag":26,"props":720,"children":721},{},[722],{"type":24,"value":723},"下图为笔者截取了20s左右时间的GPU使用情况。",{"type":18,"tag":26,"props":725,"children":726},{},[727],{"type":18,"tag":30,"props":728,"children":730},{"alt":7,"src":729},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/01/29/e414fd567b4a4c20b98918db275e4458.gif",[],{"type":18,"tag":26,"props":732,"children":733},{},[734],{"type":24,"value":735},"图 GPU使用情况",{"type":18,"tag":80,"props":737,"children":739},{"id":738},"_34-使用vocaug数据集训练s8微调上一步的模型",[740],{"type":18,"tag":40,"props":741,"children":742},{},[743],{"type":24,"value":744},"3.4 使用VOCaug数据集训练s8，微调上一步的模型",{"type":18,"tag":26,"props":746,"children":747},{},[748],{"type":24,"value":606},{"type":18,"tag":159,"props":750,"children":751},{},[752,757],{"type":18,"tag":163,"props":753,"children":754},{},[755],{"type":24,"value":756},"ckpt_pre_trained需要替换为上一步训练的ckpt文件地址",{"type":18,"tag":163,"props":758,"children":759},{},[760,762,765],{"type":24,"value":761},"例如：",{"type":18,"tag":174,"props":763,"children":764},{},[],{"type":24,"value":766},"./s16_aug_train_1g/ckpt/deeplab_v3_s16-7_534.ckpt",{"type":18,"tag":26,"props":768,"children":769},{},[770],{"type":24,"value":636},{"type":18,"tag":97,"props":772,"children":774},{"code":773},"mkdir -p s8_aug_train_1g/ckpt\nnohup python3 train.py --train_dir=s8_aug_train_1g/ckpt --data_file=./vocaug_mindrecords/mindrecord_0 --device_target=GPU --train_epochs=200 --batch_size=8 --crop_size=513 --base_lr=0.02 --lr_type=cos --min_scale=0.5 --max_scale=2.0 --ignore_label=255 --num_classes=21 --model=deeplab_v3_s8 --loss_scale=2048 --ckpt_pre_trained=./s16_aug_train_1g/ckpt/deeplab_v3_s16-200_661.ckpt --save_steps=1000 --keep_checkpoint_max=20 > ms_log/s8_aug_train_1g.log 2>&1 &\n",[775],{"type":18,"tag":102,"props":776,"children":777},{"__ignoreMap":7},[778],{"type":24,"value":773},{"type":18,"tag":26,"props":780,"children":781},{},[782],{"type":18,"tag":40,"props":783,"children":784},{},[785],{"type":24,"value":786},"3.5 使用VOCtrain数据集训练s8，微调上一步的模型",{"type":18,"tag":26,"props":788,"children":789},{},[790],{"type":24,"value":606},{"type":18,"tag":159,"props":792,"children":793},{},[794,798],{"type":18,"tag":163,"props":795,"children":796},{},[797],{"type":24,"value":756},{"type":18,"tag":163,"props":799,"children":800},{},[801,802,805],{"type":24,"value":761},{"type":18,"tag":174,"props":803,"children":804},{},[],{"type":24,"value":806},"./s8_aug_train_1g/ckpt/deeplab_v3_s8-7_534.ckpt",{"type":18,"tag":26,"props":808,"children":809},{},[810],{"type":24,"value":636},{"type":18,"tag":97,"props":812,"children":814},{"code":813},"mkdir -p s8_voc_train_1g/ckpt\nnohup python3 train.py --train_dir=s8_voc_train_1g/ckpt --data_file=./voctrain_mindrecords/mindrecord_0 --device_target GPU --train_epochs=200 --batch_size=8 --crop_size=513 --base_lr=0.008 --lr_type=cos --min_scale=0.5 --max_scale=2.0 --ignore_label=255 --num_classes=21 --model=deeplab_v3_s8 --loss_scale=2048 --ckpt_pre_trained=s8_aug_train_1g/ckpt/deeplab_v3_s8-200_1322.ckpt --save_steps=50 --keep_checkpoint_max=200 > ms_log/s8_voc_train_1g.log 2>&1 &\n",[815],{"type":18,"tag":102,"props":816,"children":817},{"__ignoreMap":7},[818],{"type":24,"value":813},{"type":18,"tag":26,"props":820,"children":821},{},[822],{"type":18,"tag":40,"props":823,"children":824},{},[825],{"type":24,"value":826},"4、模型评估",{"type":18,"tag":80,"props":828,"children":830},{"id":829},"_41-使用voc-val数据集评估s16",[831],{"type":18,"tag":40,"props":832,"children":833},{},[834],{"type":24,"value":835},"4.1 使用voc val数据集评估s16",{"type":18,"tag":26,"props":837,"children":838},{},[839],{"type":24,"value":840},"评估命令如下",{"type":18,"tag":97,"props":842,"children":844},{"code":843},"nohup python3 eval.py --data_root=./ --data_lst=./raw_data/voc_val_lst.txt --batch_size=8 --crop_size=513 --ignore_label=255 --num_classes=21 --model=deeplab_v3_s16 --scales_type=0 --freeze_bn=True --ckpt_path=./s16_aug_train_1g/ckpt/deeplab_v3_s16-200_661.ckpt > ms_log/eval_s16.log 2>&1 &\n",[845],{"type":18,"tag":102,"props":846,"children":847},{"__ignoreMap":7},[848],{"type":24,"value":843},{"type":18,"tag":26,"props":850,"children":851},{},[852],{"type":24,"value":853},"可以使用 tail -n 132 ms_log/eval_s16.log 查看结果",{"type":18,"tag":80,"props":855,"children":857},{"id":856},"_42-使用voc-val数据集评估s8",[858],{"type":18,"tag":40,"props":859,"children":860},{},[861],{"type":24,"value":862},"4.2 使用voc val数据集评估s8",{"type":18,"tag":26,"props":864,"children":865},{},[866],{"type":24,"value":840},{"type":18,"tag":97,"props":868,"children":870},{"code":869},"nohup python3 eval.py --data_root=./ --data_lst=./raw_data/voc_val_lst.txt --batch_size=8 --crop_size=513 --ignore_label=255 --num_classes=21 --model=deeplab_v3_s8 --scales_type=0 --freeze_bn=True --ckpt_path=./s8_voc_train_1g/ckpt/deeplab_v3_s8-200_183.ckpt > ms_log/eval_s8.log 2>&1 &\n",[871],{"type":18,"tag":102,"props":872,"children":873},{"__ignoreMap":7},[874],{"type":24,"value":869},{"type":18,"tag":26,"props":876,"children":877},{},[878],{"type":24,"value":879},"可以使用 tail -n 132 ms_log/eval_s8.log 查看结果",{"type":18,"tag":80,"props":881,"children":883},{"id":882},"_43-使用voc-val数据集评估多尺度s8",[884],{"type":18,"tag":40,"props":885,"children":886},{},[887],{"type":24,"value":888},"4.3 使用voc val数据集评估多尺度s8",{"type":18,"tag":26,"props":890,"children":891},{},[892],{"type":24,"value":840},{"type":18,"tag":97,"props":894,"children":896},{"code":895},"nohup python3 eval.py --data_root=./ --data_lst=./raw_data/voc_val_lst.txt --batch_size=8 --crop_size=513 --ignore_label=255 --num_classes=21 --model=deeplab_v3_s8 --scales_type=1 --freeze_bn=True --ckpt_path=./s8_voc_train_1g/ckpt/deeplab_v3_s8-200_183.ckpt > ms_log/eval_s8_multiscale.log 2>&1 &\n",[897],{"type":18,"tag":102,"props":898,"children":899},{"__ignoreMap":7},[900],{"type":24,"value":895},{"type":18,"tag":26,"props":902,"children":903},{},[904],{"type":24,"value":905},"可以使用",{"type":18,"tag":26,"props":907,"children":908},{},[909],{"type":24,"value":910},"tail -n 132 ms_log/eval_s8_multiscale.log",{"type":18,"tag":26,"props":912,"children":913},{},[914],{"type":24,"value":915},"查看结果",{"type":18,"tag":80,"props":917,"children":919},{"id":918},"_44-使用voc-val数据集评估多尺度和翻转s8",[920],{"type":18,"tag":40,"props":921,"children":922},{},[923],{"type":24,"value":924},"4.4 使用voc val数据集评估多尺度和翻转s8",{"type":18,"tag":26,"props":926,"children":927},{},[928],{"type":24,"value":840},{"type":18,"tag":97,"props":930,"children":932},{"code":931},"nohup python3 eval.py --data_root=./ --data_lst=./raw_data/voc_val_lst.txt --batch_size=8 --crop_size=513 --ignore_label=255 --num_classes=21 --model=deeplab_v3_s8 --scales_type=1 --flip=True --freeze_bn=True --ckpt_path=./s8_voc_train_1g/ckpt/deeplab_v3_s8-200_183.ckpt > ms_log/eval_s8_multiscale_flip.log 2>&1 &\n",[933],{"type":18,"tag":102,"props":934,"children":935},{"__ignoreMap":7},[936],{"type":24,"value":931},{"type":18,"tag":26,"props":938,"children":939},{},[940],{"type":24,"value":905},{"type":18,"tag":26,"props":942,"children":943},{},[944],{"type":24,"value":945},"tail -n 132 ms_log/eval_s8_multiscale_flip.log",{"type":18,"tag":26,"props":947,"children":948},{},[949],{"type":24,"value":915},{"type":18,"tag":26,"props":951,"children":952},{},[953],{"type":18,"tag":40,"props":954,"children":955},{},[956],{"type":24,"value":957},"5、线上推理",{"type":18,"tag":26,"props":959,"children":960},{},[961],{"type":24,"value":962},"由于deeplabv3目前推理代码仅限Ascend硬件（笔者尝试修改代码进行GPU/CPU支持，都会有部分错误，如果后面有时间再详细debug。），所以我们需要开通一个Ascend服务器，并搭建相关环境进行后续步骤。",{"type":18,"tag":26,"props":964,"children":965},{},[966],{"type":24,"value":967},"注意",{"type":18,"tag":159,"props":969,"children":970},{},[971,976],{"type":18,"tag":163,"props":972,"children":973},{},[974],{"type":24,"value":975},"由于 deeplabv3 数据较大，需要提前增加一块云硬盘并挂载到系统中，或者开通服务器时系统盘选择200G。",{"type":18,"tag":163,"props":977,"children":978},{},[979,981,984],{"type":24,"value":980},"昇腾硬件平台开通及MindSpore环境搭建参考笔者文章",{"type":18,"tag":174,"props":982,"children":983},{},[],{"type":18,"tag":178,"props":985,"children":986},{},[987],{"type":18,"tag":71,"props":988,"children":991},{"href":989,"rel":990},"https://my.oschina.net/kaierlong/blog/5377351",[75],[992],{"type":24,"value":989},{"type":18,"tag":26,"props":994,"children":995},{},[996],{"type":24,"value":997},"云端数据下载",{"type":18,"tag":26,"props":999,"children":1000},{},[1001],{"type":24,"value":1002},"云端数据下载参考前面数据准备章节，仅需要下载完成数据并解压即可。注意需要提前将代码仓库clone到云端。",{"type":18,"tag":26,"props":1004,"children":1005},{},[1006],{"type":24,"value":1007},"在云端，创建deeplabv3目录下创建 SegmentationClassGray 目录",{"type":18,"tag":97,"props":1009,"children":1011},{"code":1010},"mkdir -p raw_data/VOCdevkit/VOC2012/SegmentationClassGray\n",[1012],{"type":18,"tag":102,"props":1013,"children":1014},{"__ignoreMap":7},[1015],{"type":24,"value":1010},{"type":18,"tag":26,"props":1017,"children":1018},{},[1019],{"type":24,"value":1020},"在本地，模型导出",{"type":18,"tag":26,"props":1022,"children":1023},{},[1024],{"type":24,"value":1025},"注意将 ckpt_file 替换",{"type":18,"tag":97,"props":1027,"children":1029},{"code":1028},"python3 export.py --ckpt_file=./s16_aug_train_1g/ckpt/deeplab_v3_s16-200_661.ckpt --file_name=deeplab_v3_s16_200_661 --file_format=MINDIR --export_model=deeplab_v3_s16 --device_target=GPU\n\npython3 export.py --ckpt_file=./s8_voc_train_1g/ckpt/deeplab_v3_s8-200_183.ckpt --file_name=deeplab_v3_s8_200_183 --file_format=MINDIR --export_model=deeplab_v3_s8 --device_target=GPU\n",[1030],{"type":18,"tag":102,"props":1031,"children":1032},{"__ignoreMap":7},[1033],{"type":24,"value":1028},{"type":18,"tag":26,"props":1035,"children":1036},{},[1037],{"type":24,"value":1038},"在本地，数据上传",{"type":18,"tag":26,"props":1040,"children":1041},{},[1042],{"type":24,"value":1043},"注意将 s8_voc_train_1g/ckpt/deeplab_v3_s8-200_183.ckpt 替换",{"type":18,"tag":97,"props":1045,"children":1047},{"code":1046},"remote_ip=\"your_server_ip\"\nscp *.mindir root@${remote_ip}:/root/codes/models/official/cv/deeplabv3/\nscp s8_voc_train_1g/ckpt/deeplab_v3_s8-200_183.ckpt root@${remote_ip}:/root/codes/models/official/cv/deeplabv3/\nscp raw_data/*.txt root@${remote_ip}:/root/codes/models/official/cv/deeplabv3/raw_data/\nscp -r raw_data/VOCdevkit/VOC2012/SegmentationClassGray/* root@${remote_ip}:/root/codes/models/official/cv/deeplabv3/raw_data/VOCdevkit/VOC2012/SegmentationClassGray/\n",[1048],{"type":18,"tag":102,"props":1049,"children":1050},{"__ignoreMap":7},[1051],{"type":24,"value":1046},{"type":18,"tag":26,"props":1053,"children":1054},{},[1055],{"type":24,"value":1056},"在云端，模型推理",{"type":18,"tag":97,"props":1058,"children":1060},{"code":1059},"cd /root/codes/models/official/cv/deeplabv3/\nmkdir ascend310_infer_result && cd ascend310_infer_result\ncp ../scripts/run_infer_310.sh ./\nchmod a+x run_infer_310.sh\nnohup ./run_infer_310.sh ../deeplab_v3_s8_200_183.mindir ./ ../ ../raw_data/voc_val_lst.txt 0 &\n",[1061],{"type":18,"tag":102,"props":1062,"children":1063},{"__ignoreMap":7},[1064],{"type":24,"value":1059},{"type":18,"tag":26,"props":1066,"children":1067},{},[1068],{"type":24,"value":1069},"可以使用 cat acc.log 命令查看推理结果",{"type":18,"tag":26,"props":1071,"children":1072},{},[1073],{"type":24,"value":1074},"在云端，量化推理",{"type":18,"tag":26,"props":1076,"children":1077},{},[1078],{"type":24,"value":1079},"这里因为软件限制，无法使用 amct_mindspore ，故而将 post_quant.py 步骤进行替换。",{"type":18,"tag":97,"props":1081,"children":1083},{"code":1082},"cd /root/codes/models/official/cv/deeplabv3/ascend310_quant_infer\nnohup python3 export_bin.py --model=deeplab_v3_s8 --data_root=../raw_data --data_lst=../raw_data/voc_val_lst.txt > data.log 2>&1 &\nchmod a+x run_quant_infer.sh\n\n# post_quant.py步骤替换为export.py\n# python3 post_quant.py --model=deeplab_v3_s8 --data_root=../raw_data --data_lst=../raw_data/voc_val_lst.txt --ckpt_file=../deeplab_v3_s8-200_183.ckpt\n\npython3 export.py --ckpt_file=deeplab_v3_s8-200_183.ckpt --file_name=deeplab_v3_s8_200_183 --file_format=AIR --export_model=deeplab_v3_s8 --device_target=Ascend\n\nnohup ./run_quant_infer.sh ../deeplab_v3_s8_200_183.air ./data/00_data/ ./data/01_label ./data/shape.npy &\n",[1084],{"type":18,"tag":102,"props":1085,"children":1086},{"__ignoreMap":7},[1087],{"type":24,"value":1082},{"type":18,"tag":26,"props":1089,"children":1090},{},[1091],{"type":24,"value":1069},{"type":18,"tag":26,"props":1093,"children":1094},{},[1095],{"type":18,"tag":40,"props":1096,"children":1097},{},[1098],{"type":24,"value":1099},"6、问题",{"type":18,"tag":26,"props":1101,"children":1102},{},[1103],{"type":24,"value":1104},"笔者遇到的问题及解决思路",{"type":18,"tag":26,"props":1106,"children":1107},{},[1108],{"type":18,"tag":40,"props":1109,"children":1110},{},[1111],{"type":24,"value":1112},"问题1",{"type":18,"tag":26,"props":1114,"children":1115},{},[1116],{"type":24,"value":1117},"dataset_sink_mode问题",{"type":18,"tag":97,"props":1119,"children":1121},{"code":1120},"Traceback (most recent call last):\n  File \"train.py\", line 213, in \n    train()\n  File \"/mnt/data_0301_12t/xingchaolong/home/codes/gitee/mindspore_models/official/cv/deeplabv3/model_utils/moxing_adapter.py\", line 105, in wrapped_func\n    run_func(*args, **kwargs)\n  File \"train.py\", line 209, in train\n    model.train(args.train_epochs, dataset, callbacks=cbs, dataset_sink_mode=(args.device_target != \"CPU\"))\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/train/model.py\", line 722, in train\n    self._train(epoch,\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/train/model.py\", line 504, in _train\n    self._train_dataset_sink_process(epoch, train_dataset, list_callback, cb_params, sink_size)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/train/model.py\", line 566, in _train_dataset_sink_process\n    outputs = self._train_network(*inputs)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/nn/cell.py\", line 404, in __call__\n    out = self.compile_and_run(*inputs)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/nn/cell.py\", line 682, in compile_and_run\n    self.compile(*inputs)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/nn/cell.py\", line 669, in compile\n    _cell_graph_executor.compile(self, *inputs, phase=self.phase, auto_parallel_mode=self._auto_parallel_mode)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/common/api.py\", line 548, in compile\n    result = self._graph_executor.compile(obj, args_list, phase, use_vm, self.queue_name)\nTypeError: mindspore/ccsrc/runtime/device/gpu/kernel_info_setter.cc:355 PrintUnsupportedTypeException] Select GPU kernel op[SoftmaxCrossEntropyWithLogits] fail! Incompatible data type!\nThe supported data types are in[float32 float32], out[float32 float32]; , but get in [float16 float16 ] out [float16 float16 ]\n",[1122],{"type":18,"tag":102,"props":1123,"children":1124},{"__ignoreMap":7},[1125],{"type":24,"value":1120},{"type":18,"tag":26,"props":1127,"children":1128},{},[1129],{"type":18,"tag":40,"props":1130,"children":1131},{},[1132],{"type":24,"value":1133},"问题2",{"type":18,"tag":26,"props":1135,"children":1136},{},[1137],{"type":24,"value":1138},"GPU显存不足问题",{"type":18,"tag":97,"props":1140,"children":1142},{"code":1141},"[ERROR] RUNTIME_FRAMEWORK(1715024,7f1962ffd700,python3):2021-12-10-11:06:52.083.474 [mindspore/ccsrc/runtime/framework/actor/memory_manager_actor.cc:182] SetOpContextMemoryAllocFail] Device(id:0) memory isn't enough and alloc failed, kernel name: Default/network-TrainOneStepCell/network-BuildTrainNetwork/network-DeepLabV3/resnet-Resnet/layer3-SequentialCell/0-Bottleneck/bn3-BatchNorm2d/BatchNorm-op4408, alloc size: 142737408B.\n[EXCEPTION] VM(1715024,7f1ab171c740,python3):2021-12-10-11:06:52.083.822 [mindspore/ccsrc/vm/backend.cc:835] RunGraph] The actor runs failed, actor name: kernel_graph_1\nload_model ./resnet101_ascend_v120_imagenet2012_official_cv_bs32_acc78.ckpt success\nTraceback (most recent call last):\n  File \"train.py\", line 221, in \n    train()\n  File \"/mnt/data_0301_12t/xingchaolong/home/codes/gitee/mindspore_models/official/cv/deeplabv3/model_utils/moxing_adapter.py\", line 105, in wrapped_func\n    run_func(*args, **kwargs)\n  File \"train.py\", line 217, in train\n    model.train(args.train_epochs, dataset, callbacks=cbs, dataset_sink_mode=(args.device_target != \"CPU\"))\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/train/model.py\", line 722, in train\n    self._train(epoch,\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/train/model.py\", line 504, in _train\n    self._train_dataset_sink_process(epoch, train_dataset, list_callback, cb_params, sink_size)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/train/model.py\", line 566, in _train_dataset_sink_process\n    outputs = self._train_network(*inputs)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/nn/cell.py\", line 404, in __call__\n    out = self.compile_and_run(*inputs)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/nn/cell.py\", line 698, in compile_and_run\n    return _cell_graph_executor(self, *new_inputs, phase=self.phase)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/common/api.py\", line 627, in __call__\n    return self.run(obj, *args, phase=phase)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/common/api.py\", line 655, in run\n    return self._exec_pip(obj, *args, phase=phase_real)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/common/api.py\", line 78, in wrapper\n    results = fn(*arg, **kwargs)\n  File \"/mnt/data_0301_12t/xingchaolong/home/pyenvs/env_mindspore_1.5.0/lib/python3.8/site-packages/mindspore/common/api.py\", line 638, in _exec_pip\n    return self._graph_executor(args_list, phase)\nRuntimeError: mindspore/ccsrc/vm/backend.cc:835 RunGraph] The actor runs failed, actor name: kernel_graph_1\n",[1143],{"type":18,"tag":102,"props":1144,"children":1145},{"__ignoreMap":7},[1146],{"type":24,"value":1141},{"type":18,"tag":26,"props":1148,"children":1149},{},[1150],{"type":18,"tag":40,"props":1151,"children":1152},{},[1153],{"type":24,"value":1154},"问题3",{"type":18,"tag":26,"props":1156,"children":1157},{},[1158],{"type":24,"value":1159},"sudo apt install libgl1-mesa-glx",{"type":18,"tag":97,"props":1161,"children":1163},{"code":1162},"Traceback (most recent call last):\n  File \"../postprocess.py\", line 20, in \n    import cv2\n  File \"/root/pyenvs/env_mindspore_ascend_1.5.0/lib/python3.7/site-packages/cv2/__init__.py\", line 8, in \n    from .cv2 import *\nImportError: libGL.so.1: cannot open shared object file: No such file or directory\n",[1164],{"type":18,"tag":102,"props":1165,"children":1166},{"__ignoreMap":7},[1167],{"type":24,"value":1162},{"type":18,"tag":26,"props":1169,"children":1170},{},[1171],{"type":24,"value":1172},"参考资料：",{"type":18,"tag":26,"props":1174,"children":1175},{},[1176,1178],{"type":24,"value":1177},"[1] ",{"type":18,"tag":71,"props":1179,"children":1182},{"href":1180,"rel":1181},"https://gitee.com/mindspore/models/tree/master/official/cv/deeplabv3",[75],[1183],{"type":24,"value":1180},{"type":18,"tag":26,"props":1185,"children":1186},{},[1187],{"type":18,"tag":40,"props":1188,"children":1189},{},[1190],{"type":24,"value":1191},"欢迎投稿",{"type":18,"tag":26,"props":1193,"children":1194},{},[1195],{"type":18,"tag":40,"props":1196,"children":1197},{},[1198,1200,1208],{"type":24,"value":1199},"欢迎大家踊跃投稿，有想投稿技术干货、项目经验等分享的同学，可以添加MindSpore官方小助手：小猫子（",{"type":18,"tag":40,"props":1201,"children":1202},{},[1203],{"type":18,"tag":40,"props":1204,"children":1205},{},[1206],{"type":24,"value":1207},"mindspore0328",{"type":24,"value":1209},"）的微信，告诉猫哥哦！",{"type":18,"tag":26,"props":1211,"children":1212},{},[1213,1218,1220,1225,1227,1235],{"type":18,"tag":40,"props":1214,"children":1215},{},[1216],{"type":24,"value":1217},"昇思MindSpore官方交流QQ群 :",{"type":24,"value":1219}," ",{"type":18,"tag":40,"props":1221,"children":1222},{},[1223],{"type":24,"value":1224},"486831414",{"type":24,"value":1226},"**（",{"type":18,"tag":40,"props":1228,"children":1229},{},[1230],{"type":18,"tag":40,"props":1231,"children":1232},{},[1233],{"type":24,"value":1234},"群里有很多技术大咖助力答疑！",{"type":24,"value":1236},"）**",{"type":18,"tag":26,"props":1238,"children":1239},{},[1240],{"type":18,"tag":30,"props":1241,"children":1243},{"alt":7,"src":1242},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/01/29/d6a17ba276e24bad9792876fb74e9748.jpg",[],{"type":18,"tag":26,"props":1245,"children":1246},{},[1247],{"type":18,"tag":40,"props":1248,"children":1249},{},[1250],{"type":24,"value":1251},"官方QQ群号 : 486831414",{"type":18,"tag":26,"props":1253,"children":1254},{},[1255],{"type":18,"tag":40,"props":1256,"children":1257},{},[1258],{"type":24,"value":1259},"微信小助手：mindspore0328",{"type":18,"tag":80,"props":1261,"children":1263},{"id":1262},"扫描下方二维码加入mindspore项目",[1264],{"type":24,"value":1265},"扫描下方二维码加入MindSpore项目",{"type":18,"tag":26,"props":1267,"children":1268},{},[1269],{"type":18,"tag":30,"props":1270,"children":1272},{"alt":7,"src":1271},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/01/09/984c702452434b10817b9084c6a2cee6.jpg",[],{"type":18,"tag":80,"props":1274,"children":1275},{"id":7},[],{"type":18,"tag":26,"props":1277,"children":1278},{},[1279],{"type":18,"tag":71,"props":1280,"children":1283},{"href":1281,"rel":1282},"http://mp.weixin.qq.com/s?__biz=MzAxMDA1MDM0NQ==&mid=2247541446&idx=1&sn=f397c4aadf6313efe8c16d15cec8db3d&chksm=9b542c80ac23a596935839754dc4690c6c0a20319c1bb23c67bc3bd7b527c8cf6d3c1efcc9a9&scene=21#wechat_redirect",[75],[1284],{"type":24,"value":1285},"MindSpore官方资料",{"type":18,"tag":26,"props":1287,"children":1288},{},[1289],{"type":18,"tag":71,"props":1290,"children":1292},{"href":1281,"rel":1291},[75],[1293],{"type":24,"value":1294},"GitHub : https://github.com/mindspore-ai/mindspore",{"type":18,"tag":26,"props":1296,"children":1297},{},[1298],{"type":18,"tag":71,"props":1299,"children":1301},{"href":1281,"rel":1300},[75],[1302],{"type":24,"value":1303},"Gitee : https : //gitee.com/mindspore/mindspore",{"type":18,"tag":26,"props":1305,"children":1306},{},[1307],{"type":18,"tag":71,"props":1308,"children":1310},{"href":1281,"rel":1309},[75],[1311],{"type":24,"value":1312},"官方QQ群 : 486831414",{"title":7,"searchDepth":1314,"depth":1314,"links":1315},4,[1316,1319,1320,1324,1325,1329,1330,1331,1332,1333,1334,1335],{"id":82,"depth":1317,"text":1318},3,"1.1 克隆仓库并进入到本地 deeplabv3 目录",{"id":121,"depth":1317,"text":127},{"id":146,"depth":1317,"text":152,"children":1321},[1322,1323],{"id":261,"depth":1314,"text":267},{"id":401,"depth":1314,"text":407},{"id":482,"depth":1317,"text":488},{"id":499,"depth":1317,"text":505,"children":1326},[1327,1328],{"id":513,"depth":1314,"text":519},{"id":530,"depth":1314,"text":536},{"id":738,"depth":1317,"text":744},{"id":829,"depth":1317,"text":835},{"id":856,"depth":1317,"text":862},{"id":882,"depth":1317,"text":888},{"id":918,"depth":1317,"text":924},{"id":1262,"depth":1317,"text":1265},{"id":7,"depth":1317,"text":7},"markdown","content:technology-blogs:zh:961.md","content","technology-blogs/zh/961.md","technology-blogs/zh/961","md",1776506142552]