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.

    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.

    • Python library OpenCV and Pillow:

      Engineers created a image bounding box using the cv2.findContours(), cv2.drawContours() and cv2.boundingRect() functions in OpenCV and then the image was cropped along the bounding box using PIL.Image.crop() function of the Pillow library.

    • Resizing was done after cropping and transparent background conversion. To resize the image PIL.Image.resize() function in Pillow library was used.

    • 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.