Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

What exactly does preprocessing_fn in smp.encoders do ? #980

Unanswered
StepanVL asked this question in Q&A
Discussion options

I am training my model on image crops of size 384x384 pixels.
Ideally, the full image should be passed through albumentations, including color normalization on a whole image. Then the preprocessing_fn should (or should not be applied). Then passed to training.
For inference, full image is taken, color norm and resizing is done, preprocessing_fn should (or should not be applied) is passed to the model for inference.
Do I need to use preprocessing_fn during training or during inference? I want to aviod an inconcistency that happens that color is normalized (or something else happens) on a crop during training, but on the full image during inference.

It seems that preprocessing_fn does the same as

color_norm = Compose([Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], )])
sample = color_norm(image=image)
color_norm_image = sample['image']

You must be logged in to vote

Replies: 1 comment

Comment options

Hi @StepanVL! Thanks for the question! You can ignore preprocessing_fn for inference in case it was not used during training. It is usually just image normalization, but the same operation also can be done by any 3rd party library such as albumentations.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.