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 97f7e1f3ce28391550987f071dc81842ebc8c45b..a05c54cdf6744eea0fa41530a8a3350951fd9575 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 5d7586fcf48f11ae90709997ffcbd270c1c47924..425413cdec2d98aa353b44a6d2ec86fa162b636f 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 36f085761b7d8558ae4d6e6e59b5ee81292b8f8c..263773b4b5cca6b8622b43ad39208543999c165b 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 69c2253cb9273b28c32c880e24733899b044109a..771da2672b24d804e23eb1b4098d43212a145ea7 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 0000000000000000000000000000000000000000..323e24e5e89dc21e0f8623fc09166db1aa100ec3 --- /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 0000000000000000000000000000000000000000..318d748ebbbd91c0e68304a48c8e82b0325dbc8d --- /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 58a55c77d0462dc899f4f88a0b388854deb85698..506ed71c9c6acd8c9127fcdcf8a016c47341a8e8 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 35ccdaf523c60f331b5541fd21e460bfb2d59870..1c90cec73f619d30c8169c3ba61a5b13818ea3bd 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 08427065b501c676bbfc10025b22abd19baa9621..abf7edac60fc676999364ada16ea037c18d283f9 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 0000000000000000000000000000000000000000..fc01fd7e40074e51d318e1d1365c6bbafb79d028 --- /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 11e0fa2d6a4a08ea4adafc83d654c64fc5a5a355..985dacfba6b41b5eac90d03c4a87df6a5bad23b8 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 6decbcd0e7d0b7f440ffafa51414c9fc7b006650..17d6a4bb79dcc629bad5a32808a79c48be72888f 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 fce63e907226728fb1f5db231742ede394835ca8..bf41bdb03082165ceee851943f179ee8823da88d 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 0000000000000000000000000000000000000000..c4819a405ba9875c8c61be328c376a1c1141fb32 --- /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 a1962e02209bb60f50aae09167c12202d33d929a..7b7c971b8396dfffff507fcd02f8b7cda95b3798 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 00a0e612436159b8ec202986c52c49fccee6a045..3cda9c3762aabe99926977138e26351dc6d8156e 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 0000000000000000000000000000000000000000..87986601610f68fde020f8aa1800216476e11491 --- /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 0000000000000000000000000000000000000000..963d39d1af58109009b3e272aec32dad447dfc20 --- /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 cba57eb21dd552b463e09ef6e906f01ac63767a4..af569128bc3758ce3466f374097ac7c6aec159ba 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 8422cf786173c27fbc279e961a724ed24a0cb7e7..95e3cff0d1cd776c1283fb00b812c301a6475ad4 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 0000000000000000000000000000000000000000..24dbb6819dcd94edf80ea8757aaeb6b82effd953 --- /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 f5e64a6a7831d4579cbd8d36e6b5aa42c41de165..f823ba6f96acbe35b3fce8b21ca535373d4a5d3f 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 0000000000000000000000000000000000000000..e4ae995b1d5b61873b3ec07290c8168ae4185072 --- /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 e68193442189ec9aa1286615250d1305302b62dd..548976af764be183e73d40aaefd88c49bb5a2803 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 f6717d4f644b46cb51e497a11ec60d192d3b3e3a..cd8327061d5f188be62ae10be3328e411126e39c 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 dad7647032017d0da79a66ae7ee56ee07fbaabb8..f0ef8fd55bf448b2c5e80013e07e36cb131d238a 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 4f442ebd3e0e3949290644ed4e48cfb5079d7070..3a88bc16636b8674c7aa02cf7b23b74b7fa856e6 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 0000000000000000000000000000000000000000..267137c8ae64d9bd5d367bffcd01bf44d9084025 --- /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 d7861c6f145d8431f777fd367ba0489269bfcee7..9755f594dbdddbcc4d9062f290b86f815107af06 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 86f1033195eaf840322ef2c0ca1ca26803027a33..24a964935429480fc39716a506a2bd6b372d3fdf 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 2df02a1f9d6d3292fded0e4e33cec2120b0a2e99..891dfa290b6a9f30849e2da0b26a6a939edff275 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 0000000000000000000000000000000000000000..441f0b485db7e044c807e4720a17c9ae54e5ec7f --- /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 9878a269b2c69578418b75d9520b45b61b0c122e..f8e0f6304f88e6a5b5ff8ea69c7a65d3255df465 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 7cf1b2d436c9902d3ef4ce85ac29f337ebb8ab90..62a46f61668df166cdc5e606f49f59b492d3969b 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 77c4244294cd0861a6d0c41f33a82ae4c291d015..4220d4b088c10b3b30fe0456b07e798d2e3be24c 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 b885c8073c680bde1be2753925b98b4e5f585967..b1a633cd505c44137f861d055d6b3be32900ae9f 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 f47068b9ff670974e5baf5e67c81ded15faa8181..a85600fcb668ccc2ae6a0cb6160069227cf83a5e 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 6b2d445bb19d5bc61b7641f3ac648dc788a4f624..46107df2778f6bef5236c4259fac3acf44ca56a7 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 0000000000000000000000000000000000000000..f7ba5b03bd747754b5da67b1b1a97094f157277f --- /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 89a7560322541dc20ed9b5dd3d35e5ef8400d042..2f9756f6b67c701cbace35feeef692c304cdd97b 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 93bf47ba0514e3a16e650816edf16dd11755c97d..f3b331ecfad5db2ae6e3b00261b9cc884c8af448 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