diff --git a/ACL_PyTorch/built-in/cv/GLIP/README.md b/ACL_PyTorch/built-in/cv/GLIP/README.md index a450f968771df99d9f1c3f45e243e42e98300d51..3a4cd8f6d80ca3cae4788d9fe29e27097b2eebca 100644 --- a/ACL_PyTorch/built-in/cv/GLIP/README.md +++ b/ACL_PyTorch/built-in/cv/GLIP/README.md @@ -61,7 +61,7 @@ CLIP和ALIGN在大规模图像-文本对上进行跨模态对比学习,可以 | ------------------------------------------------------------ | ------- | ------------------------------------------------------------ | | 固件与驱动 | 22.0.2 | [Pytorch框架推理环境准备](https://www.hiascend.com/document/detail/zh/ModelZoo/pytorchframework/pies) | | CANN | 7.0.T800 | - | - | Python | 3.7.5 | - | + | Python | 3.9 | - | | PyTorch | 1.13.1 | - | | 说明:Atlas 300I Duo 推理卡请以CANN版本选择实际固件与驱动版本。 | \ | \ | @@ -83,7 +83,7 @@ CLIP和ALIGN在大规模图像-文本对上进行跨模态对比学习,可以 ``` git clone https://github.com/microsoft/GLIP.git cd GLIP - git checkout master + git reset --hard a5f302bfd4c5c67010e29f779e3b0bde94e89985 cd .. ``` @@ -118,14 +118,14 @@ CLIP和ALIGN在大规模图像-文本对上进行跨模态对比学习,可以 ## 准备数据集 1. 获取原始数据集。(解压命令参考tar –xvf \*.tar与 unzip \*.zip) - 本模型支持coco2014验证集。用户需自行获取数据集(或给出明确下载链接),将annotation文件夹和val2014文件夹解压并上传数据集到源码包路径下。目录结构如下: + 本模型支持coco2017验证集。用户需自行获取[数据集](http://images.cocodataset.org/zips/val2017.zip)与[标注文件](http://images.cocodataset.org/annotations/annotations_trainval2017.zip),将annotations_trainval2017.zip和val2017.zip上传并解压到如下目录结构: ``` GLIP └── DATASET └── coco ├── annotations - └── val2014 + └── val2017 ``` @@ -175,7 +175,7 @@ CLIP和ALIGN在大规模图像-文本对上进行跨模态对比学习,可以 1. 配置环境变量。 ``` - source /usr/local/Ascend/...... + source /usr/local/Ascend/ascend-toolkit/set_env.sh #默认位置;须按脚本实际位置使用 ``` 2. 执行命令查看芯片名称($\{chip\_name\})。 @@ -199,11 +199,11 @@ CLIP和ALIGN在大规模图像-文本对上进行跨模态对比学习,可以 3. 执行ATC命令。 ``` - atc --model="./backbone/model/glip_backbone.onnx" --output=./backbone/model/glip_backbone --framework=5 --soc_version=Ascend310P3 --input_shape_range="images:[1,3,300~1400,500~1400]" + atc --model="./backbone/model/glip_backbone.onnx" --output=./backbone/model/glip_backbone --framework=5 --soc_version=Ascend${chip_name} --input_shape_range="images:[1,3,300~1400,500~1400]" - atc --model="./select/model/glip_select.onnx" --output=./select/model/glip_select --framework=5 --soc_version=Ascend310P3 --input_shape_range="input_1:[1,256,40~200,60~200];input_2:[1,256,20~100,30~100];input_3:[1,256,10~50,15~50];input_4:[1,256,5~25,7~25];input_5:[1,256,3~15,4~15]" + atc --model="./select/model/glip_select.onnx" --output=./select/model/glip_select --framework=5 --soc_version=Ascend${chip_name} --input_shape_range="input_1:[1,256,40~200,60~200];input_2:[1,256,20~100,30~100];input_3:[1,256,10~50,15~50];input_4:[1,256,5~25,7~25];input_5:[1,256,3~15,4~15]" - atc --model="./rpn_head/model/glip_rpn_head_new.onnx" --output=./rpn_head/model/glip_rpn_head --framework=5 --soc_version=Ascend310P3 --input_shape_range="feature_1:[1,256,40~200,60~200];feature_2:[1,256,20~100,30~100];feature_3:[1,256,10~50,15~50];feature_4:[1,256,5~25,7~25];feature_5:[1,256,3~15,4~15]" --fusion_switch_file=./rpn_head/model/fusion_switch.cfg + atc --model="./rpn_head/model/glip_rpn_head_new.onnx" --output=./rpn_head/model/glip_rpn_head --framework=5 --soc_version=Ascend${chip_name} --input_shape_range="feature_1:[1,256,40~200,60~200];feature_2:[1,256,20~100,30~100];feature_3:[1,256,10~50,15~50];feature_4:[1,256,5~25,7~25];feature_5:[1,256,3~15,4~15]" --fusion_switch_file=./rpn_head/model/fusion_switch.cfg ``` - 参数说明: @@ -222,7 +222,7 @@ CLIP和ALIGN在大规模图像-文本对上进行跨模态对比学习,可以 1. 安装msit推理工具。 - 请访问[msit推理工具](https://gitee.com/ascend/msit/tree/master/msit/)代码仓,根据readme文档进行工具安装。 + 请访问[msit推理工具](https://gitee.com/ascend/msit/tree/master/msit/)代码仓,根据readme文档安装benchmark组件。安装完后可以使用`msit check all`看安装的组件下是否显示OK来判断是否成功安装。 2. 执行推理。 diff --git a/ACL_PyTorch/built-in/cv/GLIP/inference.py b/ACL_PyTorch/built-in/cv/GLIP/inference.py index d2a12732e546b52f17bc8abf515b0d58b330533d..81d70586e5ef761aa13e731a2fcb285b77062567 100644 --- a/ACL_PyTorch/built-in/cv/GLIP/inference.py +++ b/ACL_PyTorch/built-in/cv/GLIP/inference.py @@ -35,6 +35,10 @@ from maskrcnn_benchmark.data.datasets.evaluation import evaluate from maskrcnn_benchmark.modeling.rpn.anchor_generator import make_anchor_generator_complex +if not hasattr(np, 'float'): + np.float = np.float64 + + class postprocess(nn.Module): def __init__(self, cfg): super(postprocess, self).__init__() diff --git a/ACL_PyTorch/built-in/cv/GLIP/pth2onnx.py b/ACL_PyTorch/built-in/cv/GLIP/pth2onnx.py index a7a88917e56fd20bc99724319511a4b4aa6068f4..4e09ff4680d8fd72dba9cfb0f6dae2fac38541e1 100644 --- a/ACL_PyTorch/built-in/cv/GLIP/pth2onnx.py +++ b/ACL_PyTorch/built-in/cv/GLIP/pth2onnx.py @@ -29,6 +29,10 @@ from maskrcnn_benchmark.modeling.language_backbone import build_language_backbon from transformers import AutoTokenizer +if not hasattr(np, 'float'): + np.float = np.float64 + + class lang(nn.Module): def __init__(self, cfg): super(lang, self).__init__() diff --git a/ACL_PyTorch/built-in/cv/GLIP/requirement.txt b/ACL_PyTorch/built-in/cv/GLIP/requirement.txt index 15874dc5b65c7445bc0daf067275a39a9e35eaca..23d549d40c4e87b26c173b89f5faadd4bf3e627f 100644 --- a/ACL_PyTorch/built-in/cv/GLIP/requirement.txt +++ b/ACL_PyTorch/built-in/cv/GLIP/requirement.txt @@ -2,10 +2,17 @@ onnx torch==1.13.1 tqdm==4.62.3 pycocotools==2.0.7 -pyacl==1.0.0 torchvision==0.14.1 timm==0.6.13 yacs==0.1.8 transformers==4.30.2 einops -prettytable \ No newline at end of file +prettytable +numpy==1.26.4 +opencv-python +ftfy +decorator +psutil +sympy +scipy +attrs \ No newline at end of file diff --git a/ACL_PyTorch/built-in/foundation_models/Chinese_CLIP/README.md b/ACL_PyTorch/built-in/foundation_models/Chinese_CLIP/README.md index 05538e637e92fe25ea2cae5f062aff0f8ee41384..60d0ccca741fa43da96cf2ef79aa0c2b1c41eb3f 100644 --- a/ACL_PyTorch/built-in/foundation_models/Chinese_CLIP/README.md +++ b/ACL_PyTorch/built-in/foundation_models/Chinese_CLIP/README.md @@ -101,7 +101,8 @@ Chinese_CLIP为CLIP模型的中文版本,使用大规模中文数据进行训 注意:onnxsim版本必须大于等于0.4.x。 -4. 请访问[msit代码仓](https://gitee.com/ascend/msit/tree/master/msit/),根据readme文档进行工具安装。可只安装需要的组件:debug surgeon,其他组件为可选安装 + +4. 请访问[msit代码仓](https://gitee.com/ascend/msit/tree/master/msit/),根据readme文档进行工具安装。可只安装需要的组件:benchmark surgeon,其他组件为可选安装。安装完成后使用`msit check all`,刚才安装的组件下显示OK说明安装成功 5. 设置环境变量。 diff --git a/ACL_PyTorch/built-in/foundation_models/Chinese_CLIP/requirements.txt b/ACL_PyTorch/built-in/foundation_models/Chinese_CLIP/requirements.txt index 398e44ddace321293f74788ba2a619d9f6767642..645d57694b937dc8711711ff6ddbc558365ace7c 100644 --- a/ACL_PyTorch/built-in/foundation_models/Chinese_CLIP/requirements.txt +++ b/ACL_PyTorch/built-in/foundation_models/Chinese_CLIP/requirements.txt @@ -3,4 +3,6 @@ onnxsim==0.4.33 onnxmltools==1.11.1 torch==1.11.0 torchvision==0.14.1 - +decorator +attrs +psutil