> For the complete documentation index, see [llms.txt](https://utca.knowledgator.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utca.knowledgator.com/examples/basic-image-classification.md).

# Basic image classification

This example shows pipeline for basic image classification

Coplete source code for example can be found in **programs.image\_processing.basic\_image\_classification**.

## Imports that will be used

<pre class="language-python"><code class="lang-python">import pathlib
PATH = pathlib.Path(__file__).parent.resolve()

<strong>from utca.implementation.tasks import TransformersImageClassification
</strong>from utca.implementation.datasources.image import ImageRead
</code></pre>

## Pipeline

```python
pipeline = (
    ImageRead() | TransformersImageClassification()
)
```

[**ImageRead**](/datasources/image.md#imageread) is used to open image file.

For image classification used [**TransformersImageClassification**](/tasks/transformersimageclassification.md).

For more, see:

{% content-ref url="/pages/pZqZi3KFmV4BEtxmZAJI" %}
[Image](/datasources/image.md)
{% endcontent-ref %}

{% content-ref url="/pages/CpOgJaCXqMT0X1AYQb7f" %}
[TransformersImageClassification](/tasks/transformersimageclassification.md)
{% endcontent-ref %}

## Run program

```python
result = pipeline.run({
    "path_to_file": f"{PATH}/test.jpg"
})
```

### Inputs

* **"path\_to\_file":** path that directs to a file that should be in **programs.image\_processing.basic\_image\_classification.** This is an image of German Shepherd Dog.

### Results

The results should look like this:

{% code overflow="wrap" %}

```python
{
    'path_to_file': '{PATH}/programs/image_processing/basic_image_classification/test.jpg',
    'image': <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=1080x1080 at 0x7D6189900B80>, 
    'label': (
        'German shepherd, German shepherd dog, German police dog, alsatian',
        0.9983240962028503
    )
}
```

{% endcode %}
