Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when running create_from_images.py #49

Open
LauKeer opened this issue Jan 18, 2022 · 2 comments
Open

Issue when running create_from_images.py #49

LauKeer opened this issue Jan 18, 2022 · 2 comments

Comments

@LauKeer
Copy link

LauKeer commented Jan 18, 2022

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
Copy link
Owner

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
Copy link
Author

LauKeer commented Jan 19, 2022

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.

@LauKeer LauKeer closed this as completed Jan 19, 2022
@LauKeer LauKeer reopened this Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants