This session demonstrates how to perform a ‘Normalization’ of a grey image in AMD Ryzen AI Phoenix using AIE DIALECTS and AIE API
RequirementsAMD Ryzen AI Phoenix.
Linux® based development environment
Python® (for test automation and result validation)
IRON API and MLIR-based AI Engine Toolchain
OpenCV (Open Source Computer Vision Library)
Project BriefThe SOC is designed to accelerate the AIE-ML algorithms to deliver a good, exceptional performance. The NPU complex has
- 16 AI Cores for computation
- 4 Memory Tiles for fast memory access
- 4 SHIM DMA to Move data in and out of L3 Memory
Note: This project is customized for Phoenix.
Features covered in this session“How to write a kernel for ‘Normalization’ of a grey image?”
ArchitectureImage normalization is a preprocessing step used to adjust the range of pixel intensity values in an image. Its primary goal is to bring the data into a standard range, which helps improve human perception (contrast stretching) and enhances the performance and training speed of machine learning models.
Why Normalize Images?
- Consistency: Raw data often varies due to different lighting or camera settings; normalization provides a "fair" starting point for all images in a dataset.
- Training Efficiency: In deep learning, smaller, centered values allow for a stable global learning rate and prevent gradients from exploding or vanishing.
- Removing Bias: It prevents features with larger intensity ranges from dominating the learning process, which is critical for models like SVM or k-NN.
- Hardware Compatibility: Normalization can convert high-dynamic-range (HDR) images into 8-bit formats suitable for standard displays.
Data Flow for Max
Data Flow for Scaling
The core then scales each pixel and then routes the converted pixels back to L3 memory.
How to Build and RunTo compile the placed design:
env use_placed=1 make
make img_normalization.exeTo run the design:
./img_normalization.exe -x build/final.xclbin -i build/insts.bin -k MLIR_AIE --image image_1.jpgInput images
Output images
https://www.hackster.io/541340/amd-ryzen-ai-npu-tool-chain-installation-and-execution-b252fa
ConclusionThis session demonstrates how to use the “IRON API and MLIR-based AI Engine Toolchain” and “AIE API” to write a kernel to perform the “Normalization scaling of a Grey image”.








Comments