From a458ed1b5b0251f8573d50d185d007cfd7819f54 Mon Sep 17 00:00:00 2001 From: wanqiancheng <13541261013@163.com> Date: Tue, 11 Jul 2023 15:12:08 +0800 Subject: [PATCH] =?UTF-8?q?ABINet=E5=92=8CShufflenetv2=20=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=85=AC=E7=BD=91=E5=9C=B0=E5=9D=80=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit parser.py修改 DAL_ID2732、DB_ID0706、DBpp_ID4145、Faster_Mask_RCNN整改 --- .../Shufflenetv2_for_PyTorch/README.md | 6 ++++- .../Shufflenetv2_for_PyTorch/demo.py | 6 ++++- .../models/shufflenetv2.py | 12 ++++++++-- .../models/shufflenetv2_wock_op_woct.py | 12 ++++++++-- .../public_address_statement.md | 7 ++++++ .../Shufflenetv2_for_PyTorch/url.ini | 3 +++ .../cv/detection/ABINet_for_PyTorch/README.md | 4 ++++ .../mmocr/core/visualize.py | 6 ++++- .../mmocr/datasets/utils/parser.py | 8 ++++++- .../public_address_statement.md | 8 +++++++ .../tools/deployment/deploy_test.py | 7 +++++- .../tools/deployment/onnx2tensorrt.py | 6 ++++- .../tools/deployment/pytorch2onnx.py | 7 +++++- .../cv/detection/ABINet_for_PyTorch/url.ini | 3 +++ .../DAL_ID2732_for_PyTorch/README.md | 6 ++++- .../datasets/DOTA_devkit/DOTA2COCO.py | 6 ++++- .../public_address_statement.md | 3 +++ .../detection/DAL_ID2732_for_PyTorch/url.ini | 1 + .../detection/DB_ID0706_for_PyTorch/README.md | 4 ++++ .../DB_ID0706_for_PyTorch/backbones/resnet.py | 22 ++++++++++++----- .../public_address_statement.md | 9 +++++++ .../detection/DB_ID0706_for_PyTorch/train.py | 2 +- .../detection/DB_ID0706_for_PyTorch/url.ini | 5 ++++ .../DBpp_ID4145_for_PyTorch/README.md | 6 ++++- .../mmocr/core/visualize.py | 6 ++++- .../mmocr/datasets/utils/parser.py | 7 +++++- .../mmocr/utils/ocr.py | 17 ++++++++++--- .../public_address_statement.md | 13 ++++++++++ .../tools/deployment/deploy_test.py | 7 +++++- .../tools/deployment/onnx2tensorrt.py | 6 ++++- .../tools/deployment/pytorch2onnx.py | 7 +++++- .../detection/DBpp_ID4145_for_PyTorch/url.ini | 5 ++++ .../Faster_Mask_RCNN_for_PyTorch/README.md | 4 ++++ .../datasets/prepare_panoptic_fpn.py | 6 ++++- .../detectron2/checkpoint/catalog.py | 13 ++++++++-- .../detectron2/model_zoo/model_zoo.py | 6 ++++- .../dev/packaging/gen_install_table.py | 10 ++++++-- .../Faster_Mask_RCNN_for_PyTorch/docs/conf.py | 23 ++++++++++++++---- .../public_address_statement.md | 24 +++++++++++++++++++ .../Faster_Mask_RCNN_for_PyTorch/setup.py | 10 ++++++-- .../tests/data/test_coco_evaluation.py | 6 ++++- .../tests/test_model_zoo.py | 8 ++++++- .../Faster_Mask_RCNN_for_PyTorch/url.ini | 11 +++++++++ 43 files changed, 304 insertions(+), 44 deletions(-) create mode 100644 PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/public_address_statement.md create mode 100644 PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/url.ini create mode 100644 PyTorch/built-in/cv/detection/ABINet_for_PyTorch/public_address_statement.md create mode 100644 PyTorch/built-in/cv/detection/ABINet_for_PyTorch/url.ini create mode 100644 PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/public_address_statement.md create mode 100644 PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/url.ini create mode 100644 PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/public_address_statement.md create mode 100644 PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/url.ini create mode 100644 PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/public_address_statement.md create mode 100644 PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/url.ini create mode 100644 PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/public_address_statement.md create mode 100644 PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/url.ini diff --git a/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/README.md b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/README.md index 97f7e1f3ce..a05c54cdf6 100644 --- a/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/README.md +++ b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/README.md @@ -177,4 +177,8 @@ shuffleNetV2是一个改进shuffleNetV1的轻量级的网络,为了解决在 1.某些版本的numpy会引发错误,请避免使用该版本:1.19.2。 -2.截至目前,Ascend Pytorch使用连续操作仍然效率低下,因此ShufflenetV2使用自定义方法实现,更多细节参阅models/shufflenetv2_wock_op_woct.py。 \ No newline at end of file +2.截至目前,Ascend Pytorch使用连续操作仍然效率低下,因此ShufflenetV2使用自定义方法实现,更多细节参阅models/shufflenetv2_wock_op_woct.py。 + +# 公网地址说明 + +代码涉及公网地址参考 public_address_statement.md \ No newline at end of file diff --git a/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/demo.py b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/demo.py index 5d7586fcf4..425413cdec 100644 --- a/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/demo.py +++ b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/demo.py @@ -16,6 +16,7 @@ """demo.py """ +import os import torch @@ -32,7 +33,10 @@ def get_raw_data(): # 请自定义获取数据方式,请勿将原始数据上传至代码仓 from PIL import Image from urllib.request import urlretrieve - IMAGE_URL = 'https://bbs-img.huaweicloud.com/blogs/img/thumb/1591951315139_8989_1363.png' + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, './url.ini'), 'r') as _f: + _content = _f.read() + IMAGE_URL = _content.split('image_url=')[1].split('\n')[0] urlretrieve(IMAGE_URL, 'tmp.jpg') img = Image.open("tmp.jpg") img = img.convert('RGB') diff --git a/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/models/shufflenetv2.py b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/models/shufflenetv2.py index 36f085761b..263773b4b5 100644 --- a/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/models/shufflenetv2.py +++ b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/models/shufflenetv2.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os + import torch import torch.nn as nn try: @@ -25,9 +27,15 @@ __all__ = [ 'shufflenet_v2_x1_5', 'shufflenet_v2_x2_0' ] +CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(CURRENT_PATH, '../url.ini'), 'r') as _f: + _content = _f.read() + shufflenetv2_x0_5_url = _content.split('shufflenetv2_x0_5_url=')[1].split('\n')[0] + shufflenetv2_x1_0_url = _content.split('shufflenetv2_x1_0_url=')[1].split('\n')[0] + model_urls = { - 'shufflenetv2_x0.5': 'https://download.pytorch.org/models/shufflenetv2_x0.5-f707e7126e.pth', - 'shufflenetv2_x1.0': 'https://download.pytorch.org/models/shufflenetv2_x1-5666bf0f80.pth', + 'shufflenetv2_x0.5': shufflenetv2_x0_5_url, + 'shufflenetv2_x1.0': shufflenetv2_x1_0_url, 'shufflenetv2_x1.5': None, 'shufflenetv2_x2.0': None, } diff --git a/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/models/shufflenetv2_wock_op_woct.py b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/models/shufflenetv2_wock_op_woct.py index 69c2253cb9..771da2672b 100644 --- a/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/models/shufflenetv2_wock_op_woct.py +++ b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/models/shufflenetv2_wock_op_woct.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os + import torch import torch.nn as nn @@ -33,9 +35,15 @@ __all__ = [ 'shufflenet_v2_x1_5', 'shufflenet_v2_x2_0' ] +CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(CURRENT_PATH, '../url.ini'), 'r') as _f: + _content = _f.read() + shufflenetv2_x0_5_url = _content.split('shufflenetv2_x0_5_url=')[1].split('\n')[0] + shufflenetv2_x1_0_url = _content.split('shufflenetv2_x1_0_url=')[1].split('\n')[0] + model_urls = { - 'shufflenetv2_x0.5': 'https://download.pytorch.org/models/shufflenetv2_x0.5-f707e7126e.pth', - 'shufflenetv2_x1.0': 'https://download.pytorch.org/models/shufflenetv2_x1-5666bf0f80.pth', + 'shufflenetv2_x0.5': shufflenetv2_x0_5_url, + 'shufflenetv2_x1.0': shufflenetv2_x1_0_url, 'shufflenetv2_x1.5': None, 'shufflenetv2_x2.0': None, } diff --git a/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/public_address_statement.md b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/public_address_statement.md new file mode 100644 index 0000000000..323e24e5e8 --- /dev/null +++ b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/public_address_statement.md @@ -0,0 +1,7 @@ +| 类型 | 开源代码地址 | 文件名 | 公网IP地址/公网URL地址/域名/邮箱地址 | 用途说明 | +|------|--------|----------------------------------|----------------------------------------------------------------------------------------------------|---------| +| 开发引入 | / | Shufflenetv2_for_PyTorch/demo.py | https://bbs-img.huaweicloud.com/blogs/img/thumb/1591951315139_8989_1363.png | 下载图片 | +| 开发引入 | / | Shufflenetv2_for_PyTorch/shufflenetv2.py | https://download.pytorch.org/models/shufflenetv2_x0.5-f707e7126e.pth | 下载预训练权重 | +| 开发引入 | / | Shufflenetv2_for_PyTorch/shufflenetv2.py | https://download.pytorch.org/models/shufflenetv2_x1-5666bf0f80.pth | 下载预训练权重 | +| 开发引入 | / | Shufflenetv2_for_PyTorch/shufflenetv2_wock_op_woct.py | https://download.pytorch.org/models/shufflenetv2_x0.5-f707e7126e.pth | 下载预训练权重 | +| 开发引入 | / | Shufflenetv2_for_PyTorch/shufflenetv2_wock_op_woct.py | https://download.pytorch.org/models/shufflenetv2_x1-5666bf0f80.pth | 下载预训练权重 | \ No newline at end of file diff --git a/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/url.ini b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/url.ini new file mode 100644 index 0000000000..318d748ebb --- /dev/null +++ b/PyTorch/built-in/cv/classification/Shufflenetv2_for_PyTorch/url.ini @@ -0,0 +1,3 @@ +image_url=https://bbs-img.huaweicloud.com/blogs/img/thumb/1591951315139_8989_1363.png +shufflenetv2_x0_5_url=https://download.pytorch.org/models/shufflenetv2_x0.5-f707e7126e.pth +shufflenetv2_x1_0_url=https://download.pytorch.org/models/shufflenetv2_x1-5666bf0f80.pth \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/README.md b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/README.md index 58a55c77d0..506ed71c9c 100644 --- a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/README.md +++ b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/README.md @@ -188,3 +188,7 @@ python tools/data/utils/lmdb_converter.py data/mixture/Syn90k/label.txt data/mix 2023.03.17:首次发布。 ## FAQ 无。 + +# 公网地址说明 + +代码涉及公网地址参考 public_address_statement.md \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/mmocr/core/visualize.py b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/mmocr/core/visualize.py index 35ccdaf523..1c90cec73f 100644 --- a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/mmocr/core/visualize.py +++ b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/mmocr/core/visualize.py @@ -602,7 +602,11 @@ def draw_texts_by_pil(img, dirname, _ = os.path.split(os.path.abspath(__file__)) font_path = os.path.join(dirname, 'font.TTF') if not os.path.exists(font_path): - url = ('https://download.openmmlab.com/mmocr/data/font.TTF') + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + ttf_url = _content.split('ttf_url=')[1].split('\n')[0] + url = (ttf_url) print(f'Downloading {url} ...') local_filename, _ = urllib.request.urlretrieve(url) shutil.move(local_filename, font_path) diff --git a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/mmocr/datasets/utils/parser.py b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/mmocr/datasets/utils/parser.py index 08427065b5..abf7edac60 100644 --- a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/mmocr/datasets/utils/parser.py +++ b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/mmocr/datasets/utils/parser.py @@ -1,4 +1,6 @@ # Copyright (c) OpenMMLab. All rights reserved. + +import os import json import warnings @@ -36,12 +38,16 @@ class LineStrParser: map_index = index % len(data_ret) line_str = data_ret[map_index] line_str = self.strip_cls(line_str) + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../../url.ini'), 'r') as _f: + _content = _f.read() + docs_en_url = _content.split('docs_en_url=')[1].split('\n')[0] if len(line_str.split(' ')) > 2: msg = 'More than two blank spaces were detected. ' msg += 'Please use LineJsonParser to handle ' msg += 'annotations with blanks. ' msg += 'Check Doc ' - msg += 'https://mmocr.readthedocs.io/en/latest/' + msg += docs_en_url msg += 'tutorials/blank_recog.html ' msg += 'for details.' warnings.warn(msg) diff --git a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/public_address_statement.md b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/public_address_statement.md new file mode 100644 index 0000000000..fc01fd7e40 --- /dev/null +++ b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/public_address_statement.md @@ -0,0 +1,8 @@ +| 类型 | 开源代码地址 | 文件名 | 公网IP地址/公网URL地址/域名/邮箱地址 | 用途说明 | +|------|--------|----------------------------------|----------------------------------------------------------------------------------------------------|---------| +| 开源代码引入 | https://github.com/open-mmlab/mmocr/tree/0.x/configs/textrecog/abinet | ABINet_for_PyTorch/mmocr/core/visualize.py | https://download.openmmlab.com/mmocr/data/font.TTF | 下载依赖 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr/tree/0.x/configs/textrecog/abinet | ABINet_for_PyTorch/mmocr/datasets/utils/parser.py | https://mmocr.readthedocs.io/en/latest/ | 下载依赖 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr/tree/0.x/configs/textrecog/abinet | ABINet_for_PyTorch/requirements/docs.txt | https://github.com/open-mmlab/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme | 下载依赖 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr/tree/0.x/configs/textrecog/abinet | ABINet_for_PyTorch/tools/deployment/deploy_test.py | https://github.com/open-mmlab/mmdeploy | 告警提示 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr/tree/0.x/configs/textrecog/abinet | ABINet_for_PyTorch/tools/deployment/onnx2tensorrt.py | https://github.com/open-mmlab/mmdeploy | 告警提示 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr/tree/0.x/configs/textrecog/abinet | ABINet_for_PyTorch/tools/deployment/pytorch2onnx.py | https://github.com/open-mmlab/mmdeploy | 告警提示 | \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/deploy_test.py b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/deploy_test.py index 11e0fa2d6a..985dacfba6 100644 --- a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/deploy_test.py +++ b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/deploy_test.py @@ -1,4 +1,5 @@ # Copyright (c) OpenMMLab. All rights reserved. +import os import argparse import warnings @@ -52,10 +53,14 @@ def main(): red_text, blue_text = '\x1b[31m', '\x1b[34m' white_background = '\x1b[107m' + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + mmdeploy_url = _content.split('mmdeploy_url=')[1].split('\n')[0] msg = white_background + bright_style + red_text msg += 'DeprecationWarning: This tool will be deprecated in future. ' msg += blue_text + 'Welcome to use the unified model deployment toolbox ' - msg += 'MMDeploy: https://github.com/open-mmlab/mmdeploy' + msg += 'MMDeploy: ' + mmdeploy_url msg += reset_style warnings.warn(msg) diff --git a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/onnx2tensorrt.py b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/onnx2tensorrt.py index 6decbcd0e7..17d6a4bb79 100644 --- a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/onnx2tensorrt.py +++ b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/onnx2tensorrt.py @@ -248,10 +248,14 @@ if __name__ == '__main__': red_text, blue_text = '\x1b[31m', '\x1b[34m' white_background = '\x1b[107m' + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + mmdeploy_url = _content.split('mmdeploy_url=')[1].split('\n')[0] msg = white_background + bright_style + red_text msg += 'DeprecationWarning: This tool will be deprecated in future. ' msg += blue_text + 'Welcome to use the unified model deployment toolbox ' - msg += 'MMDeploy: https://github.com/open-mmlab/mmdeploy' + msg += 'MMDeploy: ' + mmdeploy_url msg += reset_style warnings.warn(msg) diff --git a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/pytorch2onnx.py b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/pytorch2onnx.py index fce63e9072..bf41bdb030 100644 --- a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/pytorch2onnx.py +++ b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/tools/deployment/pytorch2onnx.py @@ -1,4 +1,5 @@ # Copyright (c) OpenMMLab. All rights reserved. +import os import warnings from argparse import ArgumentParser from functools import partial @@ -328,10 +329,14 @@ def main(): red_text, blue_text = '\x1b[31m', '\x1b[34m' white_background = '\x1b[107m' + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + mmdeploy_url = _content.split('mmdeploy_url=')[1].split('\n')[0] msg = white_background + bright_style + red_text msg += 'DeprecationWarning: This tool will be deprecated in future. ' msg += blue_text + 'Welcome to use the unified model deployment toolbox ' - msg += 'MMDeploy: https://github.com/open-mmlab/mmdeploy' + msg += 'MMDeploy: ' + mmdeploy_url msg += reset_style warnings.warn(msg) diff --git a/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/url.ini b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/url.ini new file mode 100644 index 0000000000..c4819a405b --- /dev/null +++ b/PyTorch/built-in/cv/detection/ABINet_for_PyTorch/url.ini @@ -0,0 +1,3 @@ +ttf_url=https://download.openmmlab.com/mmocr/data/font.TTF +docs_en_url=https://mmocr.readthedocs.io/en/latest/ +mmdeploy_url=https://github.com/open-mmlab/mmdeploy \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/README.md b/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/README.md index a1962e0220..7b7c971b83 100644 --- a/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/README.md +++ b/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/README.md @@ -190,4 +190,8 @@ DAL模型是一个高效的目标检测模型,它提出了匹配度度量来 ## FAQ -无。 \ No newline at end of file +无。 + +# 公网地址说明 + +代码涉及公网地址参考 public_address_statement.md \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/datasets/DOTA_devkit/DOTA2COCO.py b/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/datasets/DOTA_devkit/DOTA2COCO.py index 00a0e61243..3cda9c3762 100644 --- a/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/datasets/DOTA_devkit/DOTA2COCO.py +++ b/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/datasets/DOTA_devkit/DOTA2COCO.py @@ -24,11 +24,15 @@ def DOTA2COCO(srcpath, destfile): imageparent = os.path.join(srcpath, 'images') labelparent = os.path.join(srcpath, 'labelTxt') + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + dotaweb_url = _content.split('dotaweb_url=')[1].split('\n')[0] data_dict = {} info = {'contributor': 'captain group', 'data_created': '2018', 'description': 'This is 1.0 version of DOTA dataset.', - 'url': 'http://captain.whu.edu.cn/DOTAweb/', + 'url': dotaweb_url, 'version': '1.0', 'year': 2018} data_dict['info'] = info diff --git a/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/public_address_statement.md b/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/public_address_statement.md new file mode 100644 index 0000000000..8798660161 --- /dev/null +++ b/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/public_address_statement.md @@ -0,0 +1,3 @@ +| 类型 | 开源代码地址 | 文件名 | 公网IP地址/公网URL地址/域名/邮箱地址 | 用途说明 | +|------|--------|----------------------------------|----------------------------------------------------------------------------------------------------|-------| +| 开源代码引入 | https://github.com/ming71/DAL | DAL_ID2732_for_PyTorch/datasets/DOTA_devkit/DOTA2COCO.py | http://captain.whu.edu.cn/DOTAweb/ | 下载数据集 | \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/url.ini b/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/url.ini new file mode 100644 index 0000000000..963d39d1af --- /dev/null +++ b/PyTorch/built-in/cv/detection/DAL_ID2732_for_PyTorch/url.ini @@ -0,0 +1 @@ +dotaweb_url=http://captain.whu.edu.cn/DOTAweb/ \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/README.md b/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/README.md index cba57eb21d..af569128bc 100644 --- a/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/README.md +++ b/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/README.md @@ -430,3 +430,7 @@ DB(Differentiable Binarization)是一种使用可微分二值图来实时文字 | 芯片型号 | Batch Size | 数据集 | 精度 | | :------: | :--------: | :-------: | :--: | | 910A | 1 | icdar2015 | 0.896 | + +# 公网地址说明 + +代码涉及公网地址参考 public_address_statement.md \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/backbones/resnet.py b/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/backbones/resnet.py index 8422cf7861..95e3cff0d1 100644 --- a/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/backbones/resnet.py +++ b/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/backbones/resnet.py @@ -14,21 +14,31 @@ # limitations under the License. # -import torch.nn as nn +import os import math + +import torch.nn as nn import torch.utils.model_zoo as model_zoo BatchNorm2d = nn.BatchNorm2d __all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152'] +CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(CURRENT_PATH, '../url.ini'), 'r') as _f: + _content = _f.read() + resnet18_url = _content.split('resnet18_url=')[1].split('\n')[0] + resnet34_url = _content.split('resnet34_url=')[1].split('\n')[0] + resnet50_url = _content.split('resnet50_url=')[1].split('\n')[0] + resnet101_url = _content.split('resnet101_url=')[1].split('\n')[0] + resnet152_url = _content.split('resnet152_url=')[1].split('\n')[0] model_urls = { - 'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth', - 'resnet34': 'https://download.pytorch.org/models/resnet34-333f7ec4.pth', - 'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth', - 'resnet101': 'https://download.pytorch.org/models/resnet101-5d3b4d8f.pth', - 'resnet152': 'https://download.pytorch.org/models/resnet152-b121ed2d.pth', + 'resnet18': resnet18_url, + 'resnet34': resnet34_url, + 'resnet50': resnet50_url, + 'resnet101': resnet101_url, + 'resnet152': resnet152_url, } diff --git a/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/public_address_statement.md b/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/public_address_statement.md new file mode 100644 index 0000000000..24dbb6819d --- /dev/null +++ b/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/public_address_statement.md @@ -0,0 +1,9 @@ +| 类型 | 开源代码地址 | 文件名 | 公网IP地址/公网URL地址/域名/邮箱地址 | 用途说明 | +|--------|-------------------------------|----------------------------------|------------------------------------------------------------|---------| +| 开源代码引入 | https://github.com/ming71/DAL | DB_ID0706_for_PyTorch/backbones/resnet.py | https://download.pytorch.org/models/resnet18-5c106cde.pth | 下载预训练权重 | +| 开源代码引入 | https://github.com/ming71/DAL | DB_ID0706_for_PyTorch/backbones/resnet.py | https://download.pytorch.org/models/resnet34-333f7ec4.pth | 下载预训练权重 | +| 开源代码引入 | https://github.com/ming71/DAL | DB_ID0706_for_PyTorch/backbones/resnet.py | https://download.pytorch.org/models/resnet50-19c8e357.pth | 下载预训练权重 | +| 开源代码引入 | https://github.com/ming71/DAL | DB_ID0706_for_PyTorch/backbones/resnet.py | https://download.pytorch.org/models/resnet101-5d3b4d8f.pth | 下载预训练权重 | +| 开源代码引入 | https://github.com/ming71/DAL | DB_ID0706_for_PyTorch/backbones/resnet.py | https://download.pytorch.org/models/resnet152-b121ed2d.pth | 下载预训练权重 | +| 开发引入 | / | DB_ID0706_for_PyTorch/Dockerfile | http://download.osgeo.org/geos/geos-3.8.1.tar.bz2 | 下载依赖 | +| 开发引入 | / | DB_ID0706_for_PyTorch/train.py | 127.0.0.1 | 本机ip地址 | \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/train.py b/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/train.py index f5e64a6a78..f823ba6f96 100644 --- a/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/train.py +++ b/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/train.py @@ -137,7 +137,7 @@ if __name__ == '__main__': parser.add_argument('--device_list', dest="device_list", default="0", type=str, help='Use distributed training') parser.add_argument('--world_size', default=-1, type=int, help='number of nodes for distributed training') parser.add_argument('--dist_backend', default="hccl", type=str, help='distributed backend') - parser.add_argument('--addr', default="90.90.176.102", type=str, help='master addr') + parser.add_argument('--addr', default="127.0.0.1", type=str, help='master addr') parser.add_argument('--Port', default="29500", type=str, help='master Port') parser.add_argument('--bin', type=ast.literal_eval, default=False ,help='turn on bin') parser.add_argument('--profiling', default='', type=str, help='type of profiling') diff --git a/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/url.ini b/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/url.ini new file mode 100644 index 0000000000..e4ae995b1d --- /dev/null +++ b/PyTorch/built-in/cv/detection/DB_ID0706_for_PyTorch/url.ini @@ -0,0 +1,5 @@ +resnet18_url=https://download.pytorch.org/models/resnet18-5c106cde.pth +resnet34_url=https://download.pytorch.org/models/resnet34-333f7ec4.pth +resnet50_url=https://download.pytorch.org/models/resnet50-19c8e357.pth +resnet101_url=https://download.pytorch.org/models/resnet101-5d3b4d8f.pth +resnet152_url=https://download.pytorch.org/models/resnet152-b121ed2d.pth \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/README.md b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/README.md index e681934421..548976af76 100644 --- a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/README.md +++ b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/README.md @@ -152,4 +152,8 @@ MMOCR是基于PyTorch和MMDetection的开源工具包,支持众多OCR相关模 ## FAQ -无。 \ No newline at end of file +无。 + +# 公网地址说明 + +代码涉及公网地址参考 public_address_statement.md \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/core/visualize.py b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/core/visualize.py index f6717d4f64..cd8327061d 100644 --- a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/core/visualize.py +++ b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/core/visualize.py @@ -635,7 +635,11 @@ def draw_texts_by_pil(img, dirname, _ = os.path.split(os.path.abspath(__file__)) font_path = os.path.join(dirname, 'font.TTF') if not os.path.exists(font_path): - url = ('https://download.openmmlab.com/mmocr/data/font.TTF') + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + ttf_url = _content.split('ttf_url=')[1].split('\n')[0] + url = (ttf_url) print(f'Downloading {url} ...') local_filename, _ = urllib.request.urlretrieve(url) shutil.move(local_filename, font_path) diff --git a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/datasets/utils/parser.py b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/datasets/utils/parser.py index dad7647032..f0ef8fd55b 100644 --- a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/datasets/utils/parser.py +++ b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/datasets/utils/parser.py @@ -32,6 +32,7 @@ # ========================================================================== # Copyright (c) OpenMMLab. All rights reserved. +import os import json import warnings @@ -69,12 +70,16 @@ class LineStrParser: map_index = index % len(data_ret) line_str = data_ret[map_index] line_str = self.strip_cls(line_str) + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../../url.ini'), 'r') as _f: + _content = _f.read() + docs_en_url = _content.split('docs_en_url=')[1].split('\n')[0] if len(line_str.split(' ')) > 2: msg = 'More than two blank spaces were detected. ' msg += 'Please use LineJsonParser to handle ' msg += 'annotations with blanks. ' msg += 'Check Doc ' - msg += 'https://mmocr.readthedocs.io/en/latest/' + msg += docs_en_url msg += 'tutorials/blank_recog.html ' msg += 'for details.' warnings.warn(msg) diff --git a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/utils/ocr.py b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/utils/ocr.py index 4f442ebd3e..3a88bc1663 100644 --- a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/utils/ocr.py +++ b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/mmocr/utils/ocr.py @@ -65,6 +65,8 @@ from mmocr.utils.box_util import stitch_boxes_into_lines from mmocr.utils.fileio import list_from_file from mmocr.utils.model import revert_sync_batchnorm +CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + # Parse CLI arguments def parse_args(): @@ -421,7 +423,10 @@ class MMOCR: det_config = os.path.join(config_dir, 'textdet/', textdet_models[self.td]['config']) if not det_ckpt: - det_ckpt = 'https://download.openmmlab.com/mmocr/textdet/' + \ + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + textdet_url = _content.split('textdet_url=')[1].split('\n')[0] + det_ckpt = textdet_url + \ textdet_models[self.td]['ckpt'] self.detect_model = init_detector( @@ -442,7 +447,10 @@ class MMOCR: config_dir, 'textrecog/', textrecog_models[self.tr]['config']) if not recog_ckpt: - recog_ckpt = 'https://download.openmmlab.com/mmocr/' + \ + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + mmocr_url = _content.split('mmocr_url=')[1].split('\n')[0] + recog_ckpt = mmocr_url + \ 'textrecog/' + textrecog_models[self.tr]['ckpt'] self.recog_model = init_detector( @@ -456,7 +464,10 @@ class MMOCR: kie_config = os.path.join(config_dir, 'kie/', kie_models[self.kie]['config']) if not kie_ckpt: - kie_ckpt = 'https://download.openmmlab.com/mmocr/' + \ + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + mmocr_url = _content.split('mmocr_url=')[1].split('\n')[0] + kie_ckpt = mmocr_url + \ 'kie/' + kie_models[self.kie]['ckpt'] kie_cfg = Config.fromfile(kie_config) diff --git a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/public_address_statement.md b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/public_address_statement.md new file mode 100644 index 0000000000..267137c8ae --- /dev/null +++ b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/public_address_statement.md @@ -0,0 +1,13 @@ +| 类型 | 开源代码地址 | 文件名 | 公网IP地址/公网URL地址/域名/邮箱地址 | 用途说明 | +|--------|------------------------------|-------------------------------------------|----------------------------------------------------------|---------| +| 开源代码引入 | https://github.com/open-mmlab/mmocr | DBpp_ID4145_for_PyTorch/CITATION.cff | https://github.com/open-mmlab/mmocr | 下载依赖 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr | DBpp_ID4145_for_PyTorch/configs/textdet/dbnetpp/metafile.yml | https://download.openmmlab.com/mmocr/textdet/dbnet/dbnetpp_r50dcnv2_fpnc_1200e_icdar2015-20220502-d7a76fff.pth | 下载预训练权重 | +| 开发引入 | / | DBpp_ID4145_for_PyTorch/Dockerfile | http://download.openmmlab.com/mmcv/dist/npu/torch1.8.0/index.html | 下载依赖 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr | DBpp_ID4145_for_PyTorch/mmocr/core/visualize.py | https://download.openmmlab.com/mmocr/data/font.TTF | 下载依赖 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr | DBpp_ID4145_for_PyTorch/mmocr/datasets/utils/parser.py | https://mmocr.readthedocs.io/en/latest/ | 下载依赖 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr | DBpp_ID4145_for_PyTorch/mmocr/utils/ocr.py | https://download.openmmlab.com/mmocr/textdet/ | 下载依赖 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr | DBpp_ID4145_for_PyTorch/mmocr/utils/ocr.py | https://download.openmmlab.com/mmocr/ | 下载依赖 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr | DBpp_ID4145_for_PyTorch/requirements/docs.txt | https://github.com/open-mmlab/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme | 下载依赖 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr | DBpp_ID4145_for_PyTorch/tools/deployment/deploy_test.py | https://github.com/open-mmlab/mmdeploy | 告警提示 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr | DBpp_ID4145_for_PyTorch/tools/deployment/onnx2tensorrt.py | https://github.com/open-mmlab/mmdeploy | 告警提示 | +| 开源代码引入 | https://github.com/open-mmlab/mmocr | DBpp_ID4145_for_PyTorch/tools/deployment/pytorch2onnx.py | https://github.com/open-mmlab/mmdeploy | 告警提示 | \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/deploy_test.py b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/deploy_test.py index d7861c6f14..9755f594db 100644 --- a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/deploy_test.py +++ b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/deploy_test.py @@ -32,6 +32,7 @@ # ========================================================================== # Copyright (c) OpenMMLab. All rights reserved. +import os import argparse import warnings @@ -85,10 +86,14 @@ def main(): red_text, blue_text = '\x1b[31m', '\x1b[34m' white_background = '\x1b[107m' + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + mmdeploy_url = _content.split('mmdeploy_url=')[1].split('\n')[0] msg = white_background + bright_style + red_text msg += 'DeprecationWarning: This tool will be deprecated in future. ' msg += blue_text + 'Welcome to use the unified model deployment toolbox ' - msg += 'MMDeploy: https://github.com/open-mmlab/mmdeploy' + msg += 'MMDeploy: ' + mmdeploy_url msg += reset_style warnings.warn(msg) diff --git a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/onnx2tensorrt.py b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/onnx2tensorrt.py index 86f1033195..24a9649354 100644 --- a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/onnx2tensorrt.py +++ b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/onnx2tensorrt.py @@ -281,10 +281,14 @@ if __name__ == '__main__': red_text, blue_text = '\x1b[31m', '\x1b[34m' white_background = '\x1b[107m' + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + mmdeploy_url = _content.split('mmdeploy_url=')[1].split('\n')[0] msg = white_background + bright_style + red_text msg += 'DeprecationWarning: This tool will be deprecated in future. ' msg += blue_text + 'Welcome to use the unified model deployment toolbox ' - msg += 'MMDeploy: https://github.com/open-mmlab/mmdeploy' + msg += 'MMDeploy: ' + mmdeploy_url msg += reset_style warnings.warn(msg) diff --git a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/pytorch2onnx.py b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/pytorch2onnx.py index 2df02a1f9d..891dfa290b 100644 --- a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/pytorch2onnx.py +++ b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/tools/deployment/pytorch2onnx.py @@ -32,6 +32,7 @@ # ========================================================================== # Copyright (c) OpenMMLab. All rights reserved. +import os import warnings from argparse import ArgumentParser from functools import partial @@ -361,10 +362,14 @@ def main(): red_text, blue_text = '\x1b[31m', '\x1b[34m' white_background = '\x1b[107m' + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + mmdeploy_url = _content.split('mmdeploy_url=')[1].split('\n')[0] msg = white_background + bright_style + red_text msg += 'DeprecationWarning: This tool will be deprecated in future. ' msg += blue_text + 'Welcome to use the unified model deployment toolbox ' - msg += 'MMDeploy: https://github.com/open-mmlab/mmdeploy' + msg += 'MMDeploy: ' + mmdeploy_url msg += reset_style warnings.warn(msg) diff --git a/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/url.ini b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/url.ini new file mode 100644 index 0000000000..441f0b485d --- /dev/null +++ b/PyTorch/built-in/cv/detection/DBpp_ID4145_for_PyTorch/url.ini @@ -0,0 +1,5 @@ +ttf_url=https://download.openmmlab.com/mmocr/data/font.TTF +docs_en_url=https://mmocr.readthedocs.io/en/latest/ +textdet_url=https://download.openmmlab.com/mmocr/textdet/ +mmocr_url=https://download.openmmlab.com/mmocr/ +mmdeploy_url=https://github.com/open-mmlab/mmdeploy \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/README.md b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/README.md index 9878a269b2..f8e0f6304f 100644 --- a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/README.md +++ b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/README.md @@ -220,3 +220,7 @@ faster_rcnn结果 ## FAQ 无。 + +# 公网地址说明 + +代码涉及公网地址参考 public_address_statement.md \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/datasets/prepare_panoptic_fpn.py b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/datasets/prepare_panoptic_fpn.py index 7cf1b2d436..62a46f6166 100755 --- a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/datasets/prepare_panoptic_fpn.py +++ b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/datasets/prepare_panoptic_fpn.py @@ -103,7 +103,11 @@ if __name__ == "__main__": # Prepare val2017_100 for quick testing: dest_dir = os.path.join(dataset_dir, "annotations/") - URL_PREFIX = "https://dl.fbaipublicfiles.com/detectron2/" + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../url.ini'), 'r') as _f: + _content = _f.read() + prefix_url = _content.split('prefix_url=')[1].split('\n')[0] + URL_PREFIX = prefix_url download(URL_PREFIX + "annotations/coco/panoptic_val2017_100.json", dest_dir) with open(os.path.join(dest_dir, "panoptic_val2017_100.json")) as f: obj = json.load(f) diff --git a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/detectron2/checkpoint/catalog.py b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/detectron2/checkpoint/catalog.py index 77c4244294..4220d4b088 100755 --- a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/detectron2/checkpoint/catalog.py +++ b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/detectron2/checkpoint/catalog.py @@ -12,16 +12,22 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import os import logging from fvcore.common.file_io import PathHandler, PathManager +CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + class ModelCatalog(object): """ Store mappings from names to third-party models. """ - S3_C2_DETECTRON_PREFIX = "https://dl.fbaipublicfiles.com/detectron" + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + prefix_s3_c2_url = _content.split('prefix_s3_c2_url=')[1].split('\n')[0] + S3_C2_DETECTRON_PREFIX = prefix_s3_c2_url # MSRA models have STRIDE_IN_1X1=True. False otherwise. # NOTE: all BN models here have fused BN into an affine layer. @@ -130,7 +136,10 @@ class Detectron2Handler(PathHandler): """ PREFIX = "detectron2://" - S3_DETECTRON2_PREFIX = "https://dl.fbaipublicfiles.com/detectron2/" + with open(os.path.join(CURRENT_PATH, '../../../url.ini'), 'r') as _f: + _content = _f.read() + prefix_url = _content.split('prefix_url=')[1].split('\n')[0] + S3_DETECTRON2_PREFIX = prefix_url def _get_supported_prefixes(self): return [self.PREFIX] diff --git a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/detectron2/model_zoo/model_zoo.py b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/detectron2/model_zoo/model_zoo.py index b885c8073c..b1a633cd50 100755 --- a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/detectron2/model_zoo/model_zoo.py +++ b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/detectron2/model_zoo/model_zoo.py @@ -26,7 +26,11 @@ class _ModelZooUrls(object): Mapping from names to officially released Detectron2 pre-trained models. """ - S3_PREFIX = "https://dl.fbaipublicfiles.com/detectron2/" + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + prefix_url = _content.split('prefix_url=')[1].split('\n')[0] + S3_PREFIX = prefix_url # format: {config_path.yaml} -> model_id/model_final_{commit}.pkl CONFIG_PATH_TO_URL_SUFFIX = { diff --git a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/dev/packaging/gen_install_table.py b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/dev/packaging/gen_install_table.py index f47068b9ff..a85600fcb6 100755 --- a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/dev/packaging/gen_install_table.py +++ b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/dev/packaging/gen_install_table.py @@ -16,12 +16,18 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import os import argparse +CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + prefix_url = _content.split('prefix_url=')[1].split('\n')[0] + template = """
install
\
 python -m pip install detectron2{d2_version} -f \\
-  https://dl.fbaipublicfiles.com/detectron2/wheels/{cuda}/torch{torch}/index.html
-
""" + %swheels/{cuda}/torch{torch}/index.html + """ % prefix_url CUDA_SUFFIX = {"10.2": "cu102", "10.1": "cu101", "10.0": "cu100", "9.2": "cu92", "cpu": "cpu"} diff --git a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/docs/conf.py b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/docs/conf.py index 6b2d445bb1..46107df277 100755 --- a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/docs/conf.py +++ b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/docs/conf.py @@ -39,6 +39,7 @@ from typing import Dict, List, Tuple # import sphinx_rtd_theme +CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) class GithubURLDomain(Domain): """ @@ -46,7 +47,10 @@ class GithubURLDomain(Domain): """ name = "githuburl" - ROOT = "https://github.com/facebookresearch/detectron2/blob/master/" + with open(os.path.join(CURRENT_PATH, '../url.ini'), 'r') as _f: + _content = _f.read() + master_prefix_url = _content.split('master_prefix_url=')[1].split('\n')[0] + ROOT = master_prefix_url LINKED_DOC = ["tutorials/install", "tutorials/getting_started"] def resolve_any_xref(self, env, fromdocname, builder, target, node, contnode): @@ -150,10 +154,16 @@ if DEPLOY: else: # skip this when building locally intersphinx_timeout = 0.1 + +with open(os.path.join(CURRENT_PATH, '../url.ini'), 'r') as _f: + _content = _f.read() + python_url = _content.split('python_url=')[1].split('\n')[0] + numpy_url = _content.split('numpy_url=')[1].split('\n')[0] + torch_url = _content.split('torch_url=')[1].split('\n')[0] intersphinx_mapping = { - "python": ("https://docs.python.org/3.6", None), - "numpy": ("https://docs.scipy.org/doc/numpy/", None), - "torch": ("https://pytorch.org/docs/master/", None), + "python": (python_url, None), + "numpy": (numpy_url, None), + "torch": (torch_url, None), } # ------------------------- @@ -338,7 +348,10 @@ def paper_ref_role( else: paper_url, paper_title = _PAPER_DATA[link] if "/" not in paper_url: - paper_url = "https://arxiv.org/abs/" + paper_url + with open(os.path.join(CURRENT_PATH, '../url.ini'), 'r') as _f: + _content = _f.read() + arxiv_abs_url = _content.split('arxiv_abs_url=')[1].split('\n')[0] + paper_url = arxiv_abs_url + paper_url if not has_explicit_title: title = paper_title pnode = nodes.reference(title, title, internal=False, refuri=paper_url) diff --git a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/public_address_statement.md b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/public_address_statement.md new file mode 100644 index 0000000000..f7ba5b03bd --- /dev/null +++ b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/public_address_statement.md @@ -0,0 +1,24 @@ +| 类型 | 开源代码地址 | 文件名 | 公网IP地址/公网URL地址/域名/邮箱地址 | 用途说明 | +|--------|------------------------------|---------------------------------------------------------------------------------------|----------------------------------------------------------|---------| +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/datasets/prepare_for_tests.sh | https://dl.fbaipublicfiles.com/detectron2 | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/datasets/prepare_panoptic_fpn.py | https://dl.fbaipublicfiles.com/detectron2/ | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/detectron2/checkpoint/catalog.py | https://dl.fbaipublicfiles.com/detectron | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/detectron2/checkpoint/catalog.py | https://download.openmmlab.com/mmocr/data/font.TTF | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/detectron2/model_zoo/model_zoo.py | https://dl.fbaipublicfiles.com/detectron2/ | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/dev/packaging/build_wheel.sh | https://download.pytorch.org/whl/ | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/dev/packaging/gen_install_table.py | https://dl.fbaipublicfiles.com/detectron2/ | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/docker/Dockerfile | https://bootstrap.pypa.io/get-pip.py | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/docker/Dockerfile | https://download.pytorch.org/whl/cu101/torch_stable.html | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/docker/Dockerfile | https://github.com/facebookresearch/fvcore | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/docker/Dockerfile | https://github.com/facebookresearch/detectron2 | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/docker/Dockerfile-circleci | https://bootstrap.pypa.io/get-pip.py | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/docker/Dockerfile-circleci | https://download.pytorch.org/whl/cu101/torch_stable.html | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/docs/conf.py | https://github.com/facebookresearch/detectron2/blob/master/ | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/docs/conf.py | https://docs.python.org/3.6 | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/docs/conf.py | https://docs.scipy.org/doc/numpy/ | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/docs/conf.py | https://pytorch.org/docs/master/ | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/docs/conf.py | https://arxiv.org/abs/ | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/setup.py | https://github.com/facebookresearch/detectron2 | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/setup.py | https://github.com/psf/black@673327449f86fce558adde153bb6cbe54bfebad2 | 下载依赖 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/tests/data/test_coco_evaluation.py | http://images.cocodataset.org/val2017/000000000139.jpg | 下载图片 | +| 开源代码引入 | https://github.com/facebookresearch/detectron2.git | Faster_Mask_RCNN_for_PyTorch/tests/test_model_zoo.py | https://dl.fbaipublicfiles.com/detectron2/Misc/scratch_mask_rcnn_R_50_FPN_3x_gn/138602908/model_final_01ca85.pkl | 下载预训练权重 | \ No newline at end of file diff --git a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/setup.py b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/setup.py index 89a7560322..2f9756f6b6 100755 --- a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/setup.py +++ b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/setup.py @@ -176,11 +176,17 @@ def get_model_zoo_configs() -> List[str]: return config_paths +CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(CURRENT_PATH, './url.ini'), 'r') as _f: + _content = _f.read() + detectron2_url = _content.split('detectron2_url=')[1].split('\n')[0] + black_url = _content.split('black_url=')[1].split('\n')[0] + setup( name="detectron2", version=get_version(), author="FAIR", - url="https://github.com/facebookresearch/detectron2", + url=detectron2_url, description="Detectron2 is FAIR's next-generation research " "platform for object detection and segmentation.", packages=find_packages(exclude=("configs", "tests*")), @@ -206,7 +212,7 @@ setup( "dev": [ "flake8==3.8.1", "isort==4.3.21", - "black @ git+https://github.com/psf/black@673327449f86fce558adde153bb6cbe54bfebad2", + "black @ git+%s" % black_url, "flake8-bugbear", "flake8-comprehensions", ], diff --git a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/tests/data/test_coco_evaluation.py b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/tests/data/test_coco_evaluation.py index 93bf47ba05..f3b331ecfa 100755 --- a/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/tests/data/test_coco_evaluation.py +++ b/PyTorch/built-in/cv/detection/Faster_Mask_RCNN_for_PyTorch/tests/data/test_coco_evaluation.py @@ -31,8 +31,12 @@ class TestCOCOeval(unittest.TestCase): def test(self): # A small set of images/categories from COCO val # fmt: off + CURRENT_PATH = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(CURRENT_PATH, '../../url.ini'), 'r') as _f: + _content = _f.read() + coco_img_url = _content.split('coco_img_url=')[1].split('\n')[0] detections = [{"image_id": 139, "category_id": 1, "bbox": [417.3332824707031, 159.27003479003906, 47.66064453125, 143.00193786621094], "score": 0.9949821829795837, "segmentation": {"size": [426, 640], "counts": "Tc`52W=3N0N4aNN^E7]:4XE1g:8kDMT;U100000001O1gE[Nk8h1dFiNY9Z1aFkN]9g2J3NdN`FlN`9S1cFRN07]9g1bFoM6;X9c1cFoM=8R9g1bFQN>3U9Y30O01OO1O001N2O1N1O4L4L5UNoE3V:CVF6Q:@YF9l9@ZF