fdbtrs / IDiff-Face

Official repository of the paper: IDiff-Face: Synthetic-based Face Recognition through Fizzy Identity-conditioned Diffusion Models (ICCV 2023)
64 stars 1 forks source link

The issue of correspondence between npy files and png files #12

Open LiuXiYing opened 6 months ago

LiuXiYing commented 6 months ago

Given that 70,000 images will be processed by the script to generate ONE npy file, how does the update_samples method match each png image?

Snipaste_2024-03-07_20-03-24

My data folder's directory structure is as follows:

Snipaste_2024-03-07_20-09-40

Here is the error message:

Snipaste_2024-03-07_20-11-31

The PNG image names are being replaced by the names of the npy files, which is incorrect.

LiuXiYing commented 6 months ago

The reason for the error has been found. It's because I used the wrong dataset file. I should have used "samples_with_embeddings_file_dataset.py", and of course, made some minor modifications to the configuration file. I want to give special thanks to @NeRF-Factory for the help here!

Value-Jack commented 6 months ago

i have the same problem too, could you tell me how to solve it? thank you so much!

Value-Jack commented 6 months ago

The reason for the error has been found. It's because I used the wrong dataset file. I should have used "samples_with_embeddings_file_dataset.py", and of course, made some minor modifications to the configuration file. I want to give special thanks to @NeRF-Factory for the help here!

could u please tell me how to solve this problem? thank you!

LiuXiYing commented 6 months ago

The reason for the error has been found. It's because I used the wrong dataset file. I should have used "samples_with_embeddings_file_dataset.py", and of course, made some minor modifications to the configuration file. I want to give special thanks to @NeRF-Factory for the help here!

could u please tell me how to solve this problem? thank you!

The default configuration file used in the author's code does not match the method of dataset loading. To run it, you can modify the configuration file to match the Python file used for loading the dataset.

gebaltso commented 2 months ago

The reason for the error has been found. It's because I used the wrong dataset file. I should have used "samples_with_embeddings_file_dataset.py", and of course, made some minor modifications to the configuration file. I want to give special thanks to @NeRF-Factory for the help here!

could u please tell me how to solve this problem? thank you!

The default configuration file used in the author's code does not match the method of dataset loading. To run it, you can modify the configuration file to match the Python file used for loading the dataset.

Could you please be more precise? I have the same problem but do not understand what I need to change and in which files.

In the train_config.yaml I chose:

 - model: unet_cond_ca_cpd25     
  - dataset: ffhq_folder 

In the ffhq_folder.yaml I have:

dataset:
  _target_: utils.samples_with_embeddings_folder_dataset.SamplesWithEmbeddingsFolderDataset
  samples_root: /home/gebaltso/IDiff-Face/data/ffhq_128/
  embeddings_root: /home/gebaltso/IDiff-Face/data/
  sample_file_ending: ".png"
  embedding_file_ending: ".npy"
  embedding_loader:
    _target_: utils.samples_with_embeddings_folder_dataset.NumpyEmbeddingLoader
  sample_loader:
    _target_: utils.samples_with_embeddings_folder_dataset.PILImageLoader
  sample_transform:
    _target_: torchvision.transforms.Compose
    transforms:
      - _target_: torchvision.transforms.Resize
        size:
        - ${constants.image_size}
        - ${constants.image_size}
      - _target_: torchvision.transforms.ToTensor
      - _target_: torchvision.transforms.RandomHorizontalFlip
        p: 0.5

And I have the embeddings_elasticface_ffhq_128.npy inside data folder and the structure of the folders in which I have the images is as below: Screenshot from 2024-07-11 15-29-44

The error I get:

 File "/home/gebaltso/IDiff-Face/utils/samples_with_embeddings_folder_dataset.py", line 18, in __call__
    with open(path, "rb") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/gebaltso/IDiff-Face/data/ffhq_128/embeddings_elasticface_ffhq_128.png'

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Should I change the samples_with_embeddings_folder_dataset with samples_with_embeddings_file_dataset all the three times in the ffhq_folder.yaml ? It doesn't work.

What should I do? Thanks in advance.