Knowledgator UTCA
KnowledgatorGitHubDiscord
  • Welcome to UTCA documentation!
  • Quickstart
  • Concepts
    • Components
    • Types of components
    • ExecutionSchema
    • Context
    • Scopes
  • Development and Contribution
    • Contribution
    • Future relises
  • Framework structure
  • Core
    • Component
    • BaseExecutor
    • Action
    • Executable
    • Evaluator
    • Memory management
    • Schemas
    • Exceptions
  • Structural components
    • ExecutionSchema
    • Switch
    • ForEach
    • Filter
    • While
    • Condition
    • BREAK
    • Log
  • Base Actions
    • Flush
    • AddData
    • RenameAttribute
    • RenameAttributeQuery
    • SetValue
    • UnpackValue
    • NestToKey
    • ExecuteFunction
  • Predictors
    • Predictor
    • Transformers predictors
    • Transformers schemas
    • TokenSearcherPredictor
    • ComprehendItPredictor
    • GLiNERPredictor
    • OpenAIChatGPTPredictor
    • OpenAIWhisperPredictor
  • Tasks
    • Task
    • ComprehendIt
    • TokenSearcherTextCleaner
    • TokenSearcherNER
    • TokenSearcherQandA
    • TokenSearcherRelationExtraction
    • GLiNER
    • GLiNERRelationExtraction
    • GLiNERQandA
    • OpenAIChat
    • WhisperSpeechToText
    • TransformersTextToSpeech
    • TransformersChartsAndPlotsAnalysis
    • TransformersDocumentQandA
    • TransformersImageClassification
    • TransformersVisualQandA
    • TransformersObjectDetection
    • TransformersTextEmbedding
    • TransformersEntityLinking
    • TransformersTokenClassifier
    • TransformersTextSummarization
    • TransformersTextualQandA
    • TransformersTextClassification
    • TransformersChat
    • Objects
    • Chat tasks utilities
    • Relation extraction tasks utilities
  • Executable Schemas
    • SemanticSearchSchema
    • Web2Meaning
    • RequestsHTML
  • Datasources
    • Audio
    • DB
      • SQL
      • Neo4j
      • Chroma
      • Qdrant
    • Google Documents
    • Google Sheets
    • Image
    • Index
    • JSON
    • PDF
    • Plain text
    • Video
  • Conditions
    • RePattern
    • SemanticCondition
  • APIs
    • GoogleCloudClient
  • Integrations
    • Google Cloud
  • Examples
    • Basic image classification
    • Text to speech
    • PDF document processing
Powered by GitBook
On this page
  • Module: implementation.tasks
  • Default predictor
  • Methods and properties
  • __init__
  • TransformersImageClassificationInput
  • __init__
  • TransformersImageClassificationOutput
  • __init__
  • TransformersImageClassificationMultilabelOutput
  • __init__
  • ImageClassificationPreprocessor
  • __init__
  • execute
  • ImageClassificationSingleLabelPostprocessor
  • execute
  • ImageClassificationMultilabelPostprocessor
  • __init__
  • execute
  1. Tasks

TransformersImageClassification

Basic image classification task

PreviousTransformersDocumentQandANextTransformersVisualQandA

Last updated 1 year ago

Subclass of .

Module: .tasks

Default predictor

This task uses by default with this configuration:

model = AutoModelForImageClassification.from_pretrained(
    "facebook/deit-base-distilled-patch16-384"
)
predictor=TransformersModel(
    TransformersModelConfig(
        model=model
    ),
    input_class=TransformersImageModelInput,
    output_class=TransformersLogitsOutput,
)

See:

Methods and properties

Main methods and properties


__init__

Arguments:

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.




TransformersImageClassificationInput


__init__

Arguments:

  • image (Image.Image): Image to process.




TransformersImageClassificationOutput


__init__

Arguments:

  • label (Optional[Tuple[str, float]]): Classified label and score.




TransformersImageClassificationMultilabelOutput


__init__

Arguments:

  • labels (Dict[str, float]): Classified labels and scores.




ImageClassificationPreprocessor


__init__

Arguments:

  • processor (Processor): Feature extractor.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "image" (Image.Image): Image to analyze;

Returns:

  • Dict[str, Any]: Expected keys:

    • "pixel_values" (Any);




ImageClassificationSingleLabelPostprocessor


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "logits" (Any): Model output;

Returns:

  • Dict[str, Any]: Expected keys:

    • "label" (Optional[Tuple[str, float]]): Label with highest score, if score higher or equal to threshold, else - None.




ImageClassificationMultilabelPostprocessor


__init__

Arguments:

  • labels (Mapping[Any, str]): Labels for classification.

  • threshold (float): Labels threshold score. Defaults to 0.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "logits" (Any): Model output;

Returns:

  • Dict[str, Any]: Expected keys:

    • "labels" (Dict[str, float]): Classified labels and scores.



predictor ([Any, Any], optional): Predictor that will be used in task. If equals to None, will be used. Defaults to None.

preprocess (Optional[], optional): Component executed before predictor. If equals to None, default component will be used. Defaults to None. Default component: | If default chain is used, will use AutoImageProcessor from model used in predictor.

postprocess (Optional[], optional): Component executed after predictor. If equals to None, default component will be used. Defaults to None. Default component: If default chain is used, will use labels from model used in predictor.

input_class (Type[], optional): Class for input validation. Defaults to .

output_class (Type[], optional): Class for output validation. Defaults to .

Subclass of .

Subclass of .

Subclass of .

Prepare model input. Subclass of . Type of [Dict[str, Any], Dict[str, Any]].

Process model output. Subclass of .

Process model output. Subclass of . Type of [Dict[str, Any], Dict[str, Any]].

Action
Action
Action
Action
Predictor
default predictor
Component
ImageClassificationSingleLabelPostprocessor
ImageClassificationSingleLabelPostprocessor
ImageClassificationMultilabelPostprocessor
Task
Component
ImageClassificationPreprocessor
ImageClassificationPreprocessor
TransformersImageClassificationInput
TransformersImageClassificationOutput
TransformersModel
TransformersModel
TransformersModelConfig
TransformersImageClassificationModelInput
TransformersLogitsOutput
implementation
ImagePad
Input
Output
IOModel
IOModel
IOModel