question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

about preprocessing

See original GitHub issue

Hi, I am wondering that what “sm.get_preprocessing” actually do. For example, assume we are using BACKBONE = 'resnet34' preprocess_input = sm.get_preprocessing(BACKBONE) I trace the code back to line 385 (somewhere near it) in “/my_virtual_environment/lib/python3.6/site-packages/classification_models/models/resnet.py”. And it occurs to me that the preprocess function appears as : def preprocess_input(x, **kwargs): return x. It means that the preprocess_input = sm.get_preprocessing(BACKBONE) did actually nothing. I am not so sure if it is the truth. But here is my question. If it actually works like I say aboved, it is really necessary to give detailed introduction of the preprocessing functions which were used when pretraing the networks on imagenet. And it is important that we know the scaling of the inputs ([0-255] or [-1,1] or others). Hope you can help me. Your work is excellent.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
JordanMakesMapscommented, Dec 19, 2019

It’s because Resnet (the original backbone that was trained on ImageNet) didn’t have any pre-processing/scaling. So in this case, preprocess_input(backbone = 'resnet34'), really doesn’t do anything. But for other backbones the pre-processing/scaling might be between [0, 255], [-1, 1], [0, 1], or some subtraction of the mean pixel value.

It is important to pre-process the images if you’re using imagenet weights with the backbone of your choice. For example, If you use VGG w/ imagenet weights, it is expecting some range of values of the images it is given. If you all the sudden provide it with a different range of values, it’s not going to do well at all. I believe that if you’re training some backbone from scratch, then you can use whatever pre-processing methods you want. But again, if using imagenet weights you should do what the original author of the code/architecture did to get the best results.

3reactions
qubvelcommented, Aug 26, 2020

Use get_preprocessing and preprosessing_fn for your data is your responsibility (see examples)

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is Data Preprocessing & What Are The Steps Involved?
Data preprocessing is a step in the data mining and data analysis process that takes raw data and transforms it into a format...
Read more >
Data Preprocessing in Data Mining - GeeksforGeeks
Data preprocessing is a data mining technique which is used to transform the raw data in a useful and efficient format.
Read more >
Data pre-processing - Wikipedia
Data preprocessing can refer to manipulation or dropping of data before it is used in order to ensure or enhance performance, and is...
Read more >
Data Preprocessing in Data Mining -A Hands On Guide
Data preprocessing is the process of transforming raw data into an understandable format. It is also an important step in data mining.
Read more >
What is Data Preprocessing? - Definition from Techopedia
Preprocessing involves both data validation and data imputation. The goal of data validation is to assess whether the data in question is both ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found