> ## Documentation Index
> Fetch the complete documentation index at: https://landinglens.docs.landing.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pre Processing

export const vp = 'Visual Prompting';

export const smartLabel = 'Smart Labeling';

export const productLL = 'LandingLens';

export const mi = 'Mobile Inference';

export const llsf = 'LandingLens on Snowflake';

export const companyName = 'LandingAI';

This article describes the pre-processing APIs to convert gray to RGB.

## Folder Structure

\| .<br />├── custom<br />│ ├── **init**.py<br />│ ├── custom\_gray2rgb.py<br />├── train.yaml<br />└── transforms.yaml |
\| --- |## Gray to RGB Class

| import cv2from avi\_transforms import DataItemclass Gray2RGB:<br /> """Test transform to convert Gray to RGB""" def **init**(self, defect\_map, \*\*kwargs):<br /> *# Example to show passing arguments to custom transform*<br /> print(defect\_map) def **call**(self, inputs: DataItem) -> DataItem:<br /> image = inputs.image<br /> if image.ndim == 3:<br /> image = image\[..., 0]<br /> rgb = cv2.cvtColor(image, cv2.COLOR\_GRAY2RGB)<br /> return DataItem(image=rgb) |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

## Use Gray to RGB in transforms.yaml

| train:<br /> - GaussianBlur:<br /> lower\_limit: 5<br /> upper\_limit: 9<br /> p: 0.8<br /> - VerticalFlip:<br /> p: 0.2<br /> - CustomTransform:<br /> transform: custom.custom\_gray2rgb.Gray2RGB<br /> params:<br /> defect\_map:<br /> 0: ok<br /> 1: ng<br /> p: 1.0<br />valid: |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
