Vipermdl / OCR_detection_IC15

OCR detection for ICDAR2015, which is based on FOTS, the precision is 80.6%.
129 stars 62 forks source link

Something wrong with the resume_checkpoint #2

Open 10183308 opened 5 years ago

10183308 commented 5 years ago

when I fine tune on the pretrained modle ?

it can not train with multi -gpus.

I find that : def _resume_checkpoint(self, resume_path): """ Resume from saved checkpoints

    :param resume_path: Checkpoint path to be resumed
    """
    self.logger.info("Loading checkpoint: {} ...".format(resume_path))
    checkpoint = torch.load(resume_path)
    self.start_epoch = checkpoint['epoch'] + 1
    self.monitor_best = checkpoint['monitor_best']
    self.model.load_state_dict(checkpoint['state_dict'])
    self.optimizer.load_state_dict(checkpoint['optimizer'])
    if self.with_cuda:
        for state in self.optimizer.state.values():
            for k, v in state.items():
                if isinstance(v, torch.Tensor):
                    state[k] = v.cuda(self.gpus) .-------------->self.gpus is dict. And can not train with gpus
    self.train_logger = checkpoint['logger']
    self.config = checkpoint['config']
    self.logger.info("Checkpoint '{}' (epoch {}) loaded".format(resume_path, self.start_epoch))

could you fix the bug?

thank you very much

novioleo commented 5 years ago

@10183308 v.cuda(self.device)