本文整理汇总了Python中nn.GroupNorm方法的典型用法代码示例。如果您正苦于以下问题:Python nn.GroupNorm方法的具体用法?Python nn.GroupNorm怎么用?Python nn.GroupNorm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nn
的用法示例。
在下文中一共展示了nn.GroupNorm方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: assert_and_infer_cfg
# 需要导入模块: import nn [as 别名]
# 或者: from nn import GroupNorm [as 别名]
def assert_and_infer_cfg(make_immutable=True):
"""Call this function in your script after you have finished setting all cfg
values that are necessary (e.g., merging a config from a file, merging
command line config options, etc.). By default, this function will also
mark the global cfg as immutable to prevent changing the global cfg settings
during script execution (which can lead to hard to debug errors or code
that's harder to understand than is necessary).
"""
if __C.MODEL.LOAD_IMAGENET_PRETRAINED_WEIGHTS:
assert __C.VGG.IMAGENET_PRETRAINED_WEIGHTS, \
"Path to the weight file must not be empty to load imagenet pertrained resnets."
if version.parse(torch.__version__) < version.parse('0.4.0'):
__C.PYTORCH_VERSION_LESS_THAN_040 = True
# create alias for PyTorch version less than 0.4.0
init.uniform_ = init.uniform
init.normal_ = init.normal
init.constant_ = init.constant
nn.GroupNorm = mynn.GroupNorm
if make_immutable:
cfg.immutable(True)
示例2: assert_and_infer_cfg
# 需要导入模块: import nn [as 别名]
# 或者: from nn import GroupNorm [as 别名]
def assert_and_infer_cfg(make_immutable=True):
"""Call this function in your script after you have finished setting all cfg
values that are necessary (e.g., merging a config from a file, merging
command line config options, etc.). By default, this function will also
mark the global cfg as immutable to prevent changing the global cfg settings
during script execution (which can lead to hard to debug errors or code
that's harder to understand than is necessary).
"""
if __C.MODEL.RPN_ONLY or __C.MODEL.FASTER_RCNN:
__C.RPN.RPN_ON = True
if __C.RPN.RPN_ON or __C.RETINANET.RETINANET_ON:
__C.TEST.PRECOMPUTED_PROPOSALS = False
if __C.MODEL.LOAD_IMAGENET_PRETRAINED_WEIGHTS:
assert __C.RESNETS.IMAGENET_PRETRAINED_WEIGHTS, \
"Path to the weight file must not be empty to load imagenet pertrained resnets."
if set([__C.MRCNN.ROI_MASK_HEAD, __C.KRCNN.ROI_KEYPOINTS_HEAD]) & _SHARE_RES5_HEADS:
__C.MODEL.SHARE_RES5 = True
if version.parse(torch.__version__) < version.parse('0.4.0'):
__C.PYTORCH_VERSION_LESS_THAN_040 = True
# create alias for PyTorch version less than 0.4.0
init.uniform_ = init.uniform
init.normal_ = init.normal
init.constant_ = init.constant
nn.GroupNorm = mynn.GroupNorm
if make_immutable:
cfg.immutable(True)
示例3: assert_and_infer_cfg
# 需要导入模块: import nn [as 别名]
# 或者: from nn import GroupNorm [as 别名]
def assert_and_infer_cfg(make_immutable=True):
"""Call this function in your script after you have finished setting all cfg
values that are necessary (e.g., merging a config from a file, merging
command line config options, etc.). By default, this function will also
mark the global cfg as immutable to prevent changing the global cfg settings
during script execution (which can lead to hard to debug errors or code
that's harder to understand than is necessary).
"""
if __C.MODEL.RPN_ONLY or __C.MODEL.FASTER_RCNN:
__C.RPN.RPN_ON = True
if __C.MODEL.TAGGING and __C.TEST.TAGGING:
__C.TEST.USE_GT_PROPOSALS = True
if __C.TEST.USE_GT_PROPOSALS:
__C.MODEL.FASTER_RCNN = False # TODO: Currently this will not affect the training; It will potentially influence FPN if we do FPN
__C.TEST.BBOX_REG = False
if __C.MODEL.RELATION_COOCCUR:
__C.MODEL.NUM_RELATIONS = 2
if __C.RPN.RPN_ON or __C.RETINANET.RETINANET_ON or __C.TEST.USE_GT_PROPOSALS:
__C.TEST.PRECOMPUTED_PROPOSALS = False
if __C.MODEL.LOAD_IMAGENET_PRETRAINED_WEIGHTS:
assert __C.RESNETS.IMAGENET_PRETRAINED_WEIGHTS or __C.TRAIN.IMAGENET_PRETRAINED_WEIGHTS, \
"Path to the weight file must not be empty to load imagenet pertrained resnets."
if set([__C.MRCNN.ROI_MASK_HEAD, __C.KRCNN.ROI_KEYPOINTS_HEAD]) & _SHARE_RES5_HEADS:
__C.MODEL.SHARE_RES5 = True
if version.parse(torch.__version__) < version.parse('0.4.0'):
__C.PYTORCH_VERSION_LESS_THAN_040 = True
# create alias for PyTorch version less than 0.4.0
init.uniform_ = init.uniform
init.normal_ = init.normal
init.constant_ = init.constant
nn.GroupNorm = mynn.GroupNorm
if make_immutable:
cfg.immutable(True)
示例4: assert_and_infer_cfg
# 需要导入模块: import nn [as 别名]
# 或者: from nn import GroupNorm [as 别名]
def assert_and_infer_cfg(make_immutable=True):
"""Call this function in your script after you have finished setting all cfg
values that are necessary (e.g., merging a config from a file, merging
command line config options, etc.). By default, this function will also
mark the global cfg as immutable to prevent changing the global cfg settings
during script execution (which can lead to hard to debug errors or code
that's harder to understand than is necessary).
"""
if __C.MODEL.RPN_ONLY or __C.MODEL.FASTER_RCNN:
__C.RPN.RPN_ON = True
if __C.RPN.RPN_ON or __C.RETINANET.RETINANET_ON:
__C.TEST.PRECOMPUTED_PROPOSALS = False
if __C.MODEL.LOAD_IMAGENET_PRETRAINED_WEIGHTS:
assert __C.RESNETS.IMAGENET_PRETRAINED_WEIGHTS or __C.VGG16.IMAGENET_PRETRAINED_WEIGHTS, \
"Path to the weight file must not be empty to load imagenet pertrained resnets."
if set([__C.MRCNN.ROI_MASK_HEAD, __C.KRCNN.ROI_KEYPOINTS_HEAD]) & _SHARE_RES5_HEADS:
__C.MODEL.SHARE_RES5 = True
if version.parse(torch.__version__) < version.parse('0.4.0'):
__C.PYTORCH_VERSION_LESS_THAN_040 = True
# create alias for PyTorch version less than 0.4.0
init.uniform_ = init.uniform
init.normal_ = init.normal
init.constant_ = init.constant
nn.GroupNorm = mynn.GroupNorm
if make_immutable:
cfg.immutable(True)
示例5: assert_and_infer_cfg
# 需要导入模块: import nn [as 别名]
# 或者: from nn import GroupNorm [as 别名]
def assert_and_infer_cfg(make_immutable=False):
"""Call this function in your script after you have finished setting all cfg
values that are necessary (e.g., merging a config from a file, merging
command line config options, etc.). By default, this function will also
mark the global cfg as immutable to prevent changing the global cfg settings
during script execution (which can lead to hard to debug errors or code
that's harder to understand than is necessary).
"""
if __C.MODEL.RPN_ONLY or __C.MODEL.FASTER_RCNN:
__C.RPN.RPN_ON = True
if __C.RPN.RPN_ON or __C.RETINANET.RETINANET_ON:
__C.TEST.PRECOMPUTED_PROPOSALS = False
if __C.MODEL.LOAD_IMAGENET_PRETRAINED_WEIGHTS:
assert __C.RESNETS.IMAGENET_PRETRAINED_WEIGHTS, \
"Path to the weight file must not be empty to load imagenet pertrained resnets."
if set([__C.MRCNN.ROI_MASK_HEAD, __C.KRCNN.ROI_KEYPOINTS_HEAD]) & _SHARE_RES5_HEADS:
__C.MODEL.SHARE_RES5 = True
if version.parse(torch.__version__) < version.parse('0.4.0'):
__C.PYTORCH_VERSION_LESS_THAN_040 = True
# create alias for PyTorch version less than 0.4.0
init.uniform_ = init.uniform
init.normal_ = init.normal
init.constant_ = init.constant
nn.GroupNorm = mynn.GroupNorm
if make_immutable:
cfg.immutable(True)