YAML最佳实践用于机器学习模型配置和架构。

huangapple go评论69阅读模式
英文:

YAML best practice for Machine Learning model configuration and architecture

问题

有关机器学习模型配置和架构的YAML文件的最佳实践、标准或自动模板是否存在?
免责声明:该问题与YOLO模型无关。提供YOLO YAML作为示例/用例。
有来自YOLOv7或v5模型的示例,但问题不局限于YOLO模型。
以下是一些示例片段,来自下面的链接:
超参数:
lr0: 0.01 # 初始学习率(SGD=1E-2,Adam=1E-3)
lrf: 0.1 # 最终OneCycleLR学习率(lr0 * lrf)
momentum: 0.937 # SGD动量/Adam beta1
weight_decay: 0.0005 # 优化器权重衰减5e-4
warmup_epochs: 3.0 # 预热时期(允许小数)
warmup_momentum: 0.8 # 预热初始动量
warmup_bias_lr: 0.1 # 预热初始偏差学习率
box: 0.05 # box损失增益
cls: 0.3 # cls损失增益
cls_pw: 1.0 # cls BCELoss positive_we
模型架构:
nc: 80 # 类别数
depth_multiple: 1.0 # 模型深度倍数
width_multiple: 1.0 # 层通道倍数
锚点:

  • [12,16, 19,36, 40,28] # P3/8
  • [36,75, 76,55, 72,146] # P4/16
  • [142,110, 192,243, 459,401] # P5/32
    yolov7骨干网络:
    [[[-1, 1, Conv, [32, 3, 1]], # 0
    [-1, 1, Conv, [64, 3, 2]], # 1-P1/2
    [-1, 1, Conv, [64, 3, 1]],
    [-1, 1, Conv, [128, 3, 2]], # 3-P2/4
    [-1, 1, Conv, [64, 1, 1]],
    [-2, 1, Conv, [64, 1, 1]],
    [-1, 1, Conv, [64, 3, 1]]]
英文:

Is there best practice / standard or automatic templates for YAML files for Machine Learning model configuration and architecture?

DISCLAIMER: the question is not related to YOLO models. The YOLO YAML is provided as an example/use case.

There are examples from YOLOv7 or v5 models, but question is not limited to YOLO models.

Here are some short example snippets, from the links below:

hyper parameters:

lr0: 0.01  # initial learning rate (SGD=1E-2, Adam=1E-3)
lrf: 0.1  # final OneCycleLR learning rate (lr0 * lrf)
momentum: 0.937  # SGD momentum/Adam beta1
weight_decay: 0.0005  # optimizer weight decay 5e-4
warmup_epochs: 3.0  # warmup epochs (fractions ok)
warmup_momentum: 0.8  # warmup initial momentum
warmup_bias_lr: 0.1  # warmup initial bias lr
box: 0.05  # box loss gain
cls: 0.3  # cls loss gain
cls_pw: 1.0  # cls BCELoss positive_we

model architecture:

nc: 80  # number of classes
depth_multiple: 1.0  # model depth multiple
width_multiple: 1.0  # layer channel multiple

# anchors
anchors:
  - [12,16, 19,36, 40,28]  # P3/8
  - [36,75, 76,55, 72,146]  # P4/16
  - [142,110, 192,243, 459,401]  # P5/32

# yolov7 backbone
backbone:
  # [from, number, module, args]
  [[-1, 1, Conv, [32, 3, 1]],  # 0
  
   [-1, 1, Conv, [64, 3, 2]],  # 1-P1/2      
   [-1, 1, Conv, [64, 3, 1]],
   
   [-1, 1, Conv, [128, 3, 2]],  # 3-P2/4  
   [-1, 1, Conv, [64, 1, 1]],
   [-2, 1, Conv, [64, 1, 1]],
   [-1, 1, Conv, [64, 3, 1]],

Example of model architecture for YOLOv7

Example of hyper parameters for YOLOv7

答案1

得分: 1

没有标准或自动的YAML文件模板用于机器学习模型的配置和架构。模型权重的结构甚至名称在不同实现之间都有所不同。以你的YOLO示例为例,一个实现可能会使用你在问题中提供的变量名称和结构,而其他实现,比如mmYolo,根本不使用YAML文件。

最佳实践是复制你所使用实现的作者的个体方法。通常提供的YAML文件通常作为一个很好的模板。这样可以减少你的错误可能性,有助于调试。它还使作者更容易理解你在寻求帮助时要做什么。

如果你想要为自己的实现使用YAML文件,最好使YAML文件对其他用户尽可能可读。在命名和结构方面,你基本上可以自由操作。然而,最好遵循已经引入的命名约定,比如相关的YOLO论文中介绍的模型你想要实现的模型。

英文:

There is no standard or automatic template for YAML files for Machine Learning model configurations and architectures. The structure and even the names for model weights varies from implementation to implementation. To use your YOLO example, one implementation might use the variable names and structure you gave in your question, other implementations such as mmYolo don't use YAML files at all.

Best practice is to copy the individual approach of the authors of the implementation you use. The given YAML files usually serve as a good template. That makes errors on your part less likely and helps with debugging. It also makes it easier for the author to understand what you're trying to do in case you reach out for help.

If you want to use YAML files for your own implementation, it helps to make YAML files as readable as possible to other users. You're pretty much free to do as you want when it comes to naming and structure. However, it helps to stick with naming convention already introduced, for example by the relevant YOLO paper which model you want to implement.

huangapple
  • 本文由 发表于 2023年5月28日 22:37:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76352017.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定