CROSS_ENTROPY_WEIGHT 训练时loss不正常
Created by: iceriver97
我在设置 CROSS_ENTROPY_WEIGHT=“dynamic”后出现了loss开始就一直为0.0001的情况:
epoch=1 step=20 lr=0.00100 loss=0.0001 step/sec=0.632 | ETA 07:54:12
epoch=1 step=30 lr=0.00100 loss=0.0001 step/sec=0.618 | ETA 08:04:20
epoch=1 step=40 lr=0.00100 loss=0.0001 step/sec=0.621 | ETA 08:02:01
epoch=1 step=50 lr=0.00100 loss=0.0001 step/sec=0.619 | ETA 08:03:05
epoch=1 step=60 lr=0.00100 loss=0.0001 step/sec=0.621 | ETA 08:01:21
epoch=1 step=70 lr=0.00100 loss=0.0001 step/sec=0.617 | ETA 08:03:57
epoch=1 step=80 lr=0.00100 loss=0.0001 step/sec=0.616 | ETA 08:04:27
epoch=1 step=90 lr=0.00100 loss=0.0001 step/sec=0.613 | ETA 08:06:52
epoch=2 step=110 lr=0.00099 loss=0.0001 step/sec=0.621 | ETA 08:00:16
epoch=2 step=120 lr=0.00099 loss=0.0001 step/sec=0.619 | ETA 08:01:04
epoch=2 step=130 lr=0.00099 loss=0.0001 step/sec=0.610 | ETA 08:08:02
epoch=2 step=140 lr=0.00099 loss=0.0001 step/sec=0.620 | ETA 08:00:04
epoch=2 step=150 lr=0.00099 loss=0.0001 step/sec=0.618 | ETA 08:01:07
epoch=2 step=160 lr=0.00099 loss=0.0001 step/sec=0.624 | ETA 07:56:38
epoch=2 step=170 lr=0.00099 loss=0.0001 step/sec=0.613 | ETA 08:04:29
epoch=2 step=180 lr=0.00099 loss=0.0001 step/sec=0.621 | ETA 07:58:18
下面是配置文件内容:
# 数据集配置
DATASET:
DATA_DIR: "./work/dataset/land_train/"
NUM_CLASSES: 7
TEST_FILE_LIST: "./work/dataset/land_train/test.txt"
TRAIN_FILE_LIST: "./work/dataset/land_train/train.txt"
VAL_FILE_LIST: "./work/dataset/land_train/val.txt"
VIS_FILE_LIST: "./work/dataset/land_train/test.txt"
# 预训练模型配置
MODEL:
MODEL_NAME: "ocrnet"
DEFAULT_NORM_TYPE: "bn"
# 此处设置backbone的配置
HRNET:
STAGE2:
NUM_CHANNELS: [18, 36]
STAGE3:
NUM_CHANNELS: [18, 36, 72]
STAGE4:
NUM_CHANNELS: [18, 36, 72, 144]
# 此处设置OCR HEAD
OCR:
OCR_MID_CHANNELS: 512
OCR_KEY_CHANNELS: 256
MULTI_LOSS_WEIGHT: [1.0, 1.0]
# 其他配置
TRAIN_CROP_SIZE: (512, 512)
EVAL_CROP_SIZE: (512, 512)
AUG:
AUG_METHOD: "unpadding"
FIX_RESIZE_SIZE: (512, 512)
RICH_CROP:
ENABLE: True
BLUR: True
BLUR_RATIO: 0.2
MAX_ROTATION: 45
MIN_AREA_RATIO: 0.5
MIRROR: True
FLIP: True
BATCH_SIZE: 8
TRAIN:
PRETRAINED_MODEL_DIR: "./PaddleSeg/pretrained_model/ocrnet_w18_bn_cityscapes/"
MODEL_SAVE_DIR: "./PaddleSeg/saved_model/ocrnet_optic/"
SNAPSHOT_EPOCH: 40
TEST:
TEST_MODEL: "./PaddleSeg/saved_model/ocrnet_optic/final"
SOLVER:
NUM_EPOCHS: 200
LR: 0.001
LR_POLICY: "poly"
OPTIMIZER: "adam"
CROSS_ENTROPY_WEIGHT: 'dynamic'