You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The End-to-end pre-trained model was loaded and only wanted to update the det target detection part of the model, so _C.TRAIN.DET_ONLY = True was set, the network related to the driveable area and lane lines was frozen, and the loading method of dataset was modified to load only the target detection dataset. Modified loss.py, the loss of driveable area and lane line is 0, modified the weight loading code in train.py, only loading the part of requires_grad=true,Why is it that models of driveable areas and lane lines are also affected?? Specifically, when I trained the first round of epoch running demo.py, the division of lane lines and driveable areas was normal, but slowly, such as the 30th, 40th, and 100th rounds, the running effect was very bad. For details, you can see the picture below.
train.py:
if os.path.exists(cfg.MODEL.PRETRAINED_DET):
logger.info("=> loading model weight in det branch from '{}'".format(cfg.MODEL.PRETRAINED))
det_idx_range = [str(i) for i in range(0,25)]
model_dict = model.state_dict()
checkpoint_file = cfg.MODEL.PRETRAINED_DET
checkpoint = torch.load(checkpoint_file)
begin_epoch = checkpoint['epoch']
last_epoch = checkpoint['epoch']
checkpoint_dict = {k: v for k, v in checkpoint['state_dict'].items() if k.split(".")[1] in det_idx_range}
checkpoint_dict = {k: v for k, v in checkpoint_dict.items() if
k in model_dict and model_dict[k].requires_grad}
model_dict.update(checkpoint_dict)
model.load_state_dict(model_dict)
logger.info("=> loaded det branch checkpoint '{}' ".format(checkpoint_file))
加载了End-to-end的预训练模型,只想更新模型中的det目标检测部分,所以设置了_C.TRAIN.DET_ONLY = True ,冻结了可行驶区域和车道线相关的网络,修改了dataset的加载方式,只加载目标检测的数据集,修改了loss.py,可行驶区域和车道线的loss为0,修改了train.py里面的权重加载代码,只加载requires_grad=true的部分,为什么就这样,可行驶区域和车道线的模型也被影响了???具体表现在我训练出来的第一轮epoch跑demo.py时,车道线和可行驶区域的分割很正常,但是慢慢的比如第30轮、40轮、100轮,跑出来效果十分不好,具体可以看下方的图片。
The End-to-end pre-trained model was loaded and only wanted to update the det target detection part of the model, so _C.TRAIN.DET_ONLY = True was set, the network related to the driveable area and lane lines was frozen, and the loading method of dataset was modified to load only the target detection dataset. Modified loss.py, the loss of driveable area and lane line is 0, modified the weight loading code in train.py, only loading the part of requires_grad=true,Why is it that models of driveable areas and lane lines are also affected?? Specifically, when I trained the first round of epoch running demo.py, the division of lane lines and driveable areas was normal, but slowly, such as the 30th, 40th, and 100th rounds, the running effect was very bad. For details, you can see the picture below.
train.py:
if os.path.exists(cfg.MODEL.PRETRAINED_DET):
logger.info("=> loading model weight in det branch from '{}'".format(cfg.MODEL.PRETRAINED))
det_idx_range = [str(i) for i in range(0,25)]
model_dict = model.state_dict()
checkpoint_file = cfg.MODEL.PRETRAINED_DET
checkpoint = torch.load(checkpoint_file)
begin_epoch = checkpoint['epoch']
last_epoch = checkpoint['epoch']
checkpoint_dict = {k: v for k, v in checkpoint['state_dict'].items() if k.split(".")[1] in det_idx_range}
checkpoint_dict = {k: v for k, v in checkpoint_dict.items() if
k in model_dict and model_dict[k].requires_grad}
model_dict.update(checkpoint_dict)
model.load_state_dict(model_dict)
logger.info("=> loaded det branch checkpoint '{}' ".format(checkpoint_file))
loss.py
def _forward_impl(self, predictions, targets, shapes, model):
"""
The text was updated successfully, but these errors were encountered: