gafniguy / 4D-Facial-Avatars

Dynamic Neural Radiance Fields for Monocular 4D Facial Avater Reconstruction
670 stars 67 forks source link

About index_map.npy #60

Open JasonW-00 opened 1 year ago

JasonW-00 commented 1 year ago

After training on my new data, it seems that Index_map is needed for testing, so I made it separately. Does index_map have any special significance? If I run Nerface with a new dataset, I find that just making index_map.npy according to the code streamlined for testing does not work well,just like this:

    n_train = N-6  # training set length
    n_val = 5
    n_test = 1
    indices = train_val_partition(N, n_train, n_val, n_test) # train val test indices

    map = -np.ones((N,2))
    map[:,0] = np.arange(N)

    for mode in indices.keys(): # Train Val Test
        if mode == 'test':
            continue
        idxs = indices[mode]
        for i, idx in enumerate(tqdm(idxs)) :
            if mode == 'train': map[idx,1] = i
     np.save(os.path.join(args.target, 'index_map.npy'), map)

These codes are from real_to_nerf.py, I removed the code not related to generating index_map.npy。

gafniguy commented 9 months ago

Hi, this is just a mapping between temporal index of a frame and it's index in the training set. I used it to retrieve latent codes of specific timestamps, or to be able to run through all latent codes in a temporal manner.