zsyzzsoft / co-mod-gan

[ICLR 2021, Spotlight] Large Scale Image Completion via Co-Modulated Generative Adversarial Networks
Other
445 stars 67 forks source link

Issue when running create_from_images.py #49

Open LauKeer opened 2 years ago

LauKeer commented 2 years ago

Hi all, I attempted to train a custom dataset and run create_from_images.py.

And I met with the error when running create_from_images.py, here is the code:

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--C:/Users/xxxx/PycharmProjects/co-mod-gan/generated_TFRecord', help='Output directory of generated TFRecord', required=True)
    parser.add_argument('--D:/xxxx/co-mod-gan/validation_set', help='Root directory of validation images', default=None)
    parser.add_argument('--D:/xxxx/co-mod-gan/training_set', help='Root directory of training images', default=None)
    parser.add_argument('--resolution', help='Target resolution', type=int, default=512)
    parser.add_argument('--num-channels', help='Number of channels of images', type=int, default=3)
    parser.add_argument('--num-processes', help='Number of parallel processes', type=int, default=8)
    parser.add_argument('--shuffle', default=False, action='store_true')
    parser.add_argument('--compressed', default=False, action='store_true')
    parser.add_argument('--pix2pix', default=False, action='store_true')

    args = parser.parse_args()
    create_from_images(**vars(args))

if __name__ == "__main__":
    main()

It is giving error:

usage: create_from_images.py [-h]
                             --C:\Users\xxxx\PycharmProjects\co-mod-gan\generated_TFRecord
                             C:\USERS\xxxx\PYCHARMPROJECTS\CO_MOD_GAN\GENERATED_TFRECORD
                             [--D:\xxxx\co-mod-gan\validation_set D:\FYP\CO_MOD_GAN\VALIDATION_SET]
                             [--D:\xxxx\co-mod-gan\training_set D:\FYP\CO_MOD_GAN\TRAINING_SET]
                             [--resolution RESOLUTION]
                             [--num-channels NUM_CHANNELS]
                             [--num-processes NUM_PROCESSES] [--shuffle]
                             [--compressed] [--pix2pix]
create_from_images.py: error: the following arguments are required: --C:\Users\xxxx\PycharmProjects\co-mod-gan\generated_TFRecord

And if -- deleted,

    parser.add_argument('C:/Users/xxxx/PycharmProjects/co-mod-gan/generated_TFRecord', help='Output directory of generated TFRecord', required=True)
    parser.add_argument('D:/xxxx/co-mod-gan/validation_set', help='Root directory of validation images', default=None)
    parser.add_argument('D:/xxxx/co-mod-gan/training_set', help='Root directory of training images', default=None)

Another error occurs:

Traceback (most recent call last):
  File "C:/Users/xxxx/PycharmProjects/co-mod-gan/dataset_tools/create_from_images.py", line 101, in <module>
    main()
  File "C:/Users/xxxx/PycharmProjects/co-mod-gan/dataset_tools/create_from_images.py", line 86, in main
    parser.add_argument('C:/Users/keker/PycharmProjects/co-mod-gan/generated_TFRecord', help='Output directory of generated TFRecord', required=True)
  File "C:\ProgramData\Anaconda3\envs\co-mod-gan\lib\argparse.py", line 1320, in add_argument
    kwargs = self._get_positional_kwargs(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\co-mod-gan\lib\argparse.py", line 1432, in _get_positional_kwargs
    raise TypeError(msg)
TypeError: 'required' is an invalid argument for positionals

Would you please help me point what am I doing wrong here? Thank you very much.

I'm new to programming and really appreciate any of your help :)

zsyzzsoft commented 2 years ago

You do not need to modify the code. Just python create_from_images.py --tfrecord-dir=xxx and the same for other arguments would work.

LauKeer commented 2 years ago

You do not need to modify the code. Just python create_from_images.py --tfrecord-dir=xxx and the same for other arguments would work.

I really appreciate for your amazing work. Thank you soooo much! I am sorry for the silly question.