kzzwang commited on
Commit
092d808
·
verified ·
1 Parent(s): 11767f0

Upload ViT config

Browse files
Files changed (1) hide show
  1. vit/config.yaml +89 -0
vit/config.yaml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ViT Model Configuration
2
+ model:
3
+ name: "vit_base" # vit_tiny, vit_small, vit_base
4
+ num_classes: 3
5
+ pretrained: false
6
+ image_size: 224
7
+ dropout: 0 # 增加dropout减少过拟合
8
+ drop_path: 0 # Drop path regularization
9
+
10
+ data:
11
+ root_dir: "data"
12
+ train_split: 0.8
13
+ val_split: 0.2
14
+ test_split: 0
15
+ batch_size: 64
16
+ num_workers: 4
17
+ augmentation:
18
+ enabled: true
19
+ use_vit_transforms: true # 使用ViT专用的数据增强
20
+ # resize策略: 'squash'(强制拉伸,不推荐), 'crop'(保持比例+crop,推荐), 'pad'(保持比例+pad)
21
+ resize_strategy: "crop" # 对于高分辨率图片,推荐使用crop保持长宽比
22
+ resize_scale: 1.1 # 训练时随机crop的放大倍数(仅crop策略有效)
23
+ horizontal_flip: 0.5
24
+ color_jitter: true
25
+ color_jitter_params:
26
+ brightness: 0.3 # 增加亮度变化,减少对红色的依赖
27
+ contrast: 0.3
28
+ saturation: 0.4 # 增加饱和度变化,让模型学习不同饱和度的红色
29
+ hue: 0.2 # 增加色相变化,让红色可以变成橙色、黄色等
30
+ p: 0.8 # 提高颜色增强的概率
31
+ random_brightness_contrast: true
32
+ brightness_limit: 0.3 # 增加亮度变化范围
33
+ contrast_limit: 0.3
34
+ brightness_contrast_p: 0.7
35
+ # 添加RGB通道独立调整,可以降低红色通道的影响
36
+ channel_shuffle: false # 可选:通道打乱,但可能破坏语义
37
+ # 添加颜色空间转换增强
38
+ rgb_shift: true # 随机调整RGB通道
39
+ rgb_shift_limit: 20 # RGB通道偏移范围
40
+ rgb_shift_p: 0.5
41
+ rotate: true
42
+ rotate_limit: 15
43
+ rotate_p: 0.5
44
+ shift_scale_rotate: true
45
+ shift_limit: 0.1
46
+ scale_limit: 0.1
47
+ shift_scale_rotate_p: 0.5
48
+ gaussian_noise: true
49
+ noise_var_limit: [10.0, 50.0]
50
+ noise_p: 0.3
51
+ gaussian_blur: true
52
+ blur_limit: [3, 7]
53
+ blur_p: 0.3
54
+ cutout: true
55
+ max_holes: 8
56
+ max_height: 32
57
+ max_width: 32
58
+ cutout_p: 0.3
59
+ normalize:
60
+ mean: [0.485, 0.456, 0.406]
61
+ std: [0.229, 0.224, 0.225]
62
+
63
+ training:
64
+ epochs: 50
65
+ learning_rate: 5e-5
66
+ weight_decay: 1e-4
67
+ optimizer: "adamw"
68
+ scheduler: "cosine"
69
+ warmup_epochs: 10
70
+ save_interval: 5
71
+ # 使用Focal Loss处理类别不平衡和困难样本
72
+ use_focal_loss: False
73
+ focal_loss_alpha: 1.0 # Focal loss alpha参数
74
+ focal_loss_gamma: 2.0 # Focal loss gamma参数,gamma越大,对困难样本关注越多
75
+ # 类别权重(如果不用focal loss)
76
+ use_class_weights: false # 与focal_loss二选一
77
+ # Label smoothing减少对单一特征的过度依赖
78
+ label_smoothing: 0.1
79
+
80
+ paths:
81
+ checkpoint_dir: "checkpoints/vit"
82
+ log_dir: "logs/vit"
83
+ result_dir: "results/vit"
84
+
85
+ wandb:
86
+ enabled: true # 是否启用wandb记录
87
+ project: "fire_detection_vit" # wandb项目名称
88
+ name: null # 运行名称,null则自动生成
89
+