예제 #1
0
 def autoshape(self):  # add autoShape module
     print('Adding autoShape... ')
     m = autoShape(self)  # wrap model
     copy_attr(m,
               self,
               include=('yaml', 'nc', 'hyp', 'names', 'stride'),
               exclude=())  # copy attributes
     return m
예제 #2
0
 def autoshape(self):  # add autoShape module
     print("Adding autoShape... ")
     m = autoShape(self)  # wrap model
     copy_attr(m,
               self,
               include=("yaml", "nc", "hyp", "names", "stride"),
               exclude=())  # copy attributes
     return m
예제 #3
0
    def load_model(self):
        m = Model(cfg=self.cfg, nc=self.nc)
        ckpt = torch.load(self.weights)['model']  # load checkpoint
        m.load_state_dict(ckpt.state_dict())
        m.names = ckpt.names

        #load detections params
        self._detections_params()
        autoShape.iou = self.iou_thr
        autoShape.conf = self.conf

        #sacado de ultralytics/yolo
        m = m.fuse()
        model = autoShape(m)
        copy_attr(model,
                  m,
                  include=('yaml', 'nc', 'hyp', 'names', 'stride'),
                  exclude=())  # copy attributes
        self.model = model
        self.model.cuda()
        #fp32 to fp16
        if self.half:
            self.model.half()