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.

How to use it as a feature extractor

See original GitHub issue

Hi,

Is it possible to use this efficientnet implementation as a feature extractor? If so how should it be done?

Thanks in advance

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
rwightmancommented, Nov 5, 2019

@jgmontoya … oh, yeah, if you just want the features prior to the linear, yeah, something like that will work, I assumed you were thinking about features at different resolutions for segmentation, etc.

You can do geffnet.efficientnet_b0(pretrained=True, as_sequential=True)[:-2] to have the flattened output before linear/droput, [:-1] to include dropout, [:-4] if you want to retain the last spatial feature map (before global pooling and flatten).

2reactions
rwightmancommented, May 21, 2020

@gaceladri I didn’t add the argument to the factory method in timm, effdet was being used more by fastai projects so that’s why it was added there, wasn’t clear anyone wanted that feature in timm. However, the EfficientNet models in both locations have .as_sequential() method that you can call after you create the model.

So, you can m = timm.create_model('efficientnet_b2a', pretrained=use_pretrained).as_sequential()

Another feature in timm, for all models you can just do model.forward_features(input) and you’ll get an unpooled feature output. In the future it’ll be possible to create any model with num_classes=0 or call .reset(0) on the model after creating and get pooled featured outputs by default from the normal forward() method.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Extraction Techniques - Towards Data Science
Feature Extraction aims to reduce the number of features in a dataset by creating new features from the existing ones (and then discarding...
Read more >
What is Feature Extraction? Feature Extraction in Image ...
The technique of extracting the features is useful when you have a large data set and need to reduce the number of resources...
Read more >
Feature Extraction - MATLAB & Simulink - MathWorks
Feature extraction refers to the process of transforming raw data into numerical features that can be processed while preserving the information in the ......
Read more >
Feature extraction - Wikipedia
In machine learning, pattern recognition, and image processing, feature extraction starts from an initial set of measured data and builds derived values ...
Read more >
6.2. Feature extraction — scikit-learn 1.2.0 documentation
Feature extraction is very different from Feature selection: the former consists in transforming arbitrary data, such as text or images, into numerical features ......
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