In a particular case, an encoder-decoder neural network architecture can be used for the second neural network. In some cases, skip connections from encoder layers to decoder layers can be added, akin to a U-Net architecture. The mapping module 122 uses the second neural network (as exemplified in FIG. 9) by taking as input an RGB image and outputting Na channels at the input resolution. In some cases, the mapping module 122 squashes these values to produce the final alpha masks by applying a softmax function across channels at every pixel. Histograms of RGB colors, as above, per alpha mask are generated by the mapping module 122 by adding soft votes (i.e., the alpha values) into corresponding bins. Each histogram can then be passed through the second neural network to produce parameters of a single color sail, which can then be decoded into its full set of colors by the mapping module 124.
The second neural network can be trained to be able to reconstruct the original image using the produced alphas and color sails. The ith alpha mask is denoted as ai and the corresponding set of color sail colors as Cai (as determined using Eq. (5)). Using these, the pixel value at location x, y of the reconstructed image IR can be determined by the mapping module 122 as: