pliers.extractors.ClarifaiAPIImageExtractor¶
- class pliers.extractors.ClarifaiAPIImageExtractor(access_token=None, user_id=None, app_id=None, model='general-image-recognition', min_value=None, max_concepts=None, select_concepts=None, rate_limit=None, batch_size=None)[source]¶
Bases:
ClarifaiAPIExtractor
,BatchTransformerMixin
,ImageExtractor
Uses the Clarifai API to extract tags of images.
- Parameters
api_key (str) – A valid API_KEY for the Clarifai API. Only needs to be passed the first time the extractor is initialized.
model (str) – The name of the Clarifai model to use. If None, defaults to the general image tagger.
min_value (float) – A value between 0.0 and 1.0 indicating the minimum confidence required to return a prediction. Defaults to 0.0.
max_concepts (int) – A value between 0 and 200 indicating the maximum number of label predictions returned.
select_concepts (list) – List of concepts (strings) to query from the API. For example, [‘food’, ‘animal’].
rate_limit (int) – The minimum number of seconds required between transform calls on this Transformer.
batch_size (int) – Number of stims to send per batched API request.
- __init__(access_token=None, user_id=None, app_id=None, model='general-image-recognition', min_value=None, max_concepts=None, select_concepts=None, rate_limit=None, batch_size=None)[source]¶
- transform(stim, *args, **kwargs)¶
Executes the transformation on the passed stim(s).
- Parameters
One or more stimuli to process. Must be one of:
A string giving the path to a file that can be read in as a Stim (e.g., a .txt file, .jpg image, etc.)
A Stim instance of any type.
An iterable of stims, where each element is either a string or a Stim.
validation (str) –
String specifying how validation errors should be handled. Must be one of:
’strict’: Raise an exception on any validation error
’warn’: Issue a warning for all validation errors
’loose’: Silently ignore all validation errors
args – Optional positional arguments to pass onto the internal _transform call.
kwargs – Optional positional arguments to pass onto the internal _transform call.