dvschultz / stylegan2

StyleGAN2 fork with some bonus content
http://arxiv.org/abs/1912.04958
Other
63 stars 55 forks source link

StyleGan2 Augmentation Error #11

Closed rehanpunjwani closed 4 years ago

rehanpunjwani commented 4 years ago

Hey. I successfully trained some images using your StyleGAN2 collab repo but when I tried the same with Style GAN2 Augmentation notebook it gives me the following error


Traceback (most recent call last):
  File "run_training.py", line 223, in <module>
    main()
  File "run_training.py", line 218, in main
    run(**vars(args))
  File "run_training.py", line 140, in run
    dnnlib.submit_run(**kwargs)
  File "/content/drive/My Drive/stylegan2-aug-colab/stylegan2/dnnlib/submission/submit.py", line 343, in submit_run
    return farm.submit(submit_config, host_run_dir)
  File "/content/drive/My Drive/stylegan2-aug-colab/stylegan2/dnnlib/submission/internal/local.py", line 22, in submit
    return run_wrapper(submit_config)
  File "/content/drive/My Drive/stylegan2-aug-colab/stylegan2/dnnlib/submission/submit.py", line 280, in run_wrapper
    run_func_obj(**submit_config.run_func_kwargs)
  File "/content/drive/My Drive/stylegan2-aug-colab/stylegan2/training/training_loop.py", line 157, in training_loop
    training_set = dataset.load_dataset(data_dir=dnnlib.convert_path(data_dir), verbose=True, **dataset_args)
  File "/content/drive/My Drive/stylegan2-aug-colab/stylegan2/training/dataset.py", line 239, in load_dataset
    dataset = dnnlib.util.get_obj_by_name(class_name)(**adjusted_kwargs)
  File "/content/drive/My Drive/stylegan2-aug-colab/stylegan2/training/dataset.py", line 113, in __init__
    tfr_shapes.append(parse_tfrecord_np_raw(record))
  File "/content/drive/My Drive/stylegan2-aug-colab/stylegan2/training/dataset.py", line 56, in parse_tfrecord_np_raw
    0
IndexError: list index (0) out of range

My dataset images are 1024x1024 and I am running the following command. I think I have some problem in preprocessing of the dataset.

!AUG_PROB=0.2 python run_training.py --num-gpus=1 --mirror-augment=True --data-dir="/content/drive/My Drive/stylegan2-aug-colab/stylegan2/datasets" --dataset=gan_data --config=config-f --res-log=8 --min-h=4 --min-w=4 --resume-pkl=$pkl --resume-kimg=$resume_kimg --augmentations=True --metrics=None

Can anyone help me what I'm doing wrong?

dvschultz commented 4 years ago

HI, can you try a relative path for the data-dir? It’s possible that the My Drive isn’t be escaped properly in the library.

ahlaw commented 4 years ago

I had the same issue and figured out the problem. The new branch uses parse_tfrecord_np_raw in training/dataset.py, so you will have to use create_from_images_raw instead of create_from_images when using dataset_tool.py.

rehanpunjwani commented 4 years ago

Thank @ahlaw , it worked!