-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Verification of string arguments in datasets? #1132
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
Comments
I think the split names depend on the dataset. For example, Some consistency might be good, but not at the expense of generality. |
My mistake for choosing these examples with varying argument names, but that is not what I meant. I don't want to generalize the values of the def verify_str_arg(value, valid_values, arg):
if not isinstance(value, str):
raise ...
if value not in valid_values:
raise ...
return value With that all error messages would be the same across datasets. For the examples this would result in split = verify_str_arg(split, ("train", "valid", "test", "all"), "split") mode = verify_str_arg(mode, ("segmentation", "boundaries"), "mode") image_set = verify_str_arg(image_set, ("train", "trainval", "val"), "image_set") |
Oh, that's definitely something that we would want to have! I completely misunderstood your point. |
Closed by #1167 |
In the spirit of standardizing the datasets (#1080), I think it would be a good idea to have something like a
verify_str_arg()
function that checks whether if a given argument is astr
(or a valid subclass) and if hat has a valid value. Right now we have a multitude of slightly different variants:vision/torchvision/datasets/celeba.py
Lines 76 to 86 in bbd363c
vision/torchvision/datasets/sbd.py
Lines 68 to 69 in bbd363c
vision/torchvision/datasets/voc.py
Lines 103 to 106 in bbd363c
Is this something we want to do?
The text was updated successfully, but these errors were encountered: