-
Notifications
You must be signed in to change notification settings - Fork 31
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
How to provide mean & stddev to dali.fn.normalize #171
Comments
Hello @Vincouux , Thank you for reaching out. First thing I see is that you don't need to wrap the mean and stddev in the # Normalizing (images - mean) / std.
images = dali.fn.normalize(
images,
batch=False,
mean=[0.485, 0.456, 0.406],
stddev=[0.229, 0.224, 0.225]
) If this doesn't help, could you please post the error message, so I'd know more what's going on? |
Here is the error I am facing:
To give a bit more context, the input image is of shape [-1, -1, 3]. After the resize and the permutation, it should be [3, 224, 224] based on the above pipeline I provided. Many thanks @szalpal for you help !!! |
Generally, for image normalization it'd be better if you'd go for Therefore I'd advice you to use this instead of images = dali.fn.crop_mirror_normalize(images,
dtype=types.FLOAT,
output_layout="CHW",
crop=(224, 224),
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]) Should you have any more problems, don't hesitate to reach us out. Good luck in using DALI ;) Furthermore, if you'd like to squeeze even more perf from this snippet, I'd suggest, that you plug the mean=[0.485 * 255, 0.456 * 255, 0.406 * 255],
std=[0.229 * 255, 0.224 * 255, 0.225 * 255]) |
Hi all, I am super new to Dali Backend, but the benchmark I recently ran are incredible. I am trying to preprocess the data with Dali backend, but struggle with the "normalize" operation. I would like to specify a "per channel" mean & stddev ([c1, c2, c3] for example), but keep getting errors.
Here is what I've tried so far:
Here is the full code of my pipeline:
Many thanks !!
The text was updated successfully, but these errors were encountered: