Beispiel #1
0
        cfg.GCN_SHARE_FEAT_PARAMS = checkpoint['gcn_share_feat_params']
    if 'gcn_low_rank_params' in checkpoint.keys():
        cfg.GCN_LOW_RANK_PARAMS = checkpoint['gcn_low_rank_params']
    if 'gcn_low_rank_dim' in checkpoint.keys():
        cfg.GCN_LOW_RANK_DIM = checkpoint['gcn_low_rank_dim']
    if 'pooling_mode' in checkpoint.keys():
        cfg.POOLING_MODE = checkpoint['pooling_mode']
    if 'crop_with_max_pool' in checkpoint.keys():
        cfg.ROI_CROP_WITH_MAX_POOL = checkpoint['crop_with_max_pool']

    # pprint.pprint(cfg)    ###
    print('loaded checkpoint successfully!')

    # initilize the network here.
    if args.net == 'vgg16':
        graphRCNN = vgg16(imdb._classes, imdb._attributes, imdb._relations,
                          4096)
    elif args.net == 'res101':
        graphRCNN = resnet(imdb._classes, imdb._attributes, imdb._relations,
                           101)
    elif args.net == 'res50':
        graphRCNN = resnet(imdb._classes, imdb._attributes, imdb._relations,
                           50)
    elif args.net == 'res152':
        graphRCNN = resnet(imdb._classes, imdb._attributes, imdb._relations,
                           152)

    graphRCNN.create_architecture()
    # graphRCNN = nn.DataParallel(graphRCNN)                  ### for multi gpu
    graphRCNN.load_state_dict(checkpoint['model'])
    # graphRCNN = graphRCNN.module                            ### for multi gpu
    im_info = im_info.cuda()
    num_boxes = num_boxes.cuda()
    gt_boxes = gt_boxes.cuda()

  # make variable
  im_data = Variable(im_data)
  im_info = Variable(im_info)
  num_boxes = Variable(num_boxes)
  gt_boxes = Variable(gt_boxes)

  if args.cuda > 0:
    cfg.CUDA = True

  # initilize the network here.
  if args.net == 'vgg16':
  	graphRCNN = vgg16(imdb.classes, imdb.predicates, imdb.predicates, 4096)
  elif args.net == 'res101':
  	graphRCNN = resnet(imdb.classes, imdb.predicates, imdb.predicates, 101)
  elif args.net == 'res50':
  	graphRCNN = resnet(imdb.classes, imdb.predicates, imdb.predicates, 50)
  elif args.net == 'res152':
  	graphRCNN = resnet(imdb.classes, imdb.predicates, imdb.predicates, 152)

  graphRCNN.create_architecture()

  lr = cfg.TRAIN.LEARNING_RATE
  lr = args.lr_base

  if args.mode == 0:
    params = []
    for key, value in dict(graphRCNN.named_parameters()).items():
Beispiel #3
0
        im_info = im_info.cuda()
        num_boxes = num_boxes.cuda()
        gt_boxes = gt_boxes.cuda()

    # make variable
    im_data = Variable(im_data)
    im_info = Variable(im_info)
    num_boxes = Variable(num_boxes)
    gt_boxes = Variable(gt_boxes)

    if args.ngpu > 0:
        cfg.CUDA = True

    # initilize the network here.
    if args.net == 'vgg16':
        graphRCNN = vgg16(imdb._classes, imdb._attributes, imdb._relations, 4096)   ## todo: ?4096, 101, 50, 152
    # elif args.net == 'res101':
    #     graphRCNN = resnet(imdb._classes, imdb._attributes, imdb._relations, 101)
    # elif args.net == 'res50':
    #     graphRCNN = resnet(imdb._classes, imdb._attributes, imdb._relations, 50)
    # elif args.net == 'res152':
    #     graphRCNN = resnet(imdb._classes, imdb._attributes, imdb._relations, 152)

    graphRCNN.create_architecture()

    lr = cfg.TRAIN.LEARNING_RATE

    if not args.resume:
        params = []
        for key, value in dict(graphRCNN.named_parameters()).items():
            if value.requires_grad: