AI开发平台MODELARTS-使用MoXing时,如何进行增量训练?:如果标签发生变化

时间:2024-11-06 21:52:43

如果标签发生变化

当数据集中的标签发生变化时,需要执行如下语句。此语句需在“mox.run”之前运行。

语句中的“logits”,表示根据不同网络中分类层权重的变量名,配置不同的参数。此处填写其对应的关键字。

mox.set_flag('checkpoint_exclude_patterns', 'logits')

如果使用的是MoXing内置网络,其对应的关键字需使用如下API获取。此示例将打印Resnet_v1_50的关键字,为“logits”

import moxing.tensorflow as mox

model_meta = mox.get_model_meta(mox.NetworkKeys.RESNET_V1_50)
logits_pattern = model_meta.default_logits_pattern
print(logits_pattern)

您也可以通过如下接口,获取MoXing支持的网络名称列表。

import moxing.tensorflow as mox
print(help(mox.NetworkKeys))

打印出来的示例如下所示:

Help on class NetworkKeys in module 
moxing.tensorflow.nets.nets_factory:

class NetworkKeys(builtins.object)
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  ALEXNET_V2 = 'alexnet_v2'
 |  
 |  CIFARNET = 'cifarnet'
 |  
 |  INCEPTION_RESNET_V2 = 'inception_resnet_v2'
 |  
 |  INCEPTION_V1 = 'inception_v1'
 |  
 |  INCEPTION_V2 = 'inception_v2'
 |  
 |  INCEPTION_V3 = 'inception_v3'
 |  
 |  INCEPTION_V4 = 'inception_v4'
 |  
 |  LENET = 'lenet'
 |  
 |  MOBILENET_V1 = 'mobilenet_v1'
 |  
 |  MOBILENET_V1_025 = 'mobilenet_v1_025'
 |  
 |  MOBILENET_V1_050 = 'mobilenet_v1_050'
 |  
 |  MOBILENET_V1_075 = 'mobilenet_v1_075'
 |  
 |  MOBILENET_V2 = 'mobilenet_v2'
 |  
 |  MOBILENET_V2_035 = 'mobilenet_v2_035'
 |  
 |  MOBILENET_V2_140 = 'mobilenet_v2_140'
 |  
 |  NASNET_CIFAR = 'nasnet_cifar'
 |  
 |  NASNET_LARGE = 'nasnet_large'
 |  
 |  NASNET_MOBILE = 'nasnet_mobile'
 |  
 |  OVERFEAT = 'overfeat'
 |  
 |  PNASNET_LARGE = 'pnasnet_large'
 |  
 |  PNASNET_MOBILE = 'pnasnet_mobile'
 |  
 |  PVANET = 'pvanet'
 |  
 |  RESNET_V1_101 = 'resnet_v1_101'
 |  
 |  RESNET_V1_110 = 'resnet_v1_110'
 |  
 |  RESNET_V1_152 = 'resnet_v1_152'
 |  
 |  RESNET_V1_18 = 'resnet_v1_18'
 |  
 |  RESNET_V1_20 = 'resnet_v1_20'
 |  
 |  RESNET_V1_200 = 'resnet_v1_200'
 |  
 |  RESNET_V1_50 = 'resnet_v1_50'
 |  
 |  RESNET_V1_50_8K = 'resnet_v1_50_8k'
 |  
 |  RESNET_V1_50_MOX = 'resnet_v1_50_mox'
 |  
 |  RESNET_V1_50_OCT = 'resnet_v1_50_oct'
 |  
 |  RESNET_V2_101 = 'resnet_v2_101'
 |  
 |  RESNET_V2_152 = 'resnet_v2_152'
 |  
 |  RESNET_V2_200 = 'resnet_v2_200'
 |  
 |  RESNET_V2_50 = 'resnet_v2_50'
 |  
 |  RESNEXT_B_101 = 'resnext_b_101'
 |  
 |  RESNEXT_B_50 = 'resnext_b_50'
 |  
 |  RESNEXT_C_101 = 'resnext_c_101'
 |  
 |  RESNEXT_C_50 = 'resnext_c_50'
 |  
 |  VGG_16 = 'vgg_16'
 |  
 |  VGG_16_BN = 'vgg_16_bn'
 |  
 |  VGG_19 = 'vgg_19'
 |  
 |  VGG_19_BN = 'vgg_19_bn'
 |  
 |  VGG_A = 'vgg_a'
 |  
 |  VGG_A_BN = 'vgg_a_bn'
 |  
 |  XCEPTION_41 = 'xception_41'
 |  
 |  XCEPTION_65 = 'xception_65'
 |  
 |  XCEPTION_71 = 'xception_71'
support.huaweicloud.com/modelarts_faq/modelarts_05_0076.html