How to use it as a feature extractor
See original GitHub issueHi,
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:
- Created 4 years ago
- Reactions:2
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@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).@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 domodel.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.