Upload folder using huggingface_hub
#3
by datnguyentien204 - opened
Files changed (5)
123version https://git-lfs.github.com/spec/v1oid sha256:76c08d226ca61ce75f8e5e8056c05e6c7c89aa030080ad455321b41a84f02858size 18342289594 unmodified lines5678910114 unmodified linesclass PriorBox(object):def __init__(self, cfg, image_size=None, phase='train'):super(PriorBox, self).__init__()self.min_sizes = cfg['min_sizes']self.steps = cfg['steps']4 unmodified lines5678910114 unmodified linesclass PriorBox(object):def __init__(self, cfg, image_size=None, phase='test'):super(PriorBox, self).__init__()self.min_sizes = cfg['min_sizes']self.steps = cfg['steps']
45 unmodified lines4647484950515253545564 unmodified lines12012112212312412512645 unmodified linesreturn out.view(out.shape[0], -1, 10)class RetinaFace(nn.Module):def __init__(self, cfg = None, phase = 'train'):""":param cfg: Network related settings.:param phase: train or test."""super(RetinaFace,self).__init__()self.phase = phase64 unmodified linesclassifications = torch.cat([self.ClassHead[i](feature) for i, feature in enumerate(features)],dim=1)ldm_regressions = torch.cat([self.LandmarkHead[i](feature) for i, feature in enumerate(features)], dim=1)if self.phase == 'train':output = (bbox_regressions, classifications, ldm_regressions)else:output = (bbox_regressions, F.softmax(classifications, dim=-1), ldm_regressions)45 unmodified lines4647484950515253545564 unmodified lines12012112212312412512645 unmodified linesreturn out.view(out.shape[0], -1, 10)class RetinaFace(nn.Module):def __init__(self, cfg = None, phase = 'test'):""":param cfg: Network related settings.:param phase: test or test."""super(RetinaFace,self).__init__()self.phase = phase64 unmodified linesclassifications = torch.cat([self.ClassHead[i](feature) for i, feature in enumerate(features)],dim=1)ldm_regressions = torch.cat([self.LandmarkHead[i](feature) for i, feature in enumerate(features)], dim=1)if self.phase == 'test':output = (bbox_regressions, classifications, ldm_regressions)else:output = (bbox_regressions, F.softmax(classifications, dim=-1), ldm_regressions)
13 unmodified lines1415161718192096 unmodified lines11711811912012112212313 unmodified linesfrom models.retinaface import RetinaFaceparser = argparse.ArgumentParser(description='Retinaface Training')parser.add_argument('--training_dataset', default='./dataset/widerface/widerface/train/label.txt', help='Training dataset directory')parser.add_argument('--network', default='mobile0.25', help='Backbone network mobile0.25 or resnet50')parser.add_argument('--num_workers', default=4, type=int, help='Number of workers used in dataloading')parser.add_argument('--lr', '--learning-rate', default=1e-3, type=float, help='initial learning rate')96 unmodified linesstep_index += 1lr = adjust_learning_rate(optimizer, gamma, epoch, step_index, iteration, epoch_size)# load train dataimages, targets = next(batch_iterator)images = images.cuda()targets = [anno.cuda() for anno in targets]13 unmodified lines1415161718192096 unmodified lines11711811912012112212313 unmodified linesfrom models.retinaface import RetinaFaceparser = argparse.ArgumentParser(description='Retinaface Training')parser.add_argument('--training_dataset', default='./dataset/widerface/widerface/test/label.txt', help='Training dataset directory')parser.add_argument('--network', default='mobile0.25', help='Backbone network mobile0.25 or resnet50')parser.add_argument('--num_workers', default=4, type=int, help='Number of workers used in dataloading')parser.add_argument('--lr', '--learning-rate', default=1e-3, type=float, help='initial learning rate')96 unmodified linesstep_index += 1lr = adjust_learning_rate(optimizer, gamma, epoch, step_index, iteration, epoch_size)# load test dataimages, targets = next(batch_iterator)images = images.cuda()targets = [anno.cuda() for anno in targets]
207 unmodified lines20820921021121221321413 unmodified lines228229230231232233234207 unmodified lines# Adapted from https://github.com/Hakuyume/chainer-ssddef decode(loc, priors, variances):"""Decode locations from predictions using priors to undothe encoding we did for offset regression at train time.Args:loc (tensor): location predictions for loc layers,Shape: [num_priors,4]13 unmodified linesdef decode_landm(pre, priors, variances):"""Decode landm from predictions using priors to undothe encoding we did for offset regression at train time.Args:pre (tensor): landm predictions for loc layers,Shape: [num_priors,10]207 unmodified lines20820921021121221321413 unmodified lines228229230231232233234207 unmodified lines# Adapted from https://github.com/Hakuyume/chainer-ssddef decode(loc, priors, variances):"""Decode locations from predictions using priors to undothe encoding we did for offset regression at test time.Args:loc (tensor): location predictions for loc layers,Shape: [num_priors,4]13 unmodified linesdef decode_landm(pre, priors, variances):"""Decode landm from predictions using priors to undothe encoding we did for offset regression at test time.Args:pre (tensor): landm predictions for loc layers,Shape: [num_priors,10]
dataset/widerface.zipAdded+3
layers/functions/prior_box.py+1-1
models/retinaface.py+3-3
train.py+2-2
utils/box_utils.py+2-2