yolo5s,nanodet,picodet微调(finetune)冻结设置

1、yolov5

  参数设置--freeze: 

--data phone.yaml --cfg yolov5s.yaml --weights yolov5s.pt --batch-size 32 --freeze 10

2、nanodet

  task.py

 def __init__(self, cfg, evaluator=None):
        super(TrainingTask, self).__init__()
        self.cfg = cfg
        self.model = build_model(cfg.model)
        ####################冻结参数##########################
        for param in self.model.backbone.parameters():
            param.requires_grad = False
        ##############################################
        self.evaluator = evaluator
        self.save_flag = -10
        self.log_style = "NanoDet"
        self.weight_averager = None

3、picodet

  picodet.py

    def __init__(self, backbone, neck, head='PicoHead'):
        super(PicoDet, self).__init__()
        self.backbone = backbone
        ####################冻结参数##########################
        for param in self.backbone.parameters():
            param.trainable = False
        ##############################################
        self.neck = neck
        self.head = head
        self.export_post_process = True
        self.export_nms = True

 

posted on 2022-04-20 10:51  WenJXUST  阅读(692)  评论(0编辑  收藏  举报