def __init__(self):
        model = get_model()
        criterion = get_loss
        optimizer = get_optimizer(model)
        super().__init__(model, criterion, optimizer)

        self.metric_meter['loss'] = meter.AverageValueMeter()
        self.metric_meter['acc'] = meter.AverageValueMeter()
Ejemplo n.º 2
0
    def __init__(self):
        model = get_model(opt.num_classes)
        criterion = get_loss
        optimizer = get_optimizer(model)

        super().__init__(model=model, criterion=criterion, optimizer=optimizer)

        self.config += ('Crop size: ' + str(opt.crop_size) + '\n')
        self.best_metric = 0
        for m in all_metrcis:
            self.metric_meter[m] = meter.AverageValueMeter()
Ejemplo n.º 3
0
    def __init__(self, convert):
        self.convert = convert

        model = get_model(convert)
        criterion = get_loss
        optimizer = get_optimizer(model)
        super().__init__(model, criterion, optimizer)
        self.config += ('text: ' + opt.txt + '\n' + 'train text length: ' +
                        str(opt.len) + '\n')
        self.config += ('predict text length: ' + str(opt.predict_len) + '\n')

        self.metric_meter['loss'] = meter.AverageValueMeter()
Ejemplo n.º 4
0
    def __init__(self):
        faster_rcnn = get_model()
        optimizer = get_optimizer(faster_rcnn)
        super().__init__(faster_rcnn, optimizer=optimizer)

        self.rpn_sigma = opt.rpn_sigma
        self.roi_sigma = opt.roi_sigma

        # Target creator create gt_bbox gt_label etc as training targets.
        self.anchor_target_creator = AnchorTargetCreator()
        self.proposal_target_creator = ProposalTargetCreator()

        self.loc_normalize_mean = self.model.loc_normalize_mean
        self.loc_normalize_std = self.model.loc_normalize_std

        self.faster_rcnn_loc_loss = _faster_rcnn_loc_loss
        self.class_loss = nn.CrossEntropyLoss()

        # Indicators for training status.
        # self.rpn_cm = meter.ConfusionMeter(2)
        # self.roi_cm = meter.ConfusionMeter(2)
        for k in LossTuple._fields:
            self.metric_meter[k] = meter.AverageValueMeter()