13 Star 62 Fork 280

Ascend/ModelZoo-TensorFlow

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

中文|English

PSPNet101 TensorFlow离线推理

此链接提供PSPNet101 TensorFlow模型在NPU上离线推理的脚本和方法

快速指南

1. 拷贝代码

git clone https://gitee.com/ascend/ModelZoo-TensorFlow.git
cd Modelzoo-TensorFlow/ACL_TensorFlow/built-in/cv/PSPNet101_for_ACL

2. 下载数据集和预处理

  1. 请自行下载测试数据集

  2. 执行预处理脚本

    #无翻转
    python3 scripts/data_processing.py --img_num=500 --crop_width=720 --crop_height=720 --data_dir=../cityscapes --val_list=../cityscapes/list/cityscapes_val_list.txt --output_path=$dataset
    
    #翻转
    python3 scripts/data_processing.py --img_num=500 --crop_width=720 --crop_height=720 --data_dir=../cityscapes --val_list=../cityscapes/list/cityscapes_val_list.txt --output_path=$dataset --flipped_eval --flipped_output_path=$flipped_dataset   
    

3. 离线推理

Pb模型转换为om模型

pb模型下载链接

  • 环境变量设置

    请参考说明,设置环境变量

  • Pb模型转换为om模型

    atc --model=model/PSPNet101.pb --framework=3 --output=model/pspnet101_1batch --soc_version=Ascend310P3 --input_shape=input_image:1,1024,2048,3 --enable_small_channel=1 --insert_op_conf=pspnet_aipp.cfg
    
  • 编译程序

    bash build.sh
    
  • 开始运行:

    无翻转
    bash benchmark_tf.sh --batchSize=1 --outputType=fp32 --modelPath=../../model/pspnet101_1batch.om --dataPath=../../datasets/ --modelType=PSPnet101 --imgType=rgb
    
    翻转
    bash benchmark_tf.sh --batchSize=1 --outputType=fp32 --modelPath=../../model/pspnet101_1batch.om --dataPath=../../datasets/ --modelType=PSPnet101 --imgType=rgb --flippedDataPath=../../flipped_datasets/ --flippedEval=1
    

性能

结果

本结果是通过运行上面适配的推理脚本获得的。要获得相同的结果,请按照《快速指南》中的步骤操作。

无翻转推理精度结果

model data mIoU
offline Inference 500 images 77%

翻转推理精度结果

model data mIoU
offline Inference 500 images 77.24%
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ascend/ModelZoo-TensorFlow.git
git@gitee.com:ascend/ModelZoo-TensorFlow.git
ascend
ModelZoo-TensorFlow
ModelZoo-TensorFlow
master

搜索帮助