IMAGE MANIPULATIONS for Apparel and Footwear Product Images
Visulon engineers have developed python functions in combination with Machine Learning models to achieve a high success rate of auto image conversions. Using some of these methods discussed below now Visulon can manipulate thousands of images for desired outcomes.
Our clients send out thousands of raw images coming from Indesign or illustrator that are required to be processed at high speed. Some Microsoft DLL and functions were not always giving good results, but now using advanced Python/ML coding, we identified new ways to manage on-demand resizing, compression, cropping, or creating the transparent background.
- 1) WHITE TO TRANSPARENT BACKGROUND CONVERSION
Methods Used:
- Python library Pillow
- Deep Learning Model:
Deep Learning algorithms and DL models that learned from a set of training data and predicted the outcome. So the training data was divided into ‘White’ and ‘Transparent’ categories.
Various modules were imported from the Keras TensorFlow models.
- Canny Edge Detection and Contour Mapping:
This method uses several OpenCV modules including canny edge detector and contour detection.
- YOLOv3 DL model trained with COCO dataset and OpenCV-Grabcut:
The idea here is to find the foreground, and remove the background.
- DL model trained on Keras Tensorflow Fashion MNIST Dataset:
This method utilized the Fashion MNIST dataset from Tensorflow to train the DL model. The model was trained on 60,000 apparel images.
- YOLOv5 DL model with Custom trained dataset (From Visulon) and OpenCV-Grabcut:
As the earlier pre-trained models did not produce good bounding boxes/rectangles for the openCV grabCut() function, a custom dataset containing 2 classes(‘Shirts’, ‘Shoes’) of training data was trained on the YOLOv5 DL model.
- Threshold Masking & OpenCV-Grabcut:
This method which generated good masks and hence helped in image background conversion.
- 4) COMPRESSING THE IMAGE
- KMeans Clustering ML Algorithm – Python Library sklearn:
In this method, the KMeans module is imported from sklearn.cluster library in order to compress the images.
- PNGQuant:
PNGQuant is a command-line utility and a library that is imported within python as import pngquant. It is developed from libimagequant, a small, portable, image quantization C library for high-quality conversion of RGBA images to 8-bit indexed-color (palette) images.