Skip to main content

Converting tabular data into images

Project description

TINTOlib: Python Library to convert Tabular Data into Synthetic Images

GitHub Pages License Python Version Documentation Status Open In Colab-CNN Open In Colab-CNN+MLP Open In Colab-ViT Open In Colab-ViT+MLP Ask DeepWiki PyPI Downloads


TINTO Logo

📊 Benchmarks & Results

  • Explore detailed benchmark results, model comparisons, and performance tables for TINTOlib on various datasets.
  • 👉 See the latest benchmarks: TINTOlib Benchmarks (GitHub Pages)

🎉 New Free Course on Udemy! (Spanish) 🎉

We’ve just launched a 100% free course on Udemy about using TINTOlib and developing Hybrid Neural Networks.

Learn how to turn tabular data into synthetic images and apply CNNs, ViTs, and hybrid architectures like a pro.

Access the Course on Udemy


🎬 TINTOlib — Overview Video (English)

https://github.com/user-attachments/assets/96e63eb4-2e06-4eb9-9f72-e1f530ffad37


📺 VideoTutorial Course (English/Spanish)

🎥 Prefer not to register on Udemy or looking for the English version of the course? No worries — you can follow the full course directly on GitHub!

This hands-on tutorial includes bilingual videos (English/Spanish) and practical notebooks to help you learn how to use TINTOlib with deep learning models like CNNs, ViTs, and hybrid architectures.

Access the Course on GitHub


🧠 Overview

TINTOlib is a state-of-the-art Python library that transforms tidy data (also known as tabular data) into synthetic images, enabling the application of advanced deep learning techniques, including Vision Transformers (ViTs) and Convolutional Neural Networks (CNNs), to traditionally structured data. This transformation bridges the gap between tabular data and powerful vision-based machine learning models, unlocking new possibilities for tackling regression, classification, and other complex tasks.


📚 Features

  • Input formats: CSV or Pandas DataFrame
  • Designed for tidy data (target column last)
  • Output: grayscale images from reduction and transformation methods
  • Compatible with Linux, Windows, macOS
  • Requires Python 3.8+

🧪 Methods

TINTOlib includes a variety of methods for generating synthetic images. Below is a summary of the supported methods and their hyperparameters:

Methods Class Hyperparameters
TINTO TINTO() problem transformer verbose pixels algorithm blur submatrix amplification distance steps option times train_m zoom format cmap random_seed
IGTD IGTD() problem transformer verbose scale fea_dist_method image_dist_method error max_step val_step switch_t min_gain zoom format cmap random_seed
REFINED REFINED() problem transformer verbose hcIterations n_processors zoom format cmap random_seed
BarGraph BarGraph() problem transformer verbose pixel_width gap zoom
DistanceMatrix DistanceMatrix() problem transformer verbose zoom
Combination Combination() problem transformer verbose zoom
SuperTML SuperTML() problem transformer verbose pixels feature_importance font_size random_seed
FeatureWrap FeatureWrap() problem transformer verbose size bins zoom
BIE BIE() problem transformer verbose precision zoom
Fotomics Fotomic() image_dim problem transformer verbose outliers min_percentile max_percentile outliers_treatment assignment_method relocate algorithm_opt group_method zoom format cmap random_seed
DeepInsight DeepInsight() image_dim problem transformer verbose assignment_method relocate algorithm_opt group_method zoom format cmap random_seed

⚠️ Platform-Specific Requirements for Certain Transformation Methods

Some transformation methods in TINTOlib have specific system requirements or limitations when used on platforms such as Google Colab, Windows, Linux, or macOS.

REFINED

This method relies on mpi4py, which enables parallel computation using MPI (Message Passing Interface). However, mpi4py requires administrative permissions to utilize multiple processors, making it incompatible with platforms like Google Colab.

  • Linux: Ensure that the MPI environment is set up before installing mpi4py. Run the following commands:

      sudo apt-get install python3
      sudo apt install python3-pip
      sudo apt install python3-mpi4py
    

    Once MPI is installed:

      pip install mpi4py
    
  • MacOS / Windows: Direct installation is usually supported:

      pip install mpi4py
    

SuperTML

The SuperTML method generates text-based synthetic images and requires the MS Sans Serif font.

  • On Windows, this font is typically available by default.
  • On Linux and macOS, it must be installed manually to avoid rendering issues.

Font Installation

  • Linux: Install Microsoft Core Fonts:

      sudo apt install ttf-mscorefonts-installer
    

On Google Colab, installing additional fonts is not permitted due to administrative restrictions.

📄 Getting Started

  • You can install TINTOlib using Pypi:
      pip install TINTOlib
    

TINTOlib already includes all necessary dependencies, so there’s no need to install them individually.

However, if you prefer manual installation or want to explore the full environment:

  • The repository includes a requirements.txt file listing the core dependencies required to use TINTOlib. You can directly run the TINTOlib-example.ipynb notebook located in the examples/ folder using the dependencies listed in requirements.txt.
  • mpi4py is only required if you use the REFINED method; see the platform-specific notes.
  • Other notebooks, which include training deep learning models on the generated images, require additional libraries. To run them, install the extended dependencies from requirements-example.txt:

🧩 Importing a Specific Model

  • To use a specific image transformation model, import it directly. For example, to use TINTO:

      from TINTOlib.tinto import TINTO
    
  • To import a specific model use:

      from TINTOlib.tinto import TINTO
    
  • Create the model. If you don't set any hyperparameter, the model will use the default values, refer to the Models Section or the TINTO Documentation.

      model = TINTO(problem="supervised", blur=True)
    

🔧 Generating Synthetic Images

To generate synthetic images, use the following workflow with the fit, transform, and fit_transform methods:

Parameters:

  • data: A path to a CSV file or a Pandas DataFrame (target column must be the last column).
  • folder: Path to the folder where the synthetic images will be saved.

Sintaxis

  1. The fit method trains the model on the tabular data and prepares it for image generation.

      model.fit(data)
    
  2. The transform method generates and saves synthetic images in a specified folder. It requires the model to be fitted first.

      model.transform(data, folder)
    
  3. The fit_transform method combines the training and image generation steps. It fits the model to the data and generates synthetic images in one step.

  model.fit_transform(data, folder)

Notes:

  • The model must be fitted before using the transform method. If the model isn't fitted, a RuntimeError will be raised.

Iris dataset Example

To get started with TINTOlib, a dedicated Crash Course Repository is available. It includes videoturials, slides and Jupyter Notebooks that demonstrate how to apply state-of-the-art vision models like Vision Transformers (ViTs), Convolutional Neural Networks (CNNs) and Hybrid Neural Networks to problems.

For example, the following table shows a classic example of the IRIS CSV dataset as it should look like for the run:

sepal length sepal width petal length petal width target
4.9 3.0 1.4 0.2 1
7.0 3.2 4.7 1.4 2
6.3 3.3 6.0 2.5 3
  • The following example shows how to execute TINTOlib using the TINTO method and then display the synthetic image generated for the first row:

      model = TINTO(problem="supervised", pixels=30, algorithm="t-SNE", steps=5, blur=True)
      model.fit_transform("iris.csv", "synthetic_images")
    

TINTO blurring


🚀 Vision-based Neural Network Architectures

Using synthetic images, experiment with either vision models like CNNs or ViTs, and explore hybrid models. Below are the architectures that will be presented, and the ones you will modify and use during the session:

  • Synthetic images using CNN
    Tabular-to-Image CNN

  • Synthetic images using Hybrid Neural Network with ViT (HyViT)
    Tabular-to-Image HyNNViT


💬 More information


📖 Citation

If you use TINTOlib in your research, please cite our papers:

  @article{LIU2025102444,
    title = {TINTOlib: A Python library for transforming tabular data into synthetic images for deep neural networks},
    journal = {SoftwareX},
    volume = {32},
    pages = {102444},
    year = {2025},
    issn = {2352-7110},
    doi = {https://doi.org/10.1016/j.softx.2025.102444}
  }
@article{LIU2026104088,
    title = {A comprehensive benchmark of spatial encoding methods for tabular data with deep neural networks},
    journal = {Information Fusion},
    volume = {130},
    pages = {104088},
    year = {2026},
    doi = {10.1016/j.inffus.2025.104088}
  }

🛡️ License

TINTOlib is available under the Apache License 2.0.


👥 Authors


🏛️ Contributors

Ontology Engineering Group Universidad Politécnica de Madrid Universidad Nacional de Educación a Distancia Universidad de Castilla-La Mancha

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tintolib-1.1.0.tar.gz (50.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tintolib-1.1.0-py3-none-any.whl (69.0 kB view details)

Uploaded Python 3

File details

Details for the file tintolib-1.1.0.tar.gz.

File metadata

  • Download URL: tintolib-1.1.0.tar.gz
  • Upload date:
  • Size: 50.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.21

File hashes

Hashes for tintolib-1.1.0.tar.gz
Algorithm Hash digest
SHA256 1f973ae856d88272977b7df978cc2624cb8f9b3ec6e84558f58580e920a3ade8
MD5 d5544e84efcd4be9174ee9041a8cfdf1
BLAKE2b-256 9e0c268141d14eaccdbb4214cfc12dff06f3575672fc65210b66ee225f1bd7c0

See more details on using hashes here.

File details

Details for the file tintolib-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: tintolib-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 69.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.21

File hashes

Hashes for tintolib-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ca697abc845262585e28a155c54e74aa97272016fe1d37ae39699c9a6cc997d
MD5 c74bdb227fabc7d61bd40c81a1674c58
BLAKE2b-256 783d27edf2c1aa28a2da106e65a5d166834091b78e4ed6b8831c5a82512f884c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page