Example #1
0
    model_dir = args.load_dir + "/" + args.net + "/" + args.dataset
    if not os.path.exists(model_dir):
        raise Exception(
            'There is no input directory for loading network from ' +
            model_dir)
    output_dir = args.output_dir + "/" + args.net + "/" + args.dataset
    if not os.path.exists(output_dir):
        os.makedirs(output_dir)
    load_name = os.path.join(
        model_dir,
        'tdcnn_{}_{}_{}.pth'.format(args.checksession, args.checkepoch,
                                    args.checkpoint))

    # initilize the network here.
    if args.net == 'c3d':
        tdcnn_demo = c3d_tdcnn(pretrained=False)
    elif args.net == 'res18':
        tdcnn_demo = resnet_tdcnn(depth=18, pretrained=False)
    elif args.net == 'res34':
        tdcnn_demo = resnet_tdcnn(depth=34, pretrained=False)
    elif args.net == 'res50':
        tdcnn_demo = resnet_tdcnn(depth=50, pretrained=False)
    else:
        print("network is not defined")

    tdcnn_demo.create_architecture()
    # save memory
    for key, value in tdcnn_demo.named_parameters():
        value.requires_grad = False
    print(tdcnn_demo)
Example #2
0
    print('{:d} roidb entries'.format(num_videos))

    input_dir = args.load_dir + "/" + args.net + "/" + args.dataset
    if not os.path.exists(input_dir):
        raise Exception(
            'There is no input directory for loading network from ' +
            input_dir)
    load_name = os.path.join(
        input_dir,
        'tdcnn_{}_{}_{}.pth'.format(args.checksession, args.checkepoch,
                                    args.checkpoint))

    # initilize the network here.
    if args.net == 'c3d':
        tdcnn_demo = c3d_tdcnn(class_agnostic=cfg.AGNOSTIC, pretrained=False)
    elif args.net == 'res34':
        tdcnn_demo = resnet_tdcnn(depth=34,
                                  class_agnostic=cfg.AGNOSTIC,
                                  pretrained=False)
    elif args.net == 'res50':
        tdcnn_demo = resnet_tdcnn(depth=50,
                                  class_agnostic=cfg.AGNOSTIC,
                                  pretrained=False)
    else:
        print("network is not defined")
        pdb.set_trace()

    tdcnn_demo.create_architecture()

    print("load checkpoint %s" % (load_name))
Example #3
0
    output_dir = args.save_dir + "/" + args.net + "/" + args.dataset
    if not os.path.exists(output_dir):
        os.makedirs(output_dir)

    sampler_batch = sampler(train_size, args.batch_size)

    dataset = roibatchLoader(roidb)

    dataloader = torch.utils.data.DataLoader(dataset,
                                             batch_size=args.batch_size,
                                             sampler=sampler_batch,
                                             num_workers=args.num_workers)

    # initilize the network here.
    if args.net == 'c3d':
        tdcnn_demo = c3d_tdcnn(pretrained=True)
    elif args.net == 'i3d':
        tdcnn_demo = i3d_tdcnn(pretrained=True)
    elif args.net == 'res34':
        tdcnn_demo = resnet_tdcnn(depth=34, pretrained=True)
    elif args.net == 'res50':
        tdcnn_demo = resnet_tdcnn(depth=50, pretrained=True)
    else:
        print("network is not defined")
        pdb.set_trace()

    tdcnn_demo.create_architecture()
    print(tdcnn_demo)

    lr = args.lr
    #tr_momentum = cfg.TRAIN.MOMENTUM