Ejemplo n.º 1
0
        images, id_labels, pose_labels, Nd, Np, Nz, channel_num = create_randomdata(
        )
    else:
        print('n\Loading data from [%s]...' % args.data_place)
        # try:
        images, id_labels, pose_labels, Nd, Np, Nz, channel_num = FetchData(
            args.data_place)

        # except:
        #     print("Sorry, failed to load data")

    # model
    if args.snapshot is None:
        if not (args.multi_DRGAN):
            D = single_model.Discriminator(Nd, Np, channel_num)
            G = single_model.Generator(Np, Nz, channel_num)
        else:
            if args.images_perID == 0:
                print(
                    "Please specify -images-perID of your data to input to multi_DRGAN"
                )
                exit()
            else:
                D = multi_model.Discriminator(Nd, Np, channel_num)
                G = multi_model.Generator(Np, Nz, channel_num,
                                          args.images_perID)
    else:
        print('\nLoading model from [%s]...' % args.snapshot)
        try:
            D = torch.load('{}_D.pt'.format(args.snapshot))
            G = torch.load('{}_G.pt'.format(args.snapshot))
Ejemplo n.º 2
0
        images, id_labels, pose_labels, Nd, Ni, Nz, channel_num = create_randomdata()
    else:
        print('\n Loading data from [%s]...' % args.data_place)
        try:
            train_img_path_list, id_labels, pose_labels, Nd, Ni, Nz, channel_num = DataLoader2(args.data_place)
        except:
            print("Sorry, failed to load data")

    test_img_path_list = train_img_path_list[-NUM_TEST_IMG:]
    train_img_path_list = train_img_path_list[:-NUM_TEST_IMG]

    # model
    if args.snapshot is None:
        if not(args.multi_DRGAN):
            D = single_model.Discriminator(Nd, Ni, channel_num, args)
            G = single_model.Generator(Ni, Nz, channel_num, args)
            start_epoch = 1
        else:
            if args.images_perID==0:
                print("Please specify -images-perID of your data to input to multi_DRGAN")
                exit()
            # else:
                # D = multi_model.Discriminator(Nd, Ni, channel_num)
                # G = multi_model.Generator(Ni, Nz, channel_num, args.images_perID)
    else:
        print('\n Loading model from [%s]...' % args.snapshot)
        try:
            D = torch.load('{}_D.pt'.format(args.snapshot))
            G = torch.load('{}_G.pt'.format(args.snapshot))
            start_epoch = int(args.snapshot.split('/')[-1][5:])
        except: