Closed louis-she closed 11 months ago
Sometimes we want to train a model with different classes number with COCO's, but still using COCO's pretrain weights. The strict=False option is not enough, we shoud manully modify the state_dict.
strict=False
state_dict
Usage:
def state_modifier(state_dict): state_dict.pop("mask.conv5.bias") state_dict.pop("mask.conv5.weight") state_dict.pop("classifier.linear_class.bias") state_dict.pop("classifier.linear_class.weight") state_dict.pop("classifier.linear_bbox.bias") state_dict.pop("classifier.linear_bbox.weight") return state_dict model.load_weights(dsb_config.STATE_DICT_PATH, state_modifier)
Sometimes we want to train a model with different classes number with COCO's, but still using COCO's pretrain weights. The
strict=False
option is not enough, we shoud manully modify thestate_dict
.Usage: