> For the complete documentation index, see [llms.txt](https://docs.tensorleap.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes.md).

# visualizer\_classes

code\_loader.contract.visualizer\_classes

A [visualizer function](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/decorators/tensorleap_custom_visualizer.md) returns one of these classes. Each class checks its fields when it is created and raises `LeapValidationError` if a type or shape is wrong. All of them are imported from `code_loader.contract.visualizer_classes`.

| Object to visualize                              | Leap object to use                                                                                                                              | How it is shown in the platform                                                                                                                                      |
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Grayscale/RGB image                              | [**LeapImage**](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leapimage.md)                       | [**Image**](https://docs.tensorleap.ai/user-interface/dashboards/dashlets/population-exploration/sample-visualization.md#image-visualizer)                           |
| Image overlaid with bounding boxes               | [**LeapImageWithBBox**](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leapimagewithbbox.md)       | [**Image with bounding boxes**](https://docs.tensorleap.ai/user-interface/dashboards/dashlets/population-exploration/sample-visualization.md#object-detection)       |
| Image overlaid with heatmaps                     | [**LeapImageWithHeatmap**](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leapimagewithheatmap.md) | -                                                                                                                                                                    |
| Semantic segmentation mask or other integer mask | [**LeapImageMask**](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leapimagemask.md)               | [**Image with mask**](https://docs.tensorleap.ai/user-interface/dashboards/dashlets/population-exploration/sample-visualization.md#semantic-segmentation-visualizer) |
| 1D signals                                       | [**LeapGraph**](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leapgraph.md)                       | [**Graph**](https://docs.tensorleap.ai/user-interface/dashboards/dashlets/population-exploration/sample-visualization.md#graph-visualizer)                           |
| Text                                             | [**LeapText**](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leaptext.md)                         | [**Text**](https://docs.tensorleap.ai/user-interface/dashboards/dashlets/population-exploration/sample-visualization.md#text-visualizer)                             |
| Token classification                             | [**LeapTextMask**](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leaptextmask.md)                 | [**Text Mask**](https://docs.tensorleap.ai/user-interface/dashboards/dashlets/population-exploration/sample-visualization.md#text-mask)                              |
| Histogram and logits                             | [**LeapHorizontalBar**](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leaphorizontalbar.md)       | [**Horizontal bar**](https://docs.tensorleap.ai/user-interface/dashboards/dashlets/population-exploration/sample-visualization.md#horizontal-bar-visualizer)         |
| Video                                            | [**LeapVideo**](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leapvideo.md)                       | -                                                                                                                                                                    |
| Audio, with a spectrogram or waveform            | [**LeapAudio**](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leapaudio.md)                       | -                                                                                                                                                                    |
| 3D points (LiDAR, depth) with optional 3D boxes  | [**LeapPointCloud**](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leappointcloud.md)             | -                                                                                                                                                                    |

{% hint style="warning" %}
**Image pixel ranges differ between classes.** `LeapImage`, `LeapImageWithBBox` and `LeapImageWithHeatmap` expect pixels in `[0, 255]`: float values are cast to integers, not scaled, so a `[0, 1]` float image shows almost black. `LeapImageMask` scales any range for display. `LeapVideo` expects float frames in `[0, 1]`. The local run warns when a range looks wrong.
{% endhint %}

### Showing a visualizer locally

`visualize` from `code_loader.plot_functions.visualize` plots any of these objects with matplotlib, e.g. inside the integration test:

```python
from code_loader.plot_functions.visualize import visualize

visualize(image_visualizer(image))
```

### Examples

Full examples can be found at the **Dataset Integration** section of the following guides:

* [**MNIST Guide**](https://docs.tensorleap.ai/guides/full-guides/mnist-guide.md)
* [**IMDB Guide**](https://docs.tensorleap.ai/guides/full-guides/imdb-guide.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
