simet.parser.feature_extractor¶
simet.parser.feature_extractor ¶
FeatureExtractorParser ¶
Factory wrapper that builds feature extractors from config dicts.
Converts a user/config value (e.g., from YAML/JSON) into a
:class:FeatureExtractorType and delegates construction to
:meth:FeatureExtractorType.get_feature_extractor.
parse_feature_extractor
staticmethod
¶
parse_feature_extractor(feature_extractor_data)
Parse config and return a concrete feature extractor instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_extractor_data
|
dict
|
Mapping that must include the key |
required |
Returns:
| Name | Type | Description |
|---|---|---|
FeatureExtractor |
FeatureExtractor
|
An instance of the requested extractor |
FeatureExtractor
|
(currently :class: |
Raises:
| Type | Description |
|---|---|
KeyError
|
If |
ValueError
|
If the |
Example
cfg = {"type": "InceptionFeatureExtractor"} fe = FeatureExtractorParser.parse_feature_extractor(cfg) fe.class.name 'InceptionFeatureExtractor'
Source code in simet/parser/feature_extractor.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
FeatureExtractorType ¶
Bases: StrEnum
Enum of supported feature extractor identifiers (string-valued).
get_feature_extractor
staticmethod
¶
get_feature_extractor(feature_extractor_type)
Construct a feature extractor for the given enum value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_extractor_type
|
FeatureExtractorType
|
Enum member indicating which extractor to instantiate. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
FeatureExtractor |
FeatureExtractor
|
Concrete extractor instance. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the type is unknown (logged and re-raised). |
Notes
- Extend this
matchwith additional cases as new extractors are added.
Source code in simet/parser/feature_extractor.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |