Generative AI and Explainable AI with OpenVINO

Paula Ramos, PhD.
OpenVINO-toolkit
Published in
6 min readFeb 17, 2023
Adding a sunset with Generative AI + OpenVINO 😎

In recent years, artificial intelligence (AI) has seen unprecedented growth in popularity and has become a cornerstone technology in many areas of our life, including medicine, retail, and finance. However, as AI has become more sophisticated in recent times, two major trends have emerged: the utilization of generative AI to be able to create new content and the focus on AI to be more explainable to justify its decision-making processes.

In this blog, we will talk about general concepts of Generative AI, Explainable AI and how we can explore potential applications using OpenVINO.

First, Let’s talk about Generative AI with OpenVINO.

Generative AI with OpenVINO

Generative AI is a technique that creates new data or content using artificial intelligence models, and it is an exciting field of research with many potential applications. OpenVINO, an Intel toolkit for optimizing neural network models and deployment on Intel hardware, can be used to accelerate the training and inference of generative AI models, allowing for faster experimentation and iteration.

One potential use case for generative AI with OpenVINO is the creation of synthetic data for training machine learning models in a faster way. By generating new data using AI models, it is possible to expand the size and diversity of training sets, which can help to improve the accuracy and robustness of the resulting models.

To get started with generative AI using OpenVINO, you can explore some of the Tutorials we have in OpenVINO Notebooks, where we have a series of comprehensive notebooks demonstrating how to use the OpenVINO toolkit to optimize and accelerate deep learning models for image, audio, and video processing tasks. By following the step-by-step instructions in the notebooks shared in this blog, you will learn how to apply the latest Generative AI techniques to your own projects and deliver high-performance AI applications that deliver real-world value.

I want to bring two examples that you can explore with OpenVINO Notebooks. Remember the APPs showing you as a gladiator or goddess of Olympus? So, you can use those notebooks to make the same.

1. Stable Diffusion

If I need to define Stable Diffusion in short words, I will say: It is a way that AI can learn how to do things better over time by imagining small particles in an original image. So, by adding a random noise signal to an original image, the algorithm will gradually refine it using a series of diffusion steps. This process is repeated many times until we get a realistic image. This is moving the state-of-the-art of artists and photographers, but it also impacts the industry because it can be applied to generating large amounts of high-quality training data. I found this fascinating 😊.

Stable diffusion result, text-guided Image-to-Image result. Prompt: “amazing watercolor painting”
Stable diffusion in action. Adding random noise in 45 steps.

You can try stable diffusion in OpenVINO Notebooks, and you can see two different approaches: i) generation to create images from a text description as input (Text-to-image) and ii) generation to create images using text description and initial image semantic (Text-guided Image-to-Image). That means with your input image and text, stable diffusion will create a new image for you.

See the notebook here: https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/stable-diffusion-text-to-image/stable-diffusion-text-to-image.ipynb

Using OpenVINO, you can see how the hardware acceleration will increase the performance of this model and provide you the flexibility to run it in multiple Intel hardware, such as CPUs, GPUs, VPUs, and FPGAs.

2. InstructPix2Pix

Pix2Pix is a generative adversarial network (GAN) used for image-to-image translation tasks—the principal idea behind this AI technique is to train a deep neural network mapping two different images.

On the other hand, InstructPix2Pix is a technique for editing images from human instructions. We could call it an evolution of Stable diffusion. Its creators combined two pre-trained models, GPT-3 and Stable diffusion, to create a large dataset of image editing examples. This model edits images quickly and using OpenVINO, it will be even faster.

InstructPix2Pix result. I love that AI makes me thinner. 😊.

See the notebook here:
https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/instruct-pix2pix-image-editing/instruct-pix2pix-image-editing.ipynb

Explainable AI with OpenVINO

Explainable AI is an important aspect of building trustworthy and ethical AI systems. Explainable AI involves developing models and algorithms that can provide insights into an AI system's reasoning and decision-making processes, making it more transparent and interpretable to users. One of the examples of Explainable AI was created by OpenAI in 2021, and I am talking about CLIP (Contrastive Language-Image Pre-Training,). CLIP can relate to explainable AI because it has been designed to be more interpretable than some deep learning models. Interpretability is an important aspect of explainable AI, as it refers to the ability to understand how and why an AI model is making a particular decision or prediction. To learn more about CLIP, use this link.

CLIP has been designed to be more interpretable by using a “zero-shot” approach to image classification. This means the model can classify images into categories it has never seen before based solely on natural language descriptions of those categories. This allows humans to understand how the model makes its predictions because it effectively uses the same semantic knowledge humans use to understand language.

Result of CLIP zero-shot OpenVINO Notebook.

The question is, how do we get started with explainable AI with OpenVINO?

One way to build explainable AI with OpenVINO is to use interpretability techniques such as saliency maps, highlighting the most important features or regions of an image or input the model uses for making decisions. These maps can help users understand how the model is arriving at its predictions and can be particularly useful in applications such as medical imaging or self-driving cars.

And you know what the most interesting thing is, with OpenVINO Notebooks, we can try the two approaches we mentioned here: “zero-shot” from CLIP and a saliency map using language sentences as an input.

Result of CLIP Saliency map. Image Source: https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/clip-language-saliency-map/clip-language-saliency-map.ipynb

CLIP Zero shot Notebook is here:
https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/clip-zero-shot-image-classification/clip-zero-shot-classification.ipynb

CLIP Language Saliency map notebook:
https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/notebooks/clip-language-saliency-map/clip-language-saliency-map.ipynb

Conclusion

This blog could be very helpful for those who want to learn, play, and innovate with AI. The benefit of AI is within everyone’s reach and can help us to improve our lives. Taking an active role in the development of AI will help ensure that it benefits society.

My invitation to you is to try the OpenVINO notebooks. Stay tuned with me because more related content will be coming to my channels. If you have any issues, please add your questions in the discussion section of our repository https://github.com/openvinotoolkit/openvino_notebooks/discussions

Enjoy the blog and enjoy the notebooks! 😊

#iamintel #openvino #generativeai #xai #explainableia

About me:

Hi, all! My name is Paula Ramos. I have been an AI enthusiast and have worked with Computer Vision since the early 2000s. Developing novel integrated engineering technologies is my passion. I love to deploy solutions that can be used by real people to solve their equally real problems. If you’d like to share your ideas on how we could improve our community content, drop me a line! 😉 I will be happy to hear your feedback.

Here is my LinkedIn profile: https://www.linkedin.com/in/paula-ramos-41097319/

--

--

Paula Ramos, PhD.
OpenVINO-toolkit

CV/ML PhD with 19+ years in tech. Innovating Applied AI. Ex-Intel AI Evangelist, now at Voxel51. Let's connect! https://www.linkedin.com/in/paula-ramos-phd/