Image Sharpening with LatticaAI Demo Tutorial

Overview of the Model

Our Image Sharpening model enhances the clarity and detail of an input image by applying a specialized 2D filter through convolution.

  • Input Format: RGB image tensor of shape (3, 200, 200), with pixel values in the [0,1] range.

  • Output: Sharpened image preserving original dimensions.

The equivalent pytorch code for the operator is:

Achieving Full Privacy with LatticaAI

This demo is the only one that uses RBGV encryption scheme (the others are using CKKS scheme). The reason for this is that the plaintext tensor (image pixels) can be accurately represented in integer values, and the convolution kernel has integer values (as opposed to most machine learning models where either the input and/or the weights are floating point numbers).

In order to convert this simple code to use homomorphic operations, all you need are the following few extra steps:

  1. Install Lattica python package and obtain a JWT token

  2. Generate encryption keys

  3. Replace the actual convolution with our function that will:

    1. preprocess the image and encrypt it

    2. send the encrypted data to the cloud for computation

    3. receive and decrypt the encrypted result using your private key

Everything else remains the same.

circle-info

First install our client package

circle-info

See our step-by-step guide for a detailed explanation of each step in this flow. To use the image sharpening model use the imageEnhancement model ID


Last updated