<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://vista.su.domains/psych221wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rainas</id>
	<title>Psych 221 Image Systems Engineering - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://vista.su.domains/psych221wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rainas"/>
	<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Special:Contributions/Rainas"/>
	<updated>2026-04-18T14:35:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60870</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60870"/>
		<updated>2024-12-13T13:28:08Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by [10]. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on [10]. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
===== 3. Personalise with Severity Levels =====&lt;br /&gt;
To take into account of severity levels, the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; linearly interpolates between normal vision and full CVD perception based on severity and type:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T} = (1 - s) \mathbf{I} + s \mathbf{T}_{\text{CVD}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; represents the severity of CVD (0-100%), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; is the identity matrix, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}_{\text{CVD}}&amp;lt;/math&amp;gt; is the full transformation matrix specific to protanopia, deuteranopia, or tritanopia. Such a method is based on DaltonLens simulator [13].&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
==== Method 4: Improved with GMM-based Method ====&lt;br /&gt;
The last mathematical method we exprimented enhances recoloring by integrating a Gaussian Mixture Model (GMM)-based global recoloring algorithm. The method also applies nonlinear adjustments for colors near confusion lines to ensure improved contrast and naturalness.&lt;br /&gt;
&lt;br /&gt;
===== 1. GMM-Based Global Recoloring =====&lt;br /&gt;
The image is first resized and transformed into the Lab color space. A GMM is applied to cluster the color distribution into &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; components, optimizing the number of clusters using the Bayesian Information Criterion (BIC):&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{BIC} = -2 \cdot \text{log-likelihood} + P \cdot \log(N),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt; represents the model parameters and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is the number of pixels.&lt;br /&gt;
&lt;br /&gt;
The GMM means are simulated using the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; with severity levels taken into account, and the symmetric Kullback-Leibler (KL) divergence (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{sKL}}&amp;lt;/math&amp;gt;) is calculated between pairs of clusters:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{\text{sKL}}(i, j) = D_{\text{KL}}(G_i \| G_j) + D_{\text{KL}}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt; are Gaussian components, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{KL}}&amp;lt;/math&amp;gt; represents the KL divergence. The GMM cluster means are then adjusted by solving a nonlinear least-squares problem to minimize the discrepancy.&lt;br /&gt;
&lt;br /&gt;
===== 2. Adjusting Near Confusion Lines Improved =====&lt;br /&gt;
Following global recoloring, colors near confusion lines in the CIE 1931 xyY color space are further adjusted based on formulas used in Method 3. Nonlinear scaling is applied to amplify the shifts for pixels closer to the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
w = \left( \frac{\text{threshold} - d}{\text{threshold}} \right)^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w&amp;lt;/math&amp;gt; is the scaling factor. &lt;br /&gt;
&lt;br /&gt;
The adjustments from the GMM and confusion line steps are combined to produce the final recolored image. These enhancements make the method more robust and effective for individuals with varying levels of CVD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through our experimentation with mathematical methods, we gained a deeper understanding of the algorithmic aspects of image recoloring for CVD, particularly in balancing naturalness, contrast, and personalization. Building on these insights, we transitioned to exploring deep learning approaches, applying the lessons learned to guide training, evaluation, and ground truth dataset generation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
&lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The qualitative results and key observations from the experiments are summarized below. &lt;br /&gt;
&lt;br /&gt;
The result images presented in Figures 10 through 13 follow this sequence: the original image, the CVD-simulated version of the original image, the recolored image, and the CVD-simulated version of the recolored image. The CVD-simulated images demonstrate how the images are perceived by individuals with the corresponding type of CVD. The examples provided focus on protanopia (first row) and deuteranopia (second row) due to space constraints. Additional results for tritanopia and recolored images at varying severity levels are included in the appendix.&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Method 1: Daltonization Baseline&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method1.png|400px|thumb|right|Figure 10: Method 1 Results]]&lt;br /&gt;
&lt;br /&gt;
The Daltonization method provides a foundational approach for recoloring images to enhance visibility for individuals with CVD. Key takeaways from Figure 10 include:&lt;br /&gt;
&lt;br /&gt;
* The method demonstrates significant improvements for protanopia, as seen in the first row, where the recolored images show clear color differences and high contrast. However, for deuteranopia, as shown in the second row, the recolored images exhibit less visible improvements, with lower contrast. This inconsistency highlights the method&#039;s limited ability to generalize across different types of CVD.&lt;br /&gt;
* The method does not account for severity levels or individual differences in CVD perception, which presents an opportunity for further improvement.&lt;br /&gt;
* While the recolored images achieve high contrast between confusing colors, the overall perception of the original image is not preserved. This reduction in naturalness may impact the aesthetic quality and recognizability of the image.&lt;br /&gt;
* Performance: this method is the fastest among the methods tested, as it relies solely on matrix transformations. This makes it computationally efficient and suitable for real-time applications.&lt;br /&gt;
&lt;br /&gt;
The Daltonization method provides a baseline for recoloring but requires enhancements in flexibility, contrast optimization across CVD types, and personalization for varying severity levels.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Method 2: Optimizing Objective Functions&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method2.png|400px|thumb|right|Figure 11 Method 2 Results]]&lt;br /&gt;
* While this method aims to balance naturalness and contrast, the resulting recolored images are similar to the original ones. A possible reason for this is the sensitivity of the loss function to the beta parameter, which requires careful tuning.&lt;br /&gt;
* The recolored images exhibit some loss of fine details, likely due to the use of the k-means clustering algorithm, which simplifies color representation across the image.&lt;br /&gt;
* This algorithm has a very slow runtime, taking over one minute per image. The primary bottlenecks are the color clustering step and the optimization of the objective function, which can be improved significantly.&lt;br /&gt;
* Despite its limitations, this method introduces a flexible framework for customizing loss functions, enabling further improvements. This flexibility was leveraged to refine the method in subsequent methods.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Method 3: Adjustments Near Confusion Lines with Improved Method 2&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method3.png|400px|thumb|right|Figure 12 Method 3 Results]]&lt;br /&gt;
* This method produces recolored images with reasonable contrasts between confusing colors while preserving the naturalness of the image well. It can also account for varying severity levels for each CVD type, providing more personalized recoloring.&lt;br /&gt;
* The performance of the algorithm was improved significantly, reducing from over one minute to approximately 4 seconds per image.&lt;br /&gt;
* In the appendix, we included results with color plates, which commonly used for diagnosing color vision deficiencies, are included in the appendix. This method shows good results, with numbers becoming more easily visible in the CVD-simulated recolored images.&lt;br /&gt;
* Some limitations include the fact that this method sometimes lacks sufficient contrast, particularly for the deuteranopia type. It is also sensitive to parameters, such as the shift factor for colors near the confusion lines, which requires careful tuning. &lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Method 4: Improved with GMM-based Method&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method4.png|400px|thumb|right|Figure 13 Method 4 Results]]&lt;br /&gt;
* This method creates recolored images with very high contrast, making the colors in the images easily distinguishable, even for individuals with severe CVD.&lt;br /&gt;
* By using GMM-based clustering instead of k-means, this method preserves most of the image details. The more sophisticated clustering allows for a better representation of the original color distribution, reducing the loss of fine details.&lt;br /&gt;
* The runtime for this method is significantly faster than most others, taking only around 1 second per image. This makes it highly practical for real-time applications.&lt;br /&gt;
* While the method performs well in enhancing contrast, some recolored images lose the naturalness of the original images. Additionally, certain colors in the recolored images do not transition smoothly, which might be attributed to the clustering step in the process.&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Below are some quantitative results from six metrics with the performance for each method:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
! Original vs Recolored !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
| SSIM || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| TCC || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| CD ΔE76 || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE2000 || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE94 || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| D-CIELAB ΔEab || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* SSIM: Measures structural similarity between images, combining luminance, contrast, and structure components. Computed using `torchmetrics.StructuralSimilarityIndexMeasure`.&lt;br /&gt;
&lt;br /&gt;
* TCC: Evaluates changes in total color contrast, compares random pixel pairs in each image and calculates the difference in their color distances. &lt;br /&gt;
&lt;br /&gt;
* D-CIELAB ΔEab [14]: Quantifies perceptual color differences for dichromats under specific CVD types. &lt;br /&gt;
&lt;br /&gt;
* CD ΔE76, CIEDE2000, CIEDE94: Standard perceptual color difference metrics, computed with scikit-image package. ΔE76 is basic Euclidean distance in Lab space, while CIEDE2000 and CIEDE94 include perceptual corrections.&lt;br /&gt;
&lt;br /&gt;
Ovearll, method 4 stands out as the best-performing approach, delivering high contrast, preserving image details through GMM-based clustering, and achieving the fastest runtime, while addressing many limitations of the earlier methods.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:40%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 (vs. ~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 (vs. ~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
[13] DaltonLens. (n.d.). DaltonLens-Python [Computer software]. GitHub. Retrieved December 13, 2024, from https://github.com/DaltonLens/DaltonLens-Python&lt;br /&gt;
&lt;br /&gt;
[14] Interactive Science and Engineering Tools. (n.d.). D-CIELAB GitHub repository. Retrieved December 13, 2024, from https://github.com/ISET/D-CIELAB&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400px|Wikipedia encyclopedia]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_2.png|400px]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|350px|thumb|Conditional Autoencoder]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_unet.png|350px|thumb|Conditional U-Net]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_mlp.png|350px|thumb|Conditional MLP]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both; text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
Losses: Conditional Autoencoder, Conditional U-Net, and Conditional MLP&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Mathematical method results with color plates&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method1-color-plates.png|400px|thumb|Method 1 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method2-color-plates.png|400px|thumb|Method 2 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 3 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method3-protan.png|Protanopia&lt;br /&gt;
File:Method3-deutan.png|Deuteranopia&lt;br /&gt;
File:Method3-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 4 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method4-protan.png|Protanopia&lt;br /&gt;
File:Method4-deutan.png|Deuteranopia&lt;br /&gt;
File:Method4-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;br /&gt;
* Researching, writing and running scripts for four (and more) mathematical-based methods (Daltonization, Optimization-based, Confusion lines based, GMM based and some other experiments such as a segmentation-based method which was discarded due to slow performance)&lt;br /&gt;
* Results generation and validation for all scripts written&lt;br /&gt;
* Evaluation metrics scripts for mathematical methods&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60869</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60869"/>
		<updated>2024-12-13T13:27:46Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Quantitative Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by [10]. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on [10]. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
===== 3. Personalise with Severity Levels =====&lt;br /&gt;
To take into account of severity levels, the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; linearly interpolates between normal vision and full CVD perception based on severity and type:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T} = (1 - s) \mathbf{I} + s \mathbf{T}_{\text{CVD}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; represents the severity of CVD (0-100%), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; is the identity matrix, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}_{\text{CVD}}&amp;lt;/math&amp;gt; is the full transformation matrix specific to protanopia, deuteranopia, or tritanopia. Such a method is based on DaltonLens simulator [13].&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
==== Method 4: Improved with GMM-based Method ====&lt;br /&gt;
The last mathematical method we exprimented enhances recoloring by integrating a Gaussian Mixture Model (GMM)-based global recoloring algorithm. The method also applies nonlinear adjustments for colors near confusion lines to ensure improved contrast and naturalness.&lt;br /&gt;
&lt;br /&gt;
===== 1. GMM-Based Global Recoloring =====&lt;br /&gt;
The image is first resized and transformed into the Lab color space. A GMM is applied to cluster the color distribution into &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; components, optimizing the number of clusters using the Bayesian Information Criterion (BIC):&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{BIC} = -2 \cdot \text{log-likelihood} + P \cdot \log(N),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt; represents the model parameters and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is the number of pixels.&lt;br /&gt;
&lt;br /&gt;
The GMM means are simulated using the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; with severity levels taken into account, and the symmetric Kullback-Leibler (KL) divergence (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{sKL}}&amp;lt;/math&amp;gt;) is calculated between pairs of clusters:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{\text{sKL}}(i, j) = D_{\text{KL}}(G_i \| G_j) + D_{\text{KL}}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt; are Gaussian components, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{KL}}&amp;lt;/math&amp;gt; represents the KL divergence. The GMM cluster means are then adjusted by solving a nonlinear least-squares problem to minimize the discrepancy.&lt;br /&gt;
&lt;br /&gt;
===== 2. Adjusting Near Confusion Lines Improved =====&lt;br /&gt;
Following global recoloring, colors near confusion lines in the CIE 1931 xyY color space are further adjusted based on formulas used in Method 3. Nonlinear scaling is applied to amplify the shifts for pixels closer to the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
w = \left( \frac{\text{threshold} - d}{\text{threshold}} \right)^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w&amp;lt;/math&amp;gt; is the scaling factor. &lt;br /&gt;
&lt;br /&gt;
The adjustments from the GMM and confusion line steps are combined to produce the final recolored image. These enhancements make the method more robust and effective for individuals with varying levels of CVD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through our experimentation with mathematical methods, we gained a deeper understanding of the algorithmic aspects of image recoloring for CVD, particularly in balancing naturalness, contrast, and personalization. Building on these insights, we transitioned to exploring deep learning approaches, applying the lessons learned to guide training, evaluation, and ground truth dataset generation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
&lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The qualitative results and key observations from the experiments are summarized below. &lt;br /&gt;
&lt;br /&gt;
The result images presented in Figures 10 through 13 follow this sequence: the original image, the CVD-simulated version of the original image, the recolored image, and the CVD-simulated version of the recolored image. The CVD-simulated images demonstrate how the images are perceived by individuals with the corresponding type of CVD. The examples provided focus on protanopia (first row) and deuteranopia (second row) due to space constraints. Additional results for tritanopia and recolored images at varying severity levels are included in the appendix.&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Method 1: Daltonization Baseline&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method1.png|400px|thumb|right|Figure 10: Method 1 Results]]&lt;br /&gt;
&lt;br /&gt;
The Daltonization method provides a foundational approach for recoloring images to enhance visibility for individuals with CVD. Key takeaways from Figure 10 include:&lt;br /&gt;
&lt;br /&gt;
* The method demonstrates significant improvements for protanopia, as seen in the first row, where the recolored images show clear color differences and high contrast. However, for deuteranopia, as shown in the second row, the recolored images exhibit less visible improvements, with lower contrast. This inconsistency highlights the method&#039;s limited ability to generalize across different types of CVD.&lt;br /&gt;
* The method does not account for severity levels or individual differences in CVD perception, which presents an opportunity for further improvement.&lt;br /&gt;
* While the recolored images achieve high contrast between confusing colors, the overall perception of the original image is not preserved. This reduction in naturalness may impact the aesthetic quality and recognizability of the image.&lt;br /&gt;
* Performance: this method is the fastest among the methods tested, as it relies solely on matrix transformations. This makes it computationally efficient and suitable for real-time applications.&lt;br /&gt;
&lt;br /&gt;
The Daltonization method provides a baseline for recoloring but requires enhancements in flexibility, contrast optimization across CVD types, and personalization for varying severity levels.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Method 2: Optimizing Objective Functions&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method2.png|400px|thumb|right|Figure 11 Method 2 Results]]&lt;br /&gt;
* While this method aims to balance naturalness and contrast, the resulting recolored images are similar to the original ones. A possible reason for this is the sensitivity of the loss function to the beta parameter, which requires careful tuning.&lt;br /&gt;
* The recolored images exhibit some loss of fine details, likely due to the use of the k-means clustering algorithm, which simplifies color representation across the image.&lt;br /&gt;
* This algorithm has a very slow runtime, taking over one minute per image. The primary bottlenecks are the color clustering step and the optimization of the objective function, which can be improved significantly.&lt;br /&gt;
* Despite its limitations, this method introduces a flexible framework for customizing loss functions, enabling further improvements. This flexibility was leveraged to refine the method in subsequent methods.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Method 3: Adjustments Near Confusion Lines with Improved Method 2&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method3.png|400px|thumb|right|Figure 12 Method 3 Results]]&lt;br /&gt;
* This method produces recolored images with reasonable contrasts between confusing colors while preserving the naturalness of the image well. It can also account for varying severity levels for each CVD type, providing more personalized recoloring.&lt;br /&gt;
* The performance of the algorithm was improved significantly, reducing from over one minute to approximately 4 seconds per image.&lt;br /&gt;
* In the appendix, we included results with color plates, which commonly used for diagnosing color vision deficiencies, are included in the appendix. This method shows good results, with numbers becoming more easily visible in the CVD-simulated recolored images.&lt;br /&gt;
* Some limitations include the fact that this method sometimes lacks sufficient contrast, particularly for the deuteranopia type. It is also sensitive to parameters, such as the shift factor for colors near the confusion lines, which requires careful tuning. &lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Method 4: Improved with GMM-based Method&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method4.png|400px|thumb|right|Figure 13 Method 4 Results]]&lt;br /&gt;
* This method creates recolored images with very high contrast, making the colors in the images easily distinguishable, even for individuals with severe CVD.&lt;br /&gt;
* By using GMM-based clustering instead of k-means, this method preserves most of the image details. The more sophisticated clustering allows for a better representation of the original color distribution, reducing the loss of fine details.&lt;br /&gt;
* The runtime for this method is significantly faster than most others, taking only around 1 second per image. This makes it highly practical for real-time applications.&lt;br /&gt;
* While the method performs well in enhancing contrast, some recolored images lose the naturalness of the original images. Additionally, certain colors in the recolored images do not transition smoothly, which might be attributed to the clustering step in the process.&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Below are some quantitative results from six metrics with the performance for each method:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
! Original vs Recolored !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
| SSIM || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| TCC || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| CD ΔE76 || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE2000 || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE94 || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| D-CIELAB ΔEab || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* SSIM: Measures structural similarity between images, combining luminance, contrast, and structure components. Computed using `torchmetrics.StructuralSimilarityIndexMeasure`.&lt;br /&gt;
&lt;br /&gt;
* TCC: Evaluates changes in total color contrast, compares random pixel pairs in each image and calculates the difference in their color distances. &lt;br /&gt;
&lt;br /&gt;
* D-CIELAB ΔEab [14]: Quantifies perceptual color differences for dichromats under specific CVD types. &lt;br /&gt;
&lt;br /&gt;
* CD ΔE76, CIEDE2000, CIEDE94: Standard perceptual color difference metrics, computed with scikit-image package. ΔE76 is basic Euclidean distance in Lab space, while CIEDE2000 and CIEDE94 include perceptual corrections.&lt;br /&gt;
&lt;br /&gt;
Ovearll, method 4 stands out as the best-performing approach, delivering high contrast, preserving image details through GMM-based clustering, and achieving the fastest runtime, while addressing many limitations of the earlier methods.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:40%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 (vs. ~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 (vs. ~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
[13] DaltonLens. (n.d.). DaltonLens-Python [Computer software]. GitHub. Retrieved December 13, 2024, from https://github.com/DaltonLens/DaltonLens-Python&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400px|Wikipedia encyclopedia]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_2.png|400px]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|350px|thumb|Conditional Autoencoder]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_unet.png|350px|thumb|Conditional U-Net]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_mlp.png|350px|thumb|Conditional MLP]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both; text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
Losses: Conditional Autoencoder, Conditional U-Net, and Conditional MLP&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Mathematical method results with color plates&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method1-color-plates.png|400px|thumb|Method 1 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method2-color-plates.png|400px|thumb|Method 2 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 3 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method3-protan.png|Protanopia&lt;br /&gt;
File:Method3-deutan.png|Deuteranopia&lt;br /&gt;
File:Method3-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 4 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method4-protan.png|Protanopia&lt;br /&gt;
File:Method4-deutan.png|Deuteranopia&lt;br /&gt;
File:Method4-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;br /&gt;
* Researching, writing and running scripts for four (and more) mathematical-based methods (Daltonization, Optimization-based, Confusion lines based, GMM based and some other experiments such as a segmentation-based method which was discarded due to slow performance)&lt;br /&gt;
* Results generation and validation for all scripts written&lt;br /&gt;
* Evaluation metrics scripts for mathematical methods&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60868</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60868"/>
		<updated>2024-12-13T13:26:34Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by [10]. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on [10]. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
===== 3. Personalise with Severity Levels =====&lt;br /&gt;
To take into account of severity levels, the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; linearly interpolates between normal vision and full CVD perception based on severity and type:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T} = (1 - s) \mathbf{I} + s \mathbf{T}_{\text{CVD}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; represents the severity of CVD (0-100%), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; is the identity matrix, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}_{\text{CVD}}&amp;lt;/math&amp;gt; is the full transformation matrix specific to protanopia, deuteranopia, or tritanopia. Such a method is based on DaltonLens simulator [13].&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
==== Method 4: Improved with GMM-based Method ====&lt;br /&gt;
The last mathematical method we exprimented enhances recoloring by integrating a Gaussian Mixture Model (GMM)-based global recoloring algorithm. The method also applies nonlinear adjustments for colors near confusion lines to ensure improved contrast and naturalness.&lt;br /&gt;
&lt;br /&gt;
===== 1. GMM-Based Global Recoloring =====&lt;br /&gt;
The image is first resized and transformed into the Lab color space. A GMM is applied to cluster the color distribution into &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; components, optimizing the number of clusters using the Bayesian Information Criterion (BIC):&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{BIC} = -2 \cdot \text{log-likelihood} + P \cdot \log(N),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt; represents the model parameters and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is the number of pixels.&lt;br /&gt;
&lt;br /&gt;
The GMM means are simulated using the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; with severity levels taken into account, and the symmetric Kullback-Leibler (KL) divergence (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{sKL}}&amp;lt;/math&amp;gt;) is calculated between pairs of clusters:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{\text{sKL}}(i, j) = D_{\text{KL}}(G_i \| G_j) + D_{\text{KL}}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt; are Gaussian components, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{KL}}&amp;lt;/math&amp;gt; represents the KL divergence. The GMM cluster means are then adjusted by solving a nonlinear least-squares problem to minimize the discrepancy.&lt;br /&gt;
&lt;br /&gt;
===== 2. Adjusting Near Confusion Lines Improved =====&lt;br /&gt;
Following global recoloring, colors near confusion lines in the CIE 1931 xyY color space are further adjusted based on formulas used in Method 3. Nonlinear scaling is applied to amplify the shifts for pixels closer to the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
w = \left( \frac{\text{threshold} - d}{\text{threshold}} \right)^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w&amp;lt;/math&amp;gt; is the scaling factor. &lt;br /&gt;
&lt;br /&gt;
The adjustments from the GMM and confusion line steps are combined to produce the final recolored image. These enhancements make the method more robust and effective for individuals with varying levels of CVD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Through our experimentation with mathematical methods, we gained a deeper understanding of the algorithmic aspects of image recoloring for CVD, particularly in balancing naturalness, contrast, and personalization. Building on these insights, we transitioned to exploring deep learning approaches, applying the lessons learned to guide training, evaluation, and ground truth dataset generation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
&lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The qualitative results and key observations from the experiments are summarized below. &lt;br /&gt;
&lt;br /&gt;
The result images presented in Figures 10 through 13 follow this sequence: the original image, the CVD-simulated version of the original image, the recolored image, and the CVD-simulated version of the recolored image. The CVD-simulated images demonstrate how the images are perceived by individuals with the corresponding type of CVD. The examples provided focus on protanopia (first row) and deuteranopia (second row) due to space constraints. Additional results for tritanopia and recolored images at varying severity levels are included in the appendix.&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Method 1: Daltonization Baseline&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method1.png|400px|thumb|right|Figure 10: Method 1 Results]]&lt;br /&gt;
&lt;br /&gt;
The Daltonization method provides a foundational approach for recoloring images to enhance visibility for individuals with CVD. Key takeaways from Figure 10 include:&lt;br /&gt;
&lt;br /&gt;
* The method demonstrates significant improvements for protanopia, as seen in the first row, where the recolored images show clear color differences and high contrast. However, for deuteranopia, as shown in the second row, the recolored images exhibit less visible improvements, with lower contrast. This inconsistency highlights the method&#039;s limited ability to generalize across different types of CVD.&lt;br /&gt;
* The method does not account for severity levels or individual differences in CVD perception, which presents an opportunity for further improvement.&lt;br /&gt;
* While the recolored images achieve high contrast between confusing colors, the overall perception of the original image is not preserved. This reduction in naturalness may impact the aesthetic quality and recognizability of the image.&lt;br /&gt;
* Performance: this method is the fastest among the methods tested, as it relies solely on matrix transformations. This makes it computationally efficient and suitable for real-time applications.&lt;br /&gt;
&lt;br /&gt;
The Daltonization method provides a baseline for recoloring but requires enhancements in flexibility, contrast optimization across CVD types, and personalization for varying severity levels.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Method 2: Optimizing Objective Functions&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method2.png|400px|thumb|right|Figure 11 Method 2 Results]]&lt;br /&gt;
* While this method aims to balance naturalness and contrast, the resulting recolored images are similar to the original ones. A possible reason for this is the sensitivity of the loss function to the beta parameter, which requires careful tuning.&lt;br /&gt;
* The recolored images exhibit some loss of fine details, likely due to the use of the k-means clustering algorithm, which simplifies color representation across the image.&lt;br /&gt;
* This algorithm has a very slow runtime, taking over one minute per image. The primary bottlenecks are the color clustering step and the optimization of the objective function, which can be improved significantly.&lt;br /&gt;
* Despite its limitations, this method introduces a flexible framework for customizing loss functions, enabling further improvements. This flexibility was leveraged to refine the method in subsequent methods.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Method 3: Adjustments Near Confusion Lines with Improved Method 2&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method3.png|400px|thumb|right|Figure 12 Method 3 Results]]&lt;br /&gt;
* This method produces recolored images with reasonable contrasts between confusing colors while preserving the naturalness of the image well. It can also account for varying severity levels for each CVD type, providing more personalized recoloring.&lt;br /&gt;
* The performance of the algorithm was improved significantly, reducing from over one minute to approximately 4 seconds per image.&lt;br /&gt;
* In the appendix, we included results with color plates, which commonly used for diagnosing color vision deficiencies, are included in the appendix. This method shows good results, with numbers becoming more easily visible in the CVD-simulated recolored images.&lt;br /&gt;
* Some limitations include the fact that this method sometimes lacks sufficient contrast, particularly for the deuteranopia type. It is also sensitive to parameters, such as the shift factor for colors near the confusion lines, which requires careful tuning. &lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Method 4: Improved with GMM-based Method&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method4.png|400px|thumb|right|Figure 13 Method 4 Results]]&lt;br /&gt;
* This method creates recolored images with very high contrast, making the colors in the images easily distinguishable, even for individuals with severe CVD.&lt;br /&gt;
* By using GMM-based clustering instead of k-means, this method preserves most of the image details. The more sophisticated clustering allows for a better representation of the original color distribution, reducing the loss of fine details.&lt;br /&gt;
* The runtime for this method is significantly faster than most others, taking only around 1 second per image. This makes it highly practical for real-time applications.&lt;br /&gt;
* While the method performs well in enhancing contrast, some recolored images lose the naturalness of the original images. Additionally, certain colors in the recolored images do not transition smoothly, which might be attributed to the clustering step in the process.&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Below are some quantitative results from six metrics with the performance for each method:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
! Original vs Recolored !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
| SSIM || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| TCC || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| CD ΔE76 || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE2000 || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE94 || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| D-CIELAB ΔEab || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* SSIM: Measures structural similarity between images, combining luminance, contrast, and structure components. Computed using `torchmetrics.StructuralSimilarityIndexMeasure`.&lt;br /&gt;
&lt;br /&gt;
* TCC: Evaluates changes in total color contrast, compares random pixel pairs in each image and calculates the difference in their color distances. &lt;br /&gt;
&lt;br /&gt;
* D-CIELAB ΔEab: Quantifies perceptual color differences for dichromats under specific CVD types. &lt;br /&gt;
&lt;br /&gt;
* CD ΔE76, CIEDE2000, CIEDE94: Standard perceptual color difference metrics, computed with scikit-image package. ΔE76 is basic Euclidean distance in Lab space, while CIEDE2000 and CIEDE94 include perceptual corrections.&lt;br /&gt;
&lt;br /&gt;
Ovearll, method 4 stands out as the best-performing approach, delivering high contrast, preserving image details through GMM-based clustering, and achieving the fastest runtime, while addressing many limitations of the earlier methods.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:40%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 (vs. ~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 (vs. ~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
[13] DaltonLens. (n.d.). DaltonLens-Python [Computer software]. GitHub. Retrieved December 13, 2024, from https://github.com/DaltonLens/DaltonLens-Python&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400px|Wikipedia encyclopedia]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_2.png|400px]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|350px|thumb|Conditional Autoencoder]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_unet.png|350px|thumb|Conditional U-Net]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_mlp.png|350px|thumb|Conditional MLP]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both; text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
Losses: Conditional Autoencoder, Conditional U-Net, and Conditional MLP&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Mathematical method results with color plates&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method1-color-plates.png|400px|thumb|Method 1 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method2-color-plates.png|400px|thumb|Method 2 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 3 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method3-protan.png|Protanopia&lt;br /&gt;
File:Method3-deutan.png|Deuteranopia&lt;br /&gt;
File:Method3-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 4 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method4-protan.png|Protanopia&lt;br /&gt;
File:Method4-deutan.png|Deuteranopia&lt;br /&gt;
File:Method4-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;br /&gt;
* Researching, writing and running scripts for four (and more) mathematical-based methods (Daltonization, Optimization-based, Confusion lines based, GMM based and some other experiments such as a segmentation-based method which was discarded due to slow performance)&lt;br /&gt;
* Results generation and validation for all scripts written&lt;br /&gt;
* Evaluation metrics scripts for mathematical methods&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60867</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60867"/>
		<updated>2024-12-13T13:26:00Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by [10]. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on [10]. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
===== 3. Personalise with Severity Levels =====&lt;br /&gt;
To take into account of severity levels, the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; linearly interpolates between normal vision and full CVD perception based on severity and type:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T} = (1 - s) \mathbf{I} + s \mathbf{T}_{\text{CVD}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; represents the severity of CVD (0-100%), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; is the identity matrix, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}_{\text{CVD}}&amp;lt;/math&amp;gt; is the full transformation matrix specific to protanopia, deuteranopia, or tritanopia. Such a method is based on DaltonLens simulator [13].&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
==== Method 4: Improved with GMM-based Method ====&lt;br /&gt;
The last mathematical method we exprimented enhances recoloring by integrating a Gaussian Mixture Model (GMM)-based global recoloring algorithm. The method also applies nonlinear adjustments for colors near confusion lines to ensure improved contrast and naturalness.&lt;br /&gt;
&lt;br /&gt;
===== 1. GMM-Based Global Recoloring =====&lt;br /&gt;
The image is first resized and transformed into the Lab color space. A GMM is applied to cluster the color distribution into &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; components, optimizing the number of clusters using the Bayesian Information Criterion (BIC):&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{BIC} = -2 \cdot \text{log-likelihood} + P \cdot \log(N),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt; represents the model parameters and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is the number of pixels.&lt;br /&gt;
&lt;br /&gt;
The GMM means are simulated using the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; with severity levels taken into account, and the symmetric Kullback-Leibler (KL) divergence (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{sKL}}&amp;lt;/math&amp;gt;) is calculated between pairs of clusters:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{\text{sKL}}(i, j) = D_{\text{KL}}(G_i \| G_j) + D_{\text{KL}}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt; are Gaussian components, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{KL}}&amp;lt;/math&amp;gt; represents the KL divergence. The GMM cluster means are then adjusted by solving a nonlinear least-squares problem to minimize the discrepancy.&lt;br /&gt;
&lt;br /&gt;
===== 2. Adjusting Near Confusion Lines Improved =====&lt;br /&gt;
Following global recoloring, colors near confusion lines in the CIE 1931 xyY color space are further adjusted based on formulas used in Method 3. Nonlinear scaling is applied to amplify the shifts for pixels closer to the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
w = \left( \frac{\text{threshold} - d}{\text{threshold}} \right)^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w&amp;lt;/math&amp;gt; is the scaling factor. &lt;br /&gt;
&lt;br /&gt;
The adjustments from the GMM and confusion line steps are combined to produce the final recolored image. These enhancements make the method more robust and effective for individuals with varying levels of CVD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
&lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The qualitative results and key observations from the experiments are summarized below. &lt;br /&gt;
&lt;br /&gt;
The result images presented in Figures 10 through 13 follow this sequence: the original image, the CVD-simulated version of the original image, the recolored image, and the CVD-simulated version of the recolored image. The CVD-simulated images demonstrate how the images are perceived by individuals with the corresponding type of CVD. The examples provided focus on protanopia (first row) and deuteranopia (second row) due to space constraints. Additional results for tritanopia and recolored images at varying severity levels are included in the appendix.&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Method 1: Daltonization Baseline&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method1.png|400px|thumb|right|Figure 10: Method 1 Results]]&lt;br /&gt;
&lt;br /&gt;
The Daltonization method provides a foundational approach for recoloring images to enhance visibility for individuals with CVD. Key takeaways from Figure 10 include:&lt;br /&gt;
&lt;br /&gt;
* The method demonstrates significant improvements for protanopia, as seen in the first row, where the recolored images show clear color differences and high contrast. However, for deuteranopia, as shown in the second row, the recolored images exhibit less visible improvements, with lower contrast. This inconsistency highlights the method&#039;s limited ability to generalize across different types of CVD.&lt;br /&gt;
* The method does not account for severity levels or individual differences in CVD perception, which presents an opportunity for further improvement.&lt;br /&gt;
* While the recolored images achieve high contrast between confusing colors, the overall perception of the original image is not preserved. This reduction in naturalness may impact the aesthetic quality and recognizability of the image.&lt;br /&gt;
* Performance: this method is the fastest among the methods tested, as it relies solely on matrix transformations. This makes it computationally efficient and suitable for real-time applications.&lt;br /&gt;
&lt;br /&gt;
The Daltonization method provides a baseline for recoloring but requires enhancements in flexibility, contrast optimization across CVD types, and personalization for varying severity levels.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Method 2: Optimizing Objective Functions&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method2.png|400px|thumb|right|Figure 11 Method 2 Results]]&lt;br /&gt;
* While this method aims to balance naturalness and contrast, the resulting recolored images are similar to the original ones. A possible reason for this is the sensitivity of the loss function to the beta parameter, which requires careful tuning.&lt;br /&gt;
* The recolored images exhibit some loss of fine details, likely due to the use of the k-means clustering algorithm, which simplifies color representation across the image.&lt;br /&gt;
* This algorithm has a very slow runtime, taking over one minute per image. The primary bottlenecks are the color clustering step and the optimization of the objective function, which can be improved significantly.&lt;br /&gt;
* Despite its limitations, this method introduces a flexible framework for customizing loss functions, enabling further improvements. This flexibility was leveraged to refine the method in subsequent methods.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Method 3: Adjustments Near Confusion Lines with Improved Method 2&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method3.png|400px|thumb|right|Figure 12 Method 3 Results]]&lt;br /&gt;
* This method produces recolored images with reasonable contrasts between confusing colors while preserving the naturalness of the image well. It can also account for varying severity levels for each CVD type, providing more personalized recoloring.&lt;br /&gt;
* The performance of the algorithm was improved significantly, reducing from over one minute to approximately 4 seconds per image.&lt;br /&gt;
* In the appendix, we included results with color plates, which commonly used for diagnosing color vision deficiencies, are included in the appendix. This method shows good results, with numbers becoming more easily visible in the CVD-simulated recolored images.&lt;br /&gt;
* Some limitations include the fact that this method sometimes lacks sufficient contrast, particularly for the deuteranopia type. It is also sensitive to parameters, such as the shift factor for colors near the confusion lines, which requires careful tuning. &lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Method 4: Improved with GMM-based Method&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method4.png|400px|thumb|right|Figure 13 Method 4 Results]]&lt;br /&gt;
* This method creates recolored images with very high contrast, making the colors in the images easily distinguishable, even for individuals with severe CVD.&lt;br /&gt;
* By using GMM-based clustering instead of k-means, this method preserves most of the image details. The more sophisticated clustering allows for a better representation of the original color distribution, reducing the loss of fine details.&lt;br /&gt;
* The runtime for this method is significantly faster than most others, taking only around 1 second per image. This makes it highly practical for real-time applications.&lt;br /&gt;
* While the method performs well in enhancing contrast, some recolored images lose the naturalness of the original images. Additionally, certain colors in the recolored images do not transition smoothly, which might be attributed to the clustering step in the process.&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Below are some quantitative results from six metrics with the performance for each method:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
! Original vs Recolored !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
| SSIM || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| TCC || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| CD ΔE76 || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE2000 || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE94 || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| D-CIELAB ΔEab || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* SSIM: Measures structural similarity between images, combining luminance, contrast, and structure components. Computed using `torchmetrics.StructuralSimilarityIndexMeasure`.&lt;br /&gt;
&lt;br /&gt;
* TCC: Evaluates changes in total color contrast, compares random pixel pairs in each image and calculates the difference in their color distances. &lt;br /&gt;
&lt;br /&gt;
* D-CIELAB ΔEab: Quantifies perceptual color differences for dichromats under specific CVD types. &lt;br /&gt;
&lt;br /&gt;
* CD ΔE76, CIEDE2000, CIEDE94: Standard perceptual color difference metrics, computed with scikit-image package. ΔE76 is basic Euclidean distance in Lab space, while CIEDE2000 and CIEDE94 include perceptual corrections.&lt;br /&gt;
&lt;br /&gt;
Ovearll, method 4 stands out as the best-performing approach, delivering high contrast, preserving image details through GMM-based clustering, and achieving the fastest runtime, while addressing many limitations of the earlier methods.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:40%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 (vs. ~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 (vs. ~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
[13] DaltonLens. (n.d.). DaltonLens-Python [Computer software]. GitHub. Retrieved December 13, 2024, from https://github.com/DaltonLens/DaltonLens-Python&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400px|Wikipedia encyclopedia]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_2.png|400px]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|350px|thumb|Conditional Autoencoder]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_unet.png|350px|thumb|Conditional U-Net]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_mlp.png|350px|thumb|Conditional MLP]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both; text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
Losses: Conditional Autoencoder, Conditional U-Net, and Conditional MLP&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Mathematical method results with color plates&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method1-color-plates.png|400px|thumb|Method 1 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method2-color-plates.png|400px|thumb|Method 2 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 3 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method3-protan.png|Protanopia&lt;br /&gt;
File:Method3-deutan.png|Deuteranopia&lt;br /&gt;
File:Method3-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 4 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method4-protan.png|Protanopia&lt;br /&gt;
File:Method4-deutan.png|Deuteranopia&lt;br /&gt;
File:Method4-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;br /&gt;
* Researching, writing and running scripts for four (and more) mathematical-based methods (Daltonization, Optimization-based, Confusion lines based, GMM based and some other experiments such as a segmentation-based method which was discarded due to slow performance)&lt;br /&gt;
* Results generation and validation for all scripts written&lt;br /&gt;
* Evaluation metrics scripts for mathematical methods&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60863</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60863"/>
		<updated>2024-12-13T13:20:16Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Mathematical based methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by [10]. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on [10]. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
===== 3. Personalise with Severity Levels =====&lt;br /&gt;
To take into account of severity levels, the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; linearly interpolates between normal vision and full CVD perception based on severity and type:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T} = (1 - s) \mathbf{I} + s \mathbf{T}_{\text{CVD}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; represents the severity of CVD (0-100%), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; is the identity matrix, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}_{\text{CVD}}&amp;lt;/math&amp;gt; is the full transformation matrix specific to protanopia, deuteranopia, or tritanopia. Such a method is based on DaltonLens simulator [13].&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
==== Method 4: Improved with GMM-based Method ====&lt;br /&gt;
The last mathematical method we exprimented enhances recoloring by integrating a Gaussian Mixture Model (GMM)-based global recoloring algorithm. The method also applies nonlinear adjustments for colors near confusion lines to ensure improved contrast and naturalness.&lt;br /&gt;
&lt;br /&gt;
===== 1. GMM-Based Global Recoloring =====&lt;br /&gt;
The image is first resized and transformed into the Lab color space. A GMM is applied to cluster the color distribution into &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; components, optimizing the number of clusters using the Bayesian Information Criterion (BIC):&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{BIC} = -2 \cdot \text{log-likelihood} + P \cdot \log(N),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt; represents the model parameters and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is the number of pixels.&lt;br /&gt;
&lt;br /&gt;
The GMM means are simulated using the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; with severity levels taken into account, and the symmetric Kullback-Leibler (KL) divergence (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{sKL}}&amp;lt;/math&amp;gt;) is calculated between pairs of clusters:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{\text{sKL}}(i, j) = D_{\text{KL}}(G_i \| G_j) + D_{\text{KL}}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt; are Gaussian components, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{KL}}&amp;lt;/math&amp;gt; represents the KL divergence. The GMM cluster means are then adjusted by solving a nonlinear least-squares problem to minimize the discrepancy.&lt;br /&gt;
&lt;br /&gt;
===== 2. Adjusting Near Confusion Lines Improved =====&lt;br /&gt;
Following global recoloring, colors near confusion lines in the CIE 1931 xyY color space are further adjusted based on formulas used in Method 3. Nonlinear scaling is applied to amplify the shifts for pixels closer to the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
w = \left( \frac{\text{threshold} - d}{\text{threshold}} \right)^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w&amp;lt;/math&amp;gt; is the scaling factor. &lt;br /&gt;
&lt;br /&gt;
The adjustments from the GMM and confusion line steps are combined to produce the final recolored image. These enhancements make the method more robust and effective for individuals with varying levels of CVD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
&lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The qualitative results and key observations from the experiments are summarized below. &lt;br /&gt;
&lt;br /&gt;
The result images presented in Figures 10 through 13 follow this sequence: the original image, the CVD-simulated version of the original image, the recolored image, and the CVD-simulated version of the recolored image. The CVD-simulated images demonstrate how the images are perceived by individuals with the corresponding type of CVD. The examples provided focus on protanopia (first row) and deuteranopia (second row) due to space constraints. Additional results for tritanopia and recolored images at varying severity levels are included in the appendix.&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Method 1: Daltonization Baseline&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method1.png|400px|thumb|right|Figure 10: Method 1 Results]]&lt;br /&gt;
&lt;br /&gt;
The Daltonization method provides a foundational approach for recoloring images to enhance visibility for individuals with CVD. Key takeaways from Figure 10 include:&lt;br /&gt;
&lt;br /&gt;
* The method demonstrates significant improvements for protanopia, as seen in the first row, where the recolored images show clear color differences and high contrast. However, for deuteranopia, as shown in the second row, the recolored images exhibit less visible improvements, with lower contrast. This inconsistency highlights the method&#039;s limited ability to generalize across different types of CVD.&lt;br /&gt;
* The method does not account for severity levels or individual differences in CVD perception, which presents an opportunity for further improvement.&lt;br /&gt;
* While the recolored images achieve high contrast between confusing colors, the overall perception of the original image is not preserved. This reduction in naturalness may impact the aesthetic quality and recognizability of the image.&lt;br /&gt;
* Performance: this method is the fastest among the methods tested, as it relies solely on matrix transformations. This makes it computationally efficient and suitable for real-time applications.&lt;br /&gt;
&lt;br /&gt;
The Daltonization method provides a baseline for recoloring but requires enhancements in flexibility, contrast optimization across CVD types, and personalization for varying severity levels.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Method 2: Optimizing Objective Functions&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method2.png|400px|thumb|right|Figure 11 Method 2 Results]]&lt;br /&gt;
* While this method aims to balance naturalness and contrast, the resulting recolored images are similar to the original ones. A possible reason for this is the sensitivity of the loss function to the beta parameter, which requires careful tuning.&lt;br /&gt;
* The recolored images exhibit some loss of fine details, likely due to the use of the k-means clustering algorithm, which simplifies color representation across the image.&lt;br /&gt;
* This algorithm has a very slow runtime, taking over one minute per image. The primary bottlenecks are the color clustering step and the optimization of the objective function, which can be improved significantly.&lt;br /&gt;
* Despite its limitations, this method introduces a flexible framework for customizing loss functions, enabling further improvements. This flexibility was leveraged to refine the method in subsequent methods.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Method 3: Adjustments Near Confusion Lines with Improved Method 2&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method3.png|400px|thumb|right|Figure 12 Method 3 Results]]&lt;br /&gt;
* This method produces recolored images with reasonable contrasts between confusing colors while preserving the naturalness of the image well. It can also account for varying severity levels for each CVD type, providing more personalized recoloring.&lt;br /&gt;
* The performance of the algorithm was improved significantly, reducing from over one minute to approximately 4 seconds per image.&lt;br /&gt;
* In the appendix, we included results with color plates, which commonly used for diagnosing color vision deficiencies, are included in the appendix. This method shows good results, with numbers becoming more easily visible in the CVD-simulated recolored images.&lt;br /&gt;
* Some limitations include the fact that this method sometimes lacks sufficient contrast, particularly for the deuteranopia type. It is also sensitive to parameters, such as the shift factor for colors near the confusion lines, which requires careful tuning. &lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Method 4: Improved with GMM-based Method&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method4.png|400px|thumb|right|Figure 13 Method 4 Results]]&lt;br /&gt;
* This method creates recolored images with very high contrast, making the colors in the images easily distinguishable, even for individuals with severe CVD.&lt;br /&gt;
* By using GMM-based clustering instead of k-means, this method preserves most of the image details. The more sophisticated clustering allows for a better representation of the original color distribution, reducing the loss of fine details.&lt;br /&gt;
* The runtime for this method is significantly faster than most others, taking only around 1 second per image. This makes it highly practical for real-time applications.&lt;br /&gt;
* While the method performs well in enhancing contrast, some recolored images lose the naturalness of the original images. Additionally, certain colors in the recolored images do not transition smoothly, which might be attributed to the clustering step in the process.&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Below are some quantitative results from six metrics. Method 3 and Method 4 perform the best overall.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
! Original vs Recolored !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
| SSIM || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| TCC || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| CD ΔE76 || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE2000 || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE94 || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| D-CIELAB ΔEab || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* SSIM: Measures structural similarity between images, combining luminance, contrast, and structure components. Computed using `torchmetrics.StructuralSimilarityIndexMeasure`.&lt;br /&gt;
&lt;br /&gt;
* TCC: Evaluates changes in total color contrast, compares random pixel pairs in each image and calculates the difference in their color distances. &lt;br /&gt;
&lt;br /&gt;
* D-CIELAB ΔEab: Quantifies perceptual color differences for dichromats under specific CVD types. &lt;br /&gt;
&lt;br /&gt;
* CD ΔE76, CIEDE2000, CIEDE94: Standard perceptual color difference metrics, computed with scikit-image package. ΔE76 is basic Euclidean distance in Lab space, while CIEDE2000 and CIEDE94 include perceptual corrections.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:40%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 (vs. ~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 (vs. ~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
[13] DaltonLens. (n.d.). DaltonLens-Python [Computer software]. GitHub. Retrieved December 13, 2024, from https://github.com/DaltonLens/DaltonLens-Python&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400px|Wikipedia encyclopedia]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_2.png|400px]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|350px|thumb|Conditional Autoencoder]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_unet.png|350px|thumb|Conditional U-Net]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_mlp.png|350px|thumb|Conditional MLP]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both; text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
Losses: Conditional Autoencoder, Conditional U-Net, and Conditional MLP&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Mathematical method results with color plates&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method1-color-plates.png|400px|thumb|Method 1 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method2-color-plates.png|400px|thumb|Method 2 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 3 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method3-protan.png|Protanopia&lt;br /&gt;
File:Method3-deutan.png|Deuteranopia&lt;br /&gt;
File:Method3-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 4 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method4-protan.png|Protanopia&lt;br /&gt;
File:Method4-deutan.png|Deuteranopia&lt;br /&gt;
File:Method4-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;br /&gt;
* Researching, writing and running scripts for four (and more) mathematical-based methods (Daltonization, Optimization-based, Confusion lines based, GMM based and some other experiments such as a segmentation-based method which was discarded due to slow performance)&lt;br /&gt;
* Results generation and validation for all scripts written&lt;br /&gt;
* Evaluation metrics scripts for mathematical methods&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60817</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60817"/>
		<updated>2024-12-13T12:21:59Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Appendix II */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by [10]. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on [10]. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
===== 3. Personalise with Severity Levels =====&lt;br /&gt;
To take into account of severity levels, the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; linearly interpolates between normal vision and full CVD perception based on severity and type:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T} = (1 - s) \mathbf{I} + s \mathbf{T}_{\text{CVD}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; represents the severity of CVD (0-100%), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; is the identity matrix, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}_{\text{CVD}}&amp;lt;/math&amp;gt; is the full transformation matrix specific to protanopia, deuteranopia, or tritanopia. Such a method is based on DaltonLens simulator [13].&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
==== Method 4: Improved with GMM-based Method ====&lt;br /&gt;
The last mathematical method we exprimented enhances recoloring by integrating a Gaussian Mixture Model (GMM)-based global recoloring algorithm. The method also applies nonlinear adjustments for colors near confusion lines to ensure improved contrast and naturalness.&lt;br /&gt;
&lt;br /&gt;
===== 1. GMM-Based Global Recoloring =====&lt;br /&gt;
The image is first resized and transformed into the Lab color space. A GMM is applied to cluster the color distribution into &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; components, optimizing the number of clusters using the Bayesian Information Criterion (BIC):&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{BIC} = -2 \cdot \text{log-likelihood} + P \cdot \log(N),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt; represents the model parameters and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is the number of pixels.&lt;br /&gt;
&lt;br /&gt;
The GMM means are simulated using the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; with severity levels taken into account, and the symmetric Kullback-Leibler (KL) divergence (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{sKL}}&amp;lt;/math&amp;gt;) is calculated between pairs of clusters:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{\text{sKL}}(i, j) = D_{\text{KL}}(G_i \| G_j) + D_{\text{KL}}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt; are Gaussian components, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{KL}}&amp;lt;/math&amp;gt; represents the KL divergence. The GMM cluster means are then adjusted by solving a nonlinear least-squares problem to minimize the discrepancy.&lt;br /&gt;
&lt;br /&gt;
===== 2. Adjusting Near Confusion Lines Improved =====&lt;br /&gt;
Following global recoloring, colors near confusion lines in the CIE 1931 xyY color space are further adjusted based on formulas used in Method 3. Nonlinear scaling is applied to amplify the shifts for pixels closer to the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
w = \left( \frac{\text{threshold} - d}{\text{threshold}} \right)^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w&amp;lt;/math&amp;gt; is the scaling factor. &lt;br /&gt;
&lt;br /&gt;
The adjustments from the GMM and confusion line steps are combined to produce the final recolored image. These enhancements make the method more robust and effective for individuals with varying levels of CVD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
&lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Method 1: Daltonization Baseline&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method1.png|400px|thumb|right|Figure 10 Method 1 Results]]&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Method 2: Optimizing Objective Functions&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method2.png|400px|thumb|right|Figure 11 Method 2 Results]]&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Method 3: Adjustments Near Confusion Lines with Improved Method 2&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method3.png|400px|thumb|right|Figure 12 Method 3 Results]]&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Method 4: Improved with GMM-based Method&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method4.png|400px|thumb|right|Figure 13 Method 4 Results]]&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
! Original vs Recolored !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
| SSIM || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| TCC || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| CD ΔE76 || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE2000 || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE94 || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| D-CIELAB ΔEab || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:40%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 (vs. ~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 (vs. ~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
[13] DaltonLens. (n.d.). DaltonLens-Python [Computer software]. GitHub. Retrieved December 13, 2024, from https://github.com/DaltonLens/DaltonLens-Python&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400px|Wikipedia encyclopedia]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_2.png|400px]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|350px|thumb|Conditional Autoencoder]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_unet.png|350px|thumb|Conditional U-Net]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_mlp.png|350px|thumb|Conditional MLP]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both; text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
Losses: Conditional Autoencoder, Conditional U-Net, and Conditional MLP&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Mathematical method results with color plates&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method1-color-plates.png|400px|thumb|Method 1 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method2-color-plates.png|400px|thumb|Method 2 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 3 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method3-protan.png|Protanopia&lt;br /&gt;
File:Method3-deutan.png|Deuteranopia&lt;br /&gt;
File:Method3-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 4 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method4-protan.png|Protanopia&lt;br /&gt;
File:Method4-deutan.png|Deuteranopia&lt;br /&gt;
File:Method4-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;br /&gt;
* Researching, writing and running scripts for four (and more) mathematical-based methods (Daltonization, Optimization-based, Confusion lines based, GMM based and some other experiments such as a segmentation-based method which was discarded due to slow performance)&lt;br /&gt;
* Results generation and validation for all scripts written&lt;br /&gt;
* Evaluation metrics scripts for mathematical methods&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60784</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60784"/>
		<updated>2024-12-13T11:44:02Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by [10]. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on [10]. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
===== 3. Personalise with Severity Levels =====&lt;br /&gt;
To take into account of severity levels, the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; linearly interpolates between normal vision and full CVD perception based on severity and type:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T} = (1 - s) \mathbf{I} + s \mathbf{T}_{\text{CVD}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; represents the severity of CVD (0-100%), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; is the identity matrix, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}_{\text{CVD}}&amp;lt;/math&amp;gt; is the full transformation matrix specific to protanopia, deuteranopia, or tritanopia. Such a method is based on DaltonLens simulator [13].&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
==== Method 4: Improved with GMM-based Method ====&lt;br /&gt;
The last mathematical method we exprimented enhances recoloring by integrating a Gaussian Mixture Model (GMM)-based global recoloring algorithm. The method also applies nonlinear adjustments for colors near confusion lines to ensure improved contrast and naturalness.&lt;br /&gt;
&lt;br /&gt;
===== 1. GMM-Based Global Recoloring =====&lt;br /&gt;
The image is first resized and transformed into the Lab color space. A GMM is applied to cluster the color distribution into &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; components, optimizing the number of clusters using the Bayesian Information Criterion (BIC):&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{BIC} = -2 \cdot \text{log-likelihood} + P \cdot \log(N),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt; represents the model parameters and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is the number of pixels.&lt;br /&gt;
&lt;br /&gt;
The GMM means are simulated using the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; with severity levels taken into account, and the symmetric Kullback-Leibler (KL) divergence (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{sKL}}&amp;lt;/math&amp;gt;) is calculated between pairs of clusters:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{\text{sKL}}(i, j) = D_{\text{KL}}(G_i \| G_j) + D_{\text{KL}}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt; are Gaussian components, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{KL}}&amp;lt;/math&amp;gt; represents the KL divergence. The GMM cluster means are then adjusted by solving a nonlinear least-squares problem to minimize the discrepancy.&lt;br /&gt;
&lt;br /&gt;
===== 2. Adjusting Near Confusion Lines Improved =====&lt;br /&gt;
Following global recoloring, colors near confusion lines in the CIE 1931 xyY color space are further adjusted based on formulas used in Method 3. Nonlinear scaling is applied to amplify the shifts for pixels closer to the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
w = \left( \frac{\text{threshold} - d}{\text{threshold}} \right)^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w&amp;lt;/math&amp;gt; is the scaling factor. &lt;br /&gt;
&lt;br /&gt;
The adjustments from the GMM and confusion line steps are combined to produce the final recolored image. These enhancements make the method more robust and effective for individuals with varying levels of CVD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
&lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Method 1: Daltonization Baseline&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method1.png|400px|thumb|right|Figure 10 Method 1 Results]]&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Method 2: Optimizing Objective Functions&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method2.png|400px|thumb|right|Figure 11 Method 2 Results]]&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Method 3: Adjustments Near Confusion Lines with Improved Method 2&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method3.png|400px|thumb|right|Figure 12 Method 3 Results]]&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Method 4: Improved with GMM-based Method&#039;&#039;&#039;:&lt;br /&gt;
[[File:Method4.png|400px|thumb|right|Figure 13 Method 4 Results]]&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
! Original vs Recolored !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
| SSIM || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| TCC || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| CD ΔE76 || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE2000 || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE94 || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| D-CIELAB ΔEab || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:40%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 (vs. ~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 (vs. ~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
[13] DaltonLens. (n.d.). DaltonLens-Python [Computer software]. GitHub. Retrieved December 13, 2024, from https://github.com/DaltonLens/DaltonLens-Python&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400px|Wikipedia encyclopedia]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_2.png|400px]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|350px|thumb|Conditional Autoencoder]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_unet.png|350px|thumb|Conditional U-Net]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_mlp.png|350px|thumb|Conditional MLP]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear: both; text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
Losses: Conditional Autoencoder, Conditional U-Net, and Conditional MLP&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Mathematical method results with color plates&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method1-color-plates.png|400px|thumb|Method 1 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline-block; vertical-align: middle;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Method2-color-plates.png|400px|thumb|Method 2 Color Plates Results]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 3 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method3-protan.png|Protanopia&lt;br /&gt;
File:Method3-deutan.png|Deuteranopia&lt;br /&gt;
File:Method3-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align: center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;nolines&amp;quot; widths=&amp;quot;400px&amp;quot; heights=&amp;quot;300px&amp;quot; caption=&amp;quot;Method 4 Color Plates Results for Protanopia, Deuteranopia, and Tritanopia with Severity Levels&amp;quot;&amp;gt;&lt;br /&gt;
File:Method4-protan.png|Protanopia&lt;br /&gt;
File:Method4-deutan.png|Deuteranopia&lt;br /&gt;
File:Method4-tritan.png|Tritanopia&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method2-color-plates.png&amp;diff=60781</id>
		<title>File:Method2-color-plates.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method2-color-plates.png&amp;diff=60781"/>
		<updated>2024-12-13T11:39:48Z</updated>

		<summary type="html">&lt;p&gt;Rainas: Rainas uploaded a new version of File:Method2-color-plates.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method4-tritan.png&amp;diff=60776</id>
		<title>File:Method4-tritan.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method4-tritan.png&amp;diff=60776"/>
		<updated>2024-12-13T11:29:36Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method4-protan.png&amp;diff=60775</id>
		<title>File:Method4-protan.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method4-protan.png&amp;diff=60775"/>
		<updated>2024-12-13T11:29:25Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method4-deutan.png&amp;diff=60774</id>
		<title>File:Method4-deutan.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method4-deutan.png&amp;diff=60774"/>
		<updated>2024-12-13T11:29:15Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method3-tritan.png&amp;diff=60773</id>
		<title>File:Method3-tritan.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method3-tritan.png&amp;diff=60773"/>
		<updated>2024-12-13T11:29:05Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method3-protan.png&amp;diff=60772</id>
		<title>File:Method3-protan.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method3-protan.png&amp;diff=60772"/>
		<updated>2024-12-13T11:28:51Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method3-deutan.png&amp;diff=60771</id>
		<title>File:Method3-deutan.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method3-deutan.png&amp;diff=60771"/>
		<updated>2024-12-13T11:28:38Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method2-color-plates.png&amp;diff=60770</id>
		<title>File:Method2-color-plates.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method2-color-plates.png&amp;diff=60770"/>
		<updated>2024-12-13T11:28:25Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method1-color-plates.png&amp;diff=60769</id>
		<title>File:Method1-color-plates.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method1-color-plates.png&amp;diff=60769"/>
		<updated>2024-12-13T11:28:15Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method4.png&amp;diff=60768</id>
		<title>File:Method4.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method4.png&amp;diff=60768"/>
		<updated>2024-12-13T11:25:34Z</updated>

		<summary type="html">&lt;p&gt;Rainas: Method 4 Results&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Method 4 Results&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method3.png&amp;diff=60767</id>
		<title>File:Method3.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method3.png&amp;diff=60767"/>
		<updated>2024-12-13T11:25:23Z</updated>

		<summary type="html">&lt;p&gt;Rainas: Method 3 Results&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Method 3 Results&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method2.png&amp;diff=60766</id>
		<title>File:Method2.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method2.png&amp;diff=60766"/>
		<updated>2024-12-13T11:25:12Z</updated>

		<summary type="html">&lt;p&gt;Rainas: Method 2 Results&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Method 2 Results&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=File:Method1.png&amp;diff=60765</id>
		<title>File:Method1.png</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=File:Method1.png&amp;diff=60765"/>
		<updated>2024-12-13T11:22:36Z</updated>

		<summary type="html">&lt;p&gt;Rainas: Method 1 Results&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Method 1 Results&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60762</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60762"/>
		<updated>2024-12-13T10:59:46Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by [10]. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on [10]. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
===== 3. Personalise with Severity Levels =====&lt;br /&gt;
To take into account of severity levels, the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; linearly interpolates between normal vision and full CVD perception based on severity and type:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T} = (1 - s) \mathbf{I} + s \mathbf{T}_{\text{CVD}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; represents the severity of CVD (0-100%), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; is the identity matrix, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}_{\text{CVD}}&amp;lt;/math&amp;gt; is the full transformation matrix specific to protanopia, deuteranopia, or tritanopia. Such a method is based on DaltonLens simulator [13].&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
==== Method 4: Improved with GMM-based Method ====&lt;br /&gt;
The last mathematical method we exprimented enhances recoloring by integrating a Gaussian Mixture Model (GMM)-based global recoloring algorithm. The method also applies nonlinear adjustments for colors near confusion lines to ensure improved contrast and naturalness.&lt;br /&gt;
&lt;br /&gt;
===== 1. GMM-Based Global Recoloring =====&lt;br /&gt;
The image is first resized and transformed into the Lab color space. A GMM is applied to cluster the color distribution into &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; components, optimizing the number of clusters using the Bayesian Information Criterion (BIC):&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{BIC} = -2 \cdot \text{log-likelihood} + P \cdot \log(N),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt; represents the model parameters and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is the number of pixels.&lt;br /&gt;
&lt;br /&gt;
The GMM means are simulated using the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; with severity levels taken into account, and the symmetric Kullback-Leibler (KL) divergence (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{sKL}}&amp;lt;/math&amp;gt;) is calculated between pairs of clusters:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{\text{sKL}}(i, j) = D_{\text{KL}}(G_i \| G_j) + D_{\text{KL}}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt; are Gaussian components, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{KL}}&amp;lt;/math&amp;gt; represents the KL divergence. The GMM cluster means are then adjusted by solving a nonlinear least-squares problem to minimize the discrepancy.&lt;br /&gt;
&lt;br /&gt;
===== 2. Adjusting Near Confusion Lines Improved =====&lt;br /&gt;
Following global recoloring, colors near confusion lines in the CIE 1931 xyY color space are further adjusted based on formulas used in Method 3. Nonlinear scaling is applied to amplify the shifts for pixels closer to the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
w = \left( \frac{\text{threshold} - d}{\text{threshold}} \right)^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w&amp;lt;/math&amp;gt; is the scaling factor. &lt;br /&gt;
&lt;br /&gt;
The adjustments from the GMM and confusion line steps are combined to produce the final recolored image. These enhancements make the method more robust and effective for individuals with varying levels of CVD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
&lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Method 1: Daltonization Baseline&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Method 2: Optimizing Objective Functions&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Method 3: Adjustments Near Confusion Lines with Improved Method 2&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Method 4: Improved with GMM-based Method&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
! Original vs Recolored !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
| SSIM || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| TCC || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| CD ΔE76 || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE2000 || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| CIEDE94 || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| D-CIELAB ΔEab || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:40%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 (vs. ~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 (vs. ~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
[13] DaltonLens. (n.d.). DaltonLens-Python [Computer software]. GitHub. Retrieved December 13, 2024, from https://github.com/DaltonLens/DaltonLens-Python&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60759</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60759"/>
		<updated>2024-12-13T10:49:13Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by [10]. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on [10]. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
===== 3. Personalise with Severity Levels =====&lt;br /&gt;
To take into account of severity levels, the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; linearly interpolates between normal vision and full CVD perception based on severity and type:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T} = (1 - s) \mathbf{I} + s \mathbf{T}_{\text{CVD}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;s&amp;lt;/math&amp;gt; represents the severity of CVD (0-100%), &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; is the identity matrix, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}_{\text{CVD}}&amp;lt;/math&amp;gt; is the full transformation matrix specific to protanopia, deuteranopia, or tritanopia. Such a method is based on DaltonLens simulator [13].&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
==== Method 4: Improved with GMM-based Method ====&lt;br /&gt;
The last mathematical method we exprimented enhances recoloring by integrating a Gaussian Mixture Model (GMM)-based global recoloring algorithm. The method also applies nonlinear adjustments for colors near confusion lines to ensure improved contrast and naturalness.&lt;br /&gt;
&lt;br /&gt;
===== 1. GMM-Based Global Recoloring =====&lt;br /&gt;
The image is first resized and transformed into the Lab color space. A GMM is applied to cluster the color distribution into &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; components, optimizing the number of clusters using the Bayesian Information Criterion (BIC):&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{BIC} = -2 \cdot \text{log-likelihood} + P \cdot \log(N),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;P&amp;lt;/math&amp;gt; represents the model parameters and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; is the number of pixels.&lt;br /&gt;
&lt;br /&gt;
The GMM means are simulated using the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T&amp;lt;/math&amp;gt; with severity levels taken into account, and the symmetric Kullback-Leibler (KL) divergence (&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{sKL}}&amp;lt;/math&amp;gt;) is calculated between pairs of clusters:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{\text{sKL}}(i, j) = D_{\text{KL}}(G_i \| G_j) + D_{\text{KL}}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt; are Gaussian components, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{\text{KL}}&amp;lt;/math&amp;gt; represents the KL divergence. The GMM cluster means are then adjusted by solving a nonlinear least-squares problem to minimize the discrepancy.&lt;br /&gt;
&lt;br /&gt;
===== 2. Adjusting Near Confusion Lines Improved =====&lt;br /&gt;
Following global recoloring, colors near confusion lines in the CIE 1931 xyY color space are further adjusted based on formulas used in Method 3. Nonlinear scaling is applied to amplify the shifts for pixels closer to the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
w = \left( \frac{\text{threshold} - d}{\text{threshold}} \right)^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;w&amp;lt;/math&amp;gt; is the scaling factor. &lt;br /&gt;
&lt;br /&gt;
The adjustments from the GMM and confusion line steps are combined to produce the final recolored image. These enhancements make the method more robust and effective for individuals with varying levels of CVD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
[13] DaltonLens. (n.d.). DaltonLens-Python [Computer software]. GitHub. Retrieved December 13, 2024, from https://github.com/DaltonLens/DaltonLens-Python&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60755</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60755"/>
		<updated>2024-12-13T10:25:28Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* GMM-based Method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by [10]. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on [10]. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process for individuals with CVD on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60754</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60754"/>
		<updated>2024-12-13T10:24:19Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Method 3: Improved with Confusion Line Adjustments */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by [10]. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on [10]. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process for individuals with CVD on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60752</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60752"/>
		<updated>2024-12-13T10:23:41Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Mathematical based */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a Baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
==== Method 3: Improved with Confusion Line Adjustments ====&lt;br /&gt;
This method builds upon the previous method by introducing enhancements in dominant color extraction, optimization, and edit propagation, while incorporating an additional step to adjust colors near confusion lines in the CIE 1931 xyY color space inspired by []. These improvements aim to further enhance contrast and naturalness of the recolored images. Moreover, this method adds flexibility in adjusting for different severity levels for each CVD type.&lt;br /&gt;
&lt;br /&gt;
===== 1. Improvements on Method 2 =====&lt;br /&gt;
To improve the performance of dominant color extraction, we transitioned from traditional K-means to MiniBatch K-means. This algorithm processes data in small batches, significantly reducing computational time while maintaining accuracy in clustering. The number of dominant colors was also reduced from 50 to 30 to focus on key representative colors and further enhance efficiency. The optimization objective is refined to leverage vectorization, improving computational efficiency. The two key terms remain:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + (1 - \beta) E_{\text{cont}}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
The optimization objective was refined to significantly improve computational efficiency by replacing the nested loops in the contrast enhancement term with vectorized operations. In the original implementation, the pairwise differences between colors were calculated iteratively using &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;O(N^2)&amp;lt;/math&amp;gt; nested loops. The improved version eliminates this overhead by leveraging array broadcasting to compute all pairwise differences simultaneously, and the transformation matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is then applied to all pairwise differences in a single tensor operation:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{T}_{\Delta} = \text{tensordot}(\Delta_{ij}, \mathbf{T}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
and the norms are computed in parallel across the entire array. Additionally, the weighting parameter &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; was adjusted to favor naturalness preservation, ensuring better visual integrity in the recolored image. &lt;br /&gt;
The propagation step changed to use a k-d tree for fast nearest neighbor searches, replacing grid-based interpolation. This approach more efficiently matches each pixel in the Lab color space to the closest dominant color:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{I}_{\text{adjusted}} = \mathbf{C}_{\text{recolored}}[\text{k-d tree query}(\mathbf{I})],&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in Lab space.&lt;br /&gt;
These refinements enable faster optimization while improving the balance between naturalness and contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
===== 2. Confusion Line Adjustments =====&lt;br /&gt;
An additional step adjusts colors near confusion lines in the CIE 1931 xyY color space to enhance distinguishability:&lt;br /&gt;
&lt;br /&gt;
1. Confusion lines are defined for protanopia, deuteranopia, and tritanopia, based on []. For example, for protanopia:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Confusion Line: Start} = (0.735, 0.265), \quad \text{End} = (0.115, 0.885).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Colors near the confusion line are identified using orthogonal distance:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(\mathbf{xy}, L) = \frac{\| (\mathbf{xy} - \mathbf{p}_1) \times (\mathbf{p}_2 - \mathbf{p}_1) \|}{\|\mathbf{p}_2 - \mathbf{p}_1\|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_1&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{p}_2&amp;lt;/math&amp;gt; are the start and end points of the confusion line.&lt;br /&gt;
&lt;br /&gt;
3. Identified colors are shifted orthogonally away from the line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{xy}_{\text{adjusted}} = \mathbf{xy} + \lambda \mathbf{v}_{\perp},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{v}_{\perp}&amp;lt;/math&amp;gt; is a perpendicular vector, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a scaling factor.&lt;br /&gt;
&lt;br /&gt;
These improvements significantly enhanced both the effectiveness and efficiency of the recoloring process for individuals with CVD on top of Method 2.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60741</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60741"/>
		<updated>2024-12-13T10:03:06Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Method 2: Optimizing Objective Function */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60739</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60739"/>
		<updated>2024-12-13T10:00:06Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* 2. Optimization-Based Recoloring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a MiniBatch K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in [9], and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60736</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60736"/>
		<updated>2024-12-13T09:59:23Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* 3. Edit Propagation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a MiniBatch K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in, and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. This propagation step leverages the CIE-Lab color space, which is perceptually uniform, meaning that the Euclidean distance in this space correlates well with human color perception. The process begins by mapping the original image and the optimized dominant colors into the Lab color space. In this space, the differences between the original and recolored dominant colors are computed to capture the adjustments made during the optimization step:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space. Once the interpolated changes are computed, they are applied to the Lab representation of the original image. Finally, the adjusted Lab values are converted back to the RGB color space to reconstruct the recolored image.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60733</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60733"/>
		<updated>2024-12-13T09:54:14Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* 2. Optimization-Based Recoloring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a MiniBatch K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in, and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [12]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;text-align:center;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. The propagation step uses interpolation in the CIE-Lab color space:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta L^*&amp;lt;/math&amp;gt; adjusts the luminance values. The recolored image is reconstructed by applying the interpolated changes back to the original image and converting it to RGB.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60731</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60731"/>
		<updated>2024-12-13T09:52:09Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Optimization-based method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Method 2: Optimizing Objective Function ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a MiniBatch K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in, and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [13]:&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Protanopia}} = \begin{bmatrix} 0.566 &amp;amp; 0.558 &amp;amp; 0 \\ 0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\ 0 &amp;amp; 0 &amp;amp; 0.758 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Deuteranopia}} = \begin{bmatrix} 0.625 &amp;amp; 0.7 &amp;amp; 0 \\ 0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\ 0 &amp;amp; 0 &amp;amp; 0.7 \end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;&lt;br /&gt;
T_{\text{Tritanopia}} = \begin{bmatrix} 0.95 &amp;amp; 0 &amp;amp; 0 \\ 0.05 &amp;amp; 0.433 &amp;amp; 0 \\ 0 &amp;amp; 0.567 &amp;amp; 1 \end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. The propagation step uses interpolation in the CIE-Lab color space:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta L^*&amp;lt;/math&amp;gt; adjusts the luminance values. The recolored image is reconstructed by applying the interpolated changes back to the original image and converting it to RGB.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60729</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60729"/>
		<updated>2024-12-13T09:50:06Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based method ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a MiniBatch K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in, and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [13]:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Protanopia Transformation Matrix} = \begin{bmatrix}&lt;br /&gt;
0.566 &amp;amp; 0.558 &amp;amp; 0 \\&lt;br /&gt;
0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 0.758&lt;br /&gt;
\end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Deuteranopia Transformation Matrix} = \begin{bmatrix}&lt;br /&gt;
0.625 &amp;amp; 0.7 &amp;amp; 0 \\&lt;br /&gt;
0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 0.7&lt;br /&gt;
\end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Tritanopia Transformation Matrix} = \begin{bmatrix}&lt;br /&gt;
0.95 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0.05 &amp;amp; 0.433 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0.567 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. The propagation step uses interpolation in the CIE-Lab color space:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta L^*&amp;lt;/math&amp;gt; adjusts the luminance values. The recolored image is reconstructed by applying the interpolated changes back to the original image and converting it to RGB.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
[12] Color-Blindness.com. (n.d.). COBLIS - Color Blindness Simulator. Retrieved December 13, 2024, from https://www.color-blindness.com/coblis-color-blindness-simulator/&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60727</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60727"/>
		<updated>2024-12-13T09:49:41Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Optimization-based method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based method ====&lt;br /&gt;
To improve the results from the Daltonization method, we designed a framework inspired by methods discussed in the background, incorporating dominant color extraction, optimization-based recoloring, and edit propagation. This approach aims to find a balance between the naturalness and contrast while compensating colors that are not visible for corresponding CVD types.&lt;br /&gt;
&lt;br /&gt;
===== 1. Extraction of Dominant Colors =====&lt;br /&gt;
We begin by extracting the dominant colors from the input image using fuzzy clustering via a MiniBatch K-means algorithm. This step identifies a reduced set of representative colors that capture the primary color information in the image:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mathbf{C} = \{\mathbf{c}_1, \mathbf{c}_2, \ldots, \mathbf{c}_N\},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;N&amp;lt;/math&amp;gt; represents the number of clusters, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i&amp;lt;/math&amp;gt; represents the centroid of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th cluster.&lt;br /&gt;
&lt;br /&gt;
===== 2. Optimization-Based Recoloring =====&lt;br /&gt;
Once the dominant colors are extracted, we apply an optimization process to adjust these colors. The optimization uses the formulas mentioned in, and aims to balance two key objectives:&lt;br /&gt;
&lt;br /&gt;
1. Naturalness Preservation: Ensures the recolored image minimally deviates from the original.&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{nat}} = \sum_{i=1}^N \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_i^{\text{original}}) \|^2,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{T}&amp;lt;/math&amp;gt; is the transformation matrix based on the severity and type of CVD, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{c}_i^{\text{original}}&amp;lt;/math&amp;gt; is the original color.&lt;br /&gt;
&lt;br /&gt;
2. Contrast Enhancement: Improves the differentiation of colors for individuals with CVD:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_{\text{cont}} = \sum_{i=1}^N \sum_{j&amp;gt;i} \left( \| \mathbf{T} (\mathbf{c}_i - \mathbf{c}_j) \|^2 - \| \mathbf{c}_i^{\text{original}} - \mathbf{c}_j^{\text{original}} \|^2 \right)^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The total objective function combines these two terms:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = \beta E_{\text{nat}} + E_{\text{cont}},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\beta&amp;lt;/math&amp;gt; controls the trade-off between naturalness and contrast.&lt;br /&gt;
&lt;br /&gt;
Optimization is performed using the L-BFGS-B algorithm to ensure efficient convergence under bounded constraints.&lt;br /&gt;
&lt;br /&gt;
The transformation matrices for each type of CVD are the following, which are based on [13]:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Protanopia Transformation Matrix} = \begin{bmatrix}&lt;br /&gt;
0.566 &amp;amp; 0.558 &amp;amp; 0 \\&lt;br /&gt;
0.433 &amp;amp; 0.442 &amp;amp; 0.242 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 0.758&lt;br /&gt;
\end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Deuteranopia Transformation Matrix} = \begin{bmatrix}&lt;br /&gt;
0.625 &amp;amp; 0.7 &amp;amp; 0 \\&lt;br /&gt;
0.375 &amp;amp; 0.3 &amp;amp; 0.3 \\&lt;br /&gt;
0 &amp;amp; 0 &amp;amp; 0.7&lt;br /&gt;
\end{bmatrix},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{Tritanopia Transformation Matrix} = \begin{bmatrix}&lt;br /&gt;
0.95 &amp;amp; 0 &amp;amp; 0 \\&lt;br /&gt;
0.05 &amp;amp; 0.433 &amp;amp; 0 \\&lt;br /&gt;
0 &amp;amp; 0.567 &amp;amp; 1&lt;br /&gt;
\end{bmatrix}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== 3. Edit Propagation =====&lt;br /&gt;
After optimizing the dominant colors, we propagate these edits across the entire image to ensure smooth transitions. The propagation step uses interpolation in the CIE-Lab color space:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Delta L^* = \text{griddata}(\mathbf{c}^{\text{original}}, \mathbf{c}^{\text{recolored}} - \mathbf{c}^{\text{original}}, \mathbf{I}),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mathbf{I}&amp;lt;/math&amp;gt; represents the pixel values in the Lab color space, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Delta L^*&amp;lt;/math&amp;gt; adjusts the luminance values. The recolored image is reconstructed by applying the interpolated changes back to the original image and converting it to RGB.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60718</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60718"/>
		<updated>2024-12-13T09:31:06Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* GMM-based Method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based method ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60714</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60714"/>
		<updated>2024-12-13T09:30:00Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Confusion lines based Method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The process begins with fuzzy clustering, which identifies representative colors (key colors) from the input image. These key colors are then analyzed on the chromaticity diagram, where confusion lines—paths representing colors indistinguishable by individuals with CVD—serve as the basis for recoloring. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. High-ranking colors, determined by their prominence in image clusters, are shifted to the nearest unoccupied confusion lines. This reallocation ensures that these colors are distinguishable to viewers with CVD while minimizing disruption to the image&#039;s overall color harmony.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Diving into more details, the parameters of the GMM are initialized using the K-means algorithm and refined via the Expectation-Maximization (EM) algorithm, which consists of the E-step and the M-step:&lt;br /&gt;
&lt;br /&gt;
The E-step calculates the probability of each color (or pixel) belonging to a specific Gaussian component in the GMM. This probability, also known as the &amp;quot;responsibility,&amp;quot; reflects how much each Gaussian contributes to the representation of a color:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(i|x_j, \Theta^{\text{old}}) = \frac{\omega_i G_i(x_j|\theta_i)}{\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt; is the probability of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt; belonging to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian component,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian, representing its overall contribution to the color distribution,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x_j|\theta_i)&amp;lt;/math&amp;gt; is the Gaussian distribution for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th component, evaluated at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix),&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)&amp;lt;/math&amp;gt; normalizes the probabilities by considering the contributions of all &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussians to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th pixel.&lt;br /&gt;
&lt;br /&gt;
This step essentially assigns each pixel a &amp;quot;soft&amp;quot; membership to each Gaussian component, rather than forcing a hard clustering decision. Pixels that are close to a Gaussian&#039;s mean (in feature space) will have higher probabilities of belonging to that Gaussian.&lt;br /&gt;
&lt;br /&gt;
The M-step updates the parameters of each Gaussian component based on the probabilities computed in the E-step. These updates refine the Gaussian model to better fit the data:&lt;br /&gt;
&lt;br /&gt;
1. Update the mixing weights:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\omega_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}{N},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the proportion of pixels assigned to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It reflects how dominant each Gaussian is in representing the color distribution.&lt;br /&gt;
&lt;br /&gt;
2. Update the means:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mu_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) x_j}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation computes the new mean vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It is a weighted average of all pixel feature vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where the weights are the probabilities &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt;. Pixels with higher probabilities contribute more to the new mean.&lt;br /&gt;
&lt;br /&gt;
3. Update the covariance matrices:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Sigma_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) (x_j - \mu_i^{\text{new}})(x_j - \mu_i^{\text{new}})^T}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the new covariance matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Sigma_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It measures the spread of pixel features around the new mean, weighted by the probabilities from the E-step.&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based method ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60712</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60712"/>
		<updated>2024-12-13T09:19:39Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix because the error contains the information that dichromats cannot see, and the correction matrix rotates it to a part of the spectrum that they can see. For example, the correction matrix, as implemented in tools like Daltonize [5] and Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The method begins with fuzzy clustering to extract representative colors (key colors) from the input image. These colors are mapped onto the CIE 1931 chromaticity diagram, where confusion lines represent loci of colors perceived as identical by individuals with CVD. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. The translation process involves:&lt;br /&gt;
&lt;br /&gt;
1. Ranking key colors by their cluster sizes:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{rank}(v_i) = \frac{|A_i|}{\sum_{j=1}^{n_A}|A_j|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A_i|&amp;lt;/math&amp;gt; is the cardinality (number of pixels) of its associated cluster,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; is the total number of clusters.&lt;br /&gt;
&lt;br /&gt;
2. Translating the highest-ranked confusing color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; to its projection on the nearest non-occupied confusion line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
v^*_{\text{tr}} = \text{proj}(v^*, L^*),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*_{\text{tr}}&amp;lt;/math&amp;gt; is the new position of the color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; after translation,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^*&amp;lt;/math&amp;gt; is the nearest non-occupied confusion line, determined as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(v^*, L^*) = \min_{L \in \text{CL}_D} d(v^*, L).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Updating the sets of confusing colors and non-occupied confusion lines iteratively:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Phi_V = \Phi_V - \{v^*\}, \quad \text{CL}_D = \text{CL}_D - \{L^*\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi_V&amp;lt;/math&amp;gt; is the set of confusing colors,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CL}_D&amp;lt;/math&amp;gt; is the set of non-occupied confusion lines.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Diving into more details, the parameters of the GMM are initialized using the K-means algorithm and refined via the Expectation-Maximization (EM) algorithm, which consists of the E-step and the M-step:&lt;br /&gt;
&lt;br /&gt;
The E-step calculates the probability of each color (or pixel) belonging to a specific Gaussian component in the GMM. This probability, also known as the &amp;quot;responsibility,&amp;quot; reflects how much each Gaussian contributes to the representation of a color:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(i|x_j, \Theta^{\text{old}}) = \frac{\omega_i G_i(x_j|\theta_i)}{\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt; is the probability of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt; belonging to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian component,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian, representing its overall contribution to the color distribution,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x_j|\theta_i)&amp;lt;/math&amp;gt; is the Gaussian distribution for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th component, evaluated at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix),&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)&amp;lt;/math&amp;gt; normalizes the probabilities by considering the contributions of all &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussians to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th pixel.&lt;br /&gt;
&lt;br /&gt;
This step essentially assigns each pixel a &amp;quot;soft&amp;quot; membership to each Gaussian component, rather than forcing a hard clustering decision. Pixels that are close to a Gaussian&#039;s mean (in feature space) will have higher probabilities of belonging to that Gaussian.&lt;br /&gt;
&lt;br /&gt;
The M-step updates the parameters of each Gaussian component based on the probabilities computed in the E-step. These updates refine the Gaussian model to better fit the data:&lt;br /&gt;
&lt;br /&gt;
1. Update the mixing weights:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\omega_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}{N},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the proportion of pixels assigned to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It reflects how dominant each Gaussian is in representing the color distribution.&lt;br /&gt;
&lt;br /&gt;
2. Update the means:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mu_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) x_j}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation computes the new mean vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It is a weighted average of all pixel feature vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where the weights are the probabilities &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt;. Pixels with higher probabilities contribute more to the new mean.&lt;br /&gt;
&lt;br /&gt;
3. Update the covariance matrices:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Sigma_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) (x_j - \mu_i^{\text{new}})(x_j - \mu_i^{\text{new}})^T}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the new covariance matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Sigma_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It measures the spread of pixel features around the new mean, weighted by the probabilities from the E-step.&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
We started with the relatively intuitive Daltonization method, where we adjusted the colors in an image to compensate for color vision deficiencies by simulating how the colors appear to individuals with CVD. This involves computing the difference between the original and simulated color perception in the LMS (Long, Medium, Short wavelength) color space. The calculated error is then corrected and mapped back to the RGB space using a transformation matrix, resulting in a recolored image that enhances color differentiation for viewers with CVD.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, we first transformed colors in RGB color space into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
The error between the original and simulated is then mapped into the RGB color space using a deficiency-specific correction matrix, which adjusts the image to enhance contrast and recover lost color differences. The predefined correction matrix is applied to the error in RGB space, transforming it back into LMS space for final adjustments. The corrected LMS values are added back to the original values, producing a recolored image that improves visual accessibility for viewers with CVD. This approach uses the Daltonize-inspired correction matrix:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based method ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Mathematical based methods ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Table 1: Quantitative Evaluation Results for Mathematical Methods&lt;br /&gt;
!   !! Method 1 !! Method 2 !! Method 3 !! Method 4&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | Performance&lt;br /&gt;
|-&lt;br /&gt;
| Time/image || 0.2s || 1m13s || 4.4s || 1.6s&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | SSIM Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.0066 || 0.9998 || 0.9988 || 0.9902&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.9985 || 0.9985 || 0.9985 || 0.9985&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.9565 || 0.9986 || 0.9986 || 0.9968&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | TCC Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 0.4211 || 0.0001 || 0.0003 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0004 || 0.0003 || 0.0003 || 0.0003&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 0.0380 || 0.0003 || 0.0002 || 0.0005&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CD ΔE76 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.4513 || 0.0217 || 0.0632 || 0.1057&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0462 || 0.0462 || 0.0462 || 0.0462&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 8.4251 || 0.0458 || 0.0435 || 0.0578&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE2000 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 41.2667 || 0.0229 || 0.0675 || 0.1312&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0681 || 0.0681 || 0.0681 || 0.0681&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 6.9145 || 0.0671 || 0.0630 || 0.0838&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | CIEDE94 Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 57.3637 || 0.0217 || 0.0630 || 0.1056&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 0.0461 || 0.0461 || 0.0461 || 0.0461&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 5.3878 || 0.0457 || 0.0434 || 0.0576&lt;br /&gt;
|-&lt;br /&gt;
! colspan=&amp;quot;5&amp;quot; | D-CIELAB ΔEab Metrics&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Recolored || 2.1314 || 3.8863 || 7.6867 || 8.0045&lt;br /&gt;
|-&lt;br /&gt;
| Original vs Original Simulated || 1.7209 || 1.7209 || 1.7209 || 1.7209&lt;br /&gt;
|-&lt;br /&gt;
| Recolored vs Recolored Simulated || 1.5926 || 1.9673 || 1.4363 || 2.4009&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 2 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 2: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60566</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60566"/>
		<updated>2024-12-13T06:33:58Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix. For example, the correction matrix for protanopia, as implemented in tools like Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix for Protanopia} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, colors are first transformed into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The method begins with fuzzy clustering to extract representative colors (key colors) from the input image. These colors are mapped onto the CIE 1931 chromaticity diagram, where confusion lines represent loci of colors perceived as identical by individuals with CVD. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. The translation process involves:&lt;br /&gt;
&lt;br /&gt;
1. Ranking key colors by their cluster sizes:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{rank}(v_i) = \frac{|A_i|}{\sum_{j=1}^{n_A}|A_j|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A_i|&amp;lt;/math&amp;gt; is the cardinality (number of pixels) of its associated cluster,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; is the total number of clusters.&lt;br /&gt;
&lt;br /&gt;
2. Translating the highest-ranked confusing color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; to its projection on the nearest non-occupied confusion line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
v^*_{\text{tr}} = \text{proj}(v^*, L^*),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*_{\text{tr}}&amp;lt;/math&amp;gt; is the new position of the color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; after translation,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^*&amp;lt;/math&amp;gt; is the nearest non-occupied confusion line, determined as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(v^*, L^*) = \min_{L \in \text{CL}_D} d(v^*, L).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Updating the sets of confusing colors and non-occupied confusion lines iteratively:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Phi_V = \Phi_V - \{v^*\}, \quad \text{CL}_D = \text{CL}_D - \{L^*\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi_V&amp;lt;/math&amp;gt; is the set of confusing colors,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CL}_D&amp;lt;/math&amp;gt; is the set of non-occupied confusion lines.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Diving into more details, the parameters of the GMM are initialized using the K-means algorithm and refined via the Expectation-Maximization (EM) algorithm, which consists of the E-step and the M-step:&lt;br /&gt;
&lt;br /&gt;
The E-step calculates the probability of each color (or pixel) belonging to a specific Gaussian component in the GMM. This probability, also known as the &amp;quot;responsibility,&amp;quot; reflects how much each Gaussian contributes to the representation of a color:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(i|x_j, \Theta^{\text{old}}) = \frac{\omega_i G_i(x_j|\theta_i)}{\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt; is the probability of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt; belonging to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian component,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian, representing its overall contribution to the color distribution,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x_j|\theta_i)&amp;lt;/math&amp;gt; is the Gaussian distribution for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th component, evaluated at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix),&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)&amp;lt;/math&amp;gt; normalizes the probabilities by considering the contributions of all &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussians to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th pixel.&lt;br /&gt;
&lt;br /&gt;
This step essentially assigns each pixel a &amp;quot;soft&amp;quot; membership to each Gaussian component, rather than forcing a hard clustering decision. Pixels that are close to a Gaussian&#039;s mean (in feature space) will have higher probabilities of belonging to that Gaussian.&lt;br /&gt;
&lt;br /&gt;
The M-step updates the parameters of each Gaussian component based on the probabilities computed in the E-step. These updates refine the Gaussian model to better fit the data:&lt;br /&gt;
&lt;br /&gt;
1. Update the mixing weights:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\omega_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}{N},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the proportion of pixels assigned to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It reflects how dominant each Gaussian is in representing the color distribution.&lt;br /&gt;
&lt;br /&gt;
2. Update the means:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mu_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) x_j}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation computes the new mean vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It is a weighted average of all pixel feature vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where the weights are the probabilities &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt;. Pixels with higher probabilities contribute more to the new mean.&lt;br /&gt;
&lt;br /&gt;
3. Update the covariance matrices:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Sigma_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) (x_j - \mu_i^{\text{new}})(x_j - \mu_i^{\text{new}})^T}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the new covariance matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Sigma_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It measures the spread of pixel features around the new mean, weighted by the probabilities from the E-step.&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 1 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 1: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60565</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60565"/>
		<updated>2024-12-13T06:33:28Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix. For example, the correction matrix for protanopia, as implemented in tools like Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix for Protanopia} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, colors are first transformed into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The method begins with fuzzy clustering to extract representative colors (key colors) from the input image. These colors are mapped onto the CIE 1931 chromaticity diagram, where confusion lines represent loci of colors perceived as identical by individuals with CVD. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. The translation process involves:&lt;br /&gt;
&lt;br /&gt;
1. Ranking key colors by their cluster sizes:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{rank}(v_i) = \frac{|A_i|}{\sum_{j=1}^{n_A}|A_j|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A_i|&amp;lt;/math&amp;gt; is the cardinality (number of pixels) of its associated cluster,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; is the total number of clusters.&lt;br /&gt;
&lt;br /&gt;
2. Translating the highest-ranked confusing color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; to its projection on the nearest non-occupied confusion line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
v^*_{\text{tr}} = \text{proj}(v^*, L^*),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*_{\text{tr}}&amp;lt;/math&amp;gt; is the new position of the color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; after translation,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^*&amp;lt;/math&amp;gt; is the nearest non-occupied confusion line, determined as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(v^*, L^*) = \min_{L \in \text{CL}_D} d(v^*, L).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Updating the sets of confusing colors and non-occupied confusion lines iteratively:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Phi_V = \Phi_V - \{v^*\}, \quad \text{CL}_D = \text{CL}_D - \{L^*\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi_V&amp;lt;/math&amp;gt; is the set of confusing colors,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CL}_D&amp;lt;/math&amp;gt; is the set of non-occupied confusion lines.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Diving into more details, the parameters of the GMM are initialized using the K-means algorithm and refined via the Expectation-Maximization (EM) algorithm, which consists of the E-step and the M-step:&lt;br /&gt;
&lt;br /&gt;
The E-step calculates the probability of each color (or pixel) belonging to a specific Gaussian component in the GMM. This probability, also known as the &amp;quot;responsibility,&amp;quot; reflects how much each Gaussian contributes to the representation of a color:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(i|x_j, \Theta^{\text{old}}) = \frac{\omega_i G_i(x_j|\theta_i)}{\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt; is the probability of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt; belonging to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian component,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian, representing its overall contribution to the color distribution,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x_j|\theta_i)&amp;lt;/math&amp;gt; is the Gaussian distribution for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th component, evaluated at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix),&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)&amp;lt;/math&amp;gt; normalizes the probabilities by considering the contributions of all &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussians to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th pixel.&lt;br /&gt;
&lt;br /&gt;
This step essentially assigns each pixel a &amp;quot;soft&amp;quot; membership to each Gaussian component, rather than forcing a hard clustering decision. Pixels that are close to a Gaussian&#039;s mean (in feature space) will have higher probabilities of belonging to that Gaussian.&lt;br /&gt;
&lt;br /&gt;
The M-step updates the parameters of each Gaussian component based on the probabilities computed in the E-step. These updates refine the Gaussian model to better fit the data:&lt;br /&gt;
&lt;br /&gt;
1. Update the mixing weights:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\omega_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}{N},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the proportion of pixels assigned to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It reflects how dominant each Gaussian is in representing the color distribution.&lt;br /&gt;
&lt;br /&gt;
2. Update the means:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mu_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) x_j}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation computes the new mean vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It is a weighted average of all pixel feature vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where the weights are the probabilities &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt;. Pixels with higher probabilities contribute more to the new mean.&lt;br /&gt;
&lt;br /&gt;
3. Update the covariance matrices:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Sigma_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) (x_j - \mu_i^{\text{new}})(x_j - \mu_i^{\text{new}})^T}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the new covariance matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Sigma_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It measures the spread of pixel features around the new mean, weighted by the probabilities from the E-step.&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
==== Segmentation Guided Recoloring Method ====&lt;br /&gt;
One interesting method we found using machine learning algorithms is based on semantic segmentation. Chatzistamatis et al. [12] introduced a recoloring approach for digitized art paintings to enhance color perception for individuals with protanopia and deuteranopia. A key component of their method involves semantic segmentation, guided by transfer learning, to identify and preserve important visual elements in art paintings.&lt;br /&gt;
&lt;br /&gt;
The segmentation process leverages the Mask R-CNN architecture, utilizing transfer learning to adapt from natural image datasets to the domain of art paintings. This adaptation involves the following steps:&lt;br /&gt;
&lt;br /&gt;
1. Preprocessing and augmentation: images are preprocessed with techniques such as horizontal flips, random cropping, Gaussian blur, and affine transformations to enhance the diversity of the training set.&lt;br /&gt;
&lt;br /&gt;
2. Feature extraction: the ResNet-101 backbone, pre-trained on the ImageNet dataset, extracts features from input images. Lower layers detect basic features like edges, while higher layers identify complex structures such as objects within paintings.&lt;br /&gt;
&lt;br /&gt;
3. Region proposal: the Region Proposal Network (RPN) identifies regions of interest (RoIs) in the feature maps using sliding windows. These RoIs are further refined into accurate object boundaries.&lt;br /&gt;
&lt;br /&gt;
4. Object masking: masks for the identified objects are generated to preserve fine-grained details of the paintings.&lt;br /&gt;
&lt;br /&gt;
This semantic segmentation process divides the image pixels into two disjoint sets:&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt;, pixels belonging to segmented objects, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_U&amp;lt;/math&amp;gt;, background pixels outside segmented objects.&lt;br /&gt;
&lt;br /&gt;
By separating these sets, the algorithm focuses recoloring efforts on regions that are visually significant while maintaining the natural appearance of the background.&lt;br /&gt;
&lt;br /&gt;
The recoloring process modifies the colors in the segmented object set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt; while leaving the background set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_U&amp;lt;/math&amp;gt; largely intact. Key steps include:&lt;br /&gt;
&lt;br /&gt;
1. Color simulation: colors in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt; are transformed to simulate the perception of dichromatic viewers, enabling identification of indistinguishable colors.&lt;br /&gt;
&lt;br /&gt;
2. Color clustering: fuzzy c-means clustering groups colors into clusters for efficient manipulation. Cluster centers, or &amp;quot;key colors,&amp;quot; are adjusted to reduce color confusion while preserving visual coherence.&lt;br /&gt;
&lt;br /&gt;
3. Recoloring optimization: an objective function is minimized to enhance contrast and naturalness, similar to the objective functions in the methods mentioned above:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
   E = E_1 + E_2 + cE_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt; preserves the contrast between object colors and background colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \sum_{p \in T_V, q \in T_U} \|f(p) - f(q)\| - \|p - q\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt; enhances contrast within object colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \sum_{p, q \in T_V} \|f(p) - f(q)\| - \|p - q\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt; minimizes the perceptual difference between original and recolored key colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \sum_{p \in T_V} \|f(p) - p\|^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;q&amp;lt;/math&amp;gt; are pixel values in the image.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(p)&amp;lt;/math&amp;gt; is the recolored pixel value for pixel &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\| \cdot \|&amp;lt;/math&amp;gt; represents the Euclidean distance in the perceptual color space.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; is a weighting factor that controls the importance of naturalness preservation relative to contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
While the method effectively balances contrast and naturalness for CVD viewers, it has several limitations:&lt;br /&gt;
* The success of segmentation relies heavily on the pre-trained Mask R-CNN model, which may not generalize well to all styles of art or real-life images.&lt;br /&gt;
* Semantic segmentation and optimization introduce significant computational overhead, making the method slow and less suitable for real-time applications.&lt;br /&gt;
* Errors in segmentation are difficult to control and may lead to misclassification of visually important regions, resulting in suboptimal recoloring.&lt;br /&gt;
* The focus of this method is restricted to protanopia and deuteranopia and without any flexibility for personalization.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
We aim to find effective and efficient ways to recolor images for people with CVD with the personalization of different severity levels. We start by exploring existing methods and identifying opportunities for improvement. Since mathematical-based approaches provide a solid foundation and are well-documented, we began our experiments by testing these methods, as described in the background. We later extended our exploration to deep learning based methods.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical based ===&lt;br /&gt;
We explored four main methods, building on the foundational work discussed in the background section.&lt;br /&gt;
&lt;br /&gt;
==== Method 1: Daltonization as a baseline ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 1 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 1: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
* [https://github.com/rainasong/psych221-aut24-final-project.git Code]&lt;br /&gt;
* [https://drive.google.com/drive/folders/10WMXPbtpV7Hy5_qBA_TCEbW-kCpj1D7v Dataset]&lt;br /&gt;
&lt;br /&gt;
=== Additional results ===&lt;br /&gt;
1. &#039;&#039;&#039;Recolored Images - Conditional Autoencoder&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 220px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eb_1.png|400 px|Wikipedia encyclopedia]][[File:eb_2.png|400 px]] &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Loss curves&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;div style=&amp;quot;display: inline; width: 800px; float: center;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:loss_ae.png|300 px|center|thumb|Losses - Conditional Autoencoder]][[File:loss_unet.png|300 px|thumb|center|Losses - Conditional U-Net]][[File:loss_mlp.png|300 px|center|thumb|Losses - Conditional MLP]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for all deep learning methods (MLP, U-Net and Autoencoder)&lt;br /&gt;
* GMM recoloring method in Python &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60514</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60514"/>
		<updated>2024-12-13T05:11:28Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix. For example, the correction matrix for protanopia, as implemented in tools like Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix for Protanopia} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, colors are first transformed into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The method begins with fuzzy clustering to extract representative colors (key colors) from the input image. These colors are mapped onto the CIE 1931 chromaticity diagram, where confusion lines represent loci of colors perceived as identical by individuals with CVD. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. The translation process involves:&lt;br /&gt;
&lt;br /&gt;
1. Ranking key colors by their cluster sizes:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{rank}(v_i) = \frac{|A_i|}{\sum_{j=1}^{n_A}|A_j|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A_i|&amp;lt;/math&amp;gt; is the cardinality (number of pixels) of its associated cluster,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; is the total number of clusters.&lt;br /&gt;
&lt;br /&gt;
2. Translating the highest-ranked confusing color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; to its projection on the nearest non-occupied confusion line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
v^*_{\text{tr}} = \text{proj}(v^*, L^*),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*_{\text{tr}}&amp;lt;/math&amp;gt; is the new position of the color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; after translation,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^*&amp;lt;/math&amp;gt; is the nearest non-occupied confusion line, determined as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(v^*, L^*) = \min_{L \in \text{CL}_D} d(v^*, L).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Updating the sets of confusing colors and non-occupied confusion lines iteratively:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Phi_V = \Phi_V - \{v^*\}, \quad \text{CL}_D = \text{CL}_D - \{L^*\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi_V&amp;lt;/math&amp;gt; is the set of confusing colors,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CL}_D&amp;lt;/math&amp;gt; is the set of non-occupied confusion lines.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Diving into more details, the parameters of the GMM are initialized using the K-means algorithm and refined via the Expectation-Maximization (EM) algorithm, which consists of the E-step and the M-step:&lt;br /&gt;
&lt;br /&gt;
The E-step calculates the probability of each color (or pixel) belonging to a specific Gaussian component in the GMM. This probability, also known as the &amp;quot;responsibility,&amp;quot; reflects how much each Gaussian contributes to the representation of a color:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(i|x_j, \Theta^{\text{old}}) = \frac{\omega_i G_i(x_j|\theta_i)}{\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt; is the probability of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt; belonging to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian component,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian, representing its overall contribution to the color distribution,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x_j|\theta_i)&amp;lt;/math&amp;gt; is the Gaussian distribution for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th component, evaluated at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix),&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)&amp;lt;/math&amp;gt; normalizes the probabilities by considering the contributions of all &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussians to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th pixel.&lt;br /&gt;
&lt;br /&gt;
This step essentially assigns each pixel a &amp;quot;soft&amp;quot; membership to each Gaussian component, rather than forcing a hard clustering decision. Pixels that are close to a Gaussian&#039;s mean (in feature space) will have higher probabilities of belonging to that Gaussian.&lt;br /&gt;
&lt;br /&gt;
The M-step updates the parameters of each Gaussian component based on the probabilities computed in the E-step. These updates refine the Gaussian model to better fit the data:&lt;br /&gt;
&lt;br /&gt;
1. Update the mixing weights:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\omega_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}{N},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the proportion of pixels assigned to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It reflects how dominant each Gaussian is in representing the color distribution.&lt;br /&gt;
&lt;br /&gt;
2. Update the means:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mu_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) x_j}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation computes the new mean vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It is a weighted average of all pixel feature vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where the weights are the probabilities &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt;. Pixels with higher probabilities contribute more to the new mean.&lt;br /&gt;
&lt;br /&gt;
3. Update the covariance matrices:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Sigma_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) (x_j - \mu_i^{\text{new}})(x_j - \mu_i^{\text{new}})^T}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the new covariance matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Sigma_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It measures the spread of pixel features around the new mean, weighted by the probabilities from the E-step.&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
==== Segmentation Guided Recoloring Method ====&lt;br /&gt;
One interesting method we found using machine learning algorithms is based on semantic segmentation. Chatzistamatis et al. [12] introduced a recoloring approach for digitized art paintings to enhance color perception for individuals with protanopia and deuteranopia. A key component of their method involves semantic segmentation, guided by transfer learning, to identify and preserve important visual elements in art paintings.&lt;br /&gt;
&lt;br /&gt;
The segmentation process leverages the Mask R-CNN architecture, utilizing transfer learning to adapt from natural image datasets to the domain of art paintings. This adaptation involves the following steps:&lt;br /&gt;
&lt;br /&gt;
1. Preprocessing and augmentation: images are preprocessed with techniques such as horizontal flips, random cropping, Gaussian blur, and affine transformations to enhance the diversity of the training set.&lt;br /&gt;
&lt;br /&gt;
2. Feature extraction: the ResNet-101 backbone, pre-trained on the ImageNet dataset, extracts features from input images. Lower layers detect basic features like edges, while higher layers identify complex structures such as objects within paintings.&lt;br /&gt;
&lt;br /&gt;
3. Region proposal: the Region Proposal Network (RPN) identifies regions of interest (RoIs) in the feature maps using sliding windows. These RoIs are further refined into accurate object boundaries.&lt;br /&gt;
&lt;br /&gt;
4. Object masking: masks for the identified objects are generated to preserve fine-grained details of the paintings.&lt;br /&gt;
&lt;br /&gt;
This semantic segmentation process divides the image pixels into two disjoint sets:&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt;, pixels belonging to segmented objects, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_U&amp;lt;/math&amp;gt;, background pixels outside segmented objects.&lt;br /&gt;
&lt;br /&gt;
By separating these sets, the algorithm focuses recoloring efforts on regions that are visually significant while maintaining the natural appearance of the background.&lt;br /&gt;
&lt;br /&gt;
The recoloring process modifies the colors in the segmented object set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt; while leaving the background set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_U&amp;lt;/math&amp;gt; largely intact. Key steps include:&lt;br /&gt;
&lt;br /&gt;
1. Color simulation: colors in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt; are transformed to simulate the perception of dichromatic viewers, enabling identification of indistinguishable colors.&lt;br /&gt;
&lt;br /&gt;
2. Color clustering: fuzzy c-means clustering groups colors into clusters for efficient manipulation. Cluster centers, or &amp;quot;key colors,&amp;quot; are adjusted to reduce color confusion while preserving visual coherence.&lt;br /&gt;
&lt;br /&gt;
3. Recoloring optimization: an objective function is minimized to enhance contrast and naturalness, similar to the objective functions in the methods mentioned above:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
   E = E_1 + E_2 + cE_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt; preserves the contrast between object colors and background colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \sum_{p \in T_V, q \in T_U} \|f(p) - f(q)\| - \|p - q\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt; enhances contrast within object colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \sum_{p, q \in T_V} \|f(p) - f(q)\| - \|p - q\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt; minimizes the perceptual difference between original and recolored key colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \sum_{p \in T_V} \|f(p) - p\|^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;q&amp;lt;/math&amp;gt; are pixel values in the image.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(p)&amp;lt;/math&amp;gt; is the recolored pixel value for pixel &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\| \cdot \|&amp;lt;/math&amp;gt; represents the Euclidean distance in the perceptual color space.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; is a weighting factor that controls the importance of naturalness preservation relative to contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
While the method effectively balances contrast and naturalness for CVD viewers, it has several limitations:&lt;br /&gt;
* The success of segmentation relies heavily on the pre-trained Mask R-CNN model, which may not generalize well to all styles of art or real-life images.&lt;br /&gt;
* Semantic segmentation and optimization introduce significant computational overhead, making the method slow and less suitable for real-time applications.&lt;br /&gt;
* Errors in segmentation are difficult to control and may lead to misclassification of visually important regions, resulting in suboptimal recoloring.&lt;br /&gt;
* The focus of this method is restricted to protanopia and deuteranopia and without any flexibility for personalization.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 1 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 1: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for each of MLP, U-Net and Autoencoder&lt;br /&gt;
* GMM-based recolorization (adapting from [4]) &amp;amp; adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup &amp;amp; configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60511</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60511"/>
		<updated>2024-12-13T05:11:02Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix. For example, the correction matrix for protanopia, as implemented in tools like Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix for Protanopia} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, colors are first transformed into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The method begins with fuzzy clustering to extract representative colors (key colors) from the input image. These colors are mapped onto the CIE 1931 chromaticity diagram, where confusion lines represent loci of colors perceived as identical by individuals with CVD. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. The translation process involves:&lt;br /&gt;
&lt;br /&gt;
1. Ranking key colors by their cluster sizes:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{rank}(v_i) = \frac{|A_i|}{\sum_{j=1}^{n_A}|A_j|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A_i|&amp;lt;/math&amp;gt; is the cardinality (number of pixels) of its associated cluster,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; is the total number of clusters.&lt;br /&gt;
&lt;br /&gt;
2. Translating the highest-ranked confusing color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; to its projection on the nearest non-occupied confusion line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
v^*_{\text{tr}} = \text{proj}(v^*, L^*),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*_{\text{tr}}&amp;lt;/math&amp;gt; is the new position of the color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; after translation,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^*&amp;lt;/math&amp;gt; is the nearest non-occupied confusion line, determined as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(v^*, L^*) = \min_{L \in \text{CL}_D} d(v^*, L).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Updating the sets of confusing colors and non-occupied confusion lines iteratively:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Phi_V = \Phi_V - \{v^*\}, \quad \text{CL}_D = \text{CL}_D - \{L^*\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi_V&amp;lt;/math&amp;gt; is the set of confusing colors,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CL}_D&amp;lt;/math&amp;gt; is the set of non-occupied confusion lines.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Diving into more details, the parameters of the GMM are initialized using the K-means algorithm and refined via the Expectation-Maximization (EM) algorithm, which consists of the E-step and the M-step:&lt;br /&gt;
&lt;br /&gt;
The E-step calculates the probability of each color (or pixel) belonging to a specific Gaussian component in the GMM. This probability, also known as the &amp;quot;responsibility,&amp;quot; reflects how much each Gaussian contributes to the representation of a color:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(i|x_j, \Theta^{\text{old}}) = \frac{\omega_i G_i(x_j|\theta_i)}{\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt; is the probability of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt; belonging to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian component,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian, representing its overall contribution to the color distribution,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x_j|\theta_i)&amp;lt;/math&amp;gt; is the Gaussian distribution for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th component, evaluated at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix),&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)&amp;lt;/math&amp;gt; normalizes the probabilities by considering the contributions of all &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussians to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th pixel.&lt;br /&gt;
&lt;br /&gt;
This step essentially assigns each pixel a &amp;quot;soft&amp;quot; membership to each Gaussian component, rather than forcing a hard clustering decision. Pixels that are close to a Gaussian&#039;s mean (in feature space) will have higher probabilities of belonging to that Gaussian.&lt;br /&gt;
&lt;br /&gt;
The M-step updates the parameters of each Gaussian component based on the probabilities computed in the E-step. These updates refine the Gaussian model to better fit the data:&lt;br /&gt;
&lt;br /&gt;
1. Update the mixing weights:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\omega_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}{N},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the proportion of pixels assigned to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It reflects how dominant each Gaussian is in representing the color distribution.&lt;br /&gt;
&lt;br /&gt;
2. Update the means:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mu_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) x_j}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation computes the new mean vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It is a weighted average of all pixel feature vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where the weights are the probabilities &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt;. Pixels with higher probabilities contribute more to the new mean.&lt;br /&gt;
&lt;br /&gt;
3. Update the covariance matrices:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Sigma_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) (x_j - \mu_i^{\text{new}})(x_j - \mu_i^{\text{new}})^T}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the new covariance matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Sigma_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It measures the spread of pixel features around the new mean, weighted by the probabilities from the E-step.&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== Segmentation Guided Recoloring Method ====&lt;br /&gt;
One interesting method we found using machine learning algorithms is based on semantic segmentation. Chatzistamatis et al. [12] introduced a recoloring approach for digitized art paintings to enhance color perception for individuals with protanopia and deuteranopia. A key component of their method involves semantic segmentation, guided by transfer learning, to identify and preserve important visual elements in art paintings.&lt;br /&gt;
&lt;br /&gt;
The segmentation process leverages the Mask R-CNN architecture, utilizing transfer learning to adapt from natural image datasets to the domain of art paintings. This adaptation involves the following steps:&lt;br /&gt;
&lt;br /&gt;
1. Preprocessing and augmentation: images are preprocessed with techniques such as horizontal flips, random cropping, Gaussian blur, and affine transformations to enhance the diversity of the training set.&lt;br /&gt;
&lt;br /&gt;
2. Feature extraction: the ResNet-101 backbone, pre-trained on the ImageNet dataset, extracts features from input images. Lower layers detect basic features like edges, while higher layers identify complex structures such as objects within paintings.&lt;br /&gt;
&lt;br /&gt;
3. Region proposal: the Region Proposal Network (RPN) identifies regions of interest (RoIs) in the feature maps using sliding windows. These RoIs are further refined into accurate object boundaries.&lt;br /&gt;
&lt;br /&gt;
4. Object masking: masks for the identified objects are generated to preserve fine-grained details of the paintings.&lt;br /&gt;
&lt;br /&gt;
This semantic segmentation process divides the image pixels into two disjoint sets:&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt;, pixels belonging to segmented objects, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_U&amp;lt;/math&amp;gt;, background pixels outside segmented objects.&lt;br /&gt;
&lt;br /&gt;
By separating these sets, the algorithm focuses recoloring efforts on regions that are visually significant while maintaining the natural appearance of the background.&lt;br /&gt;
&lt;br /&gt;
The recoloring process modifies the colors in the segmented object set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt; while leaving the background set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_U&amp;lt;/math&amp;gt; largely intact. Key steps include:&lt;br /&gt;
&lt;br /&gt;
1. Color simulation: colors in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt; are transformed to simulate the perception of dichromatic viewers, enabling identification of indistinguishable colors.&lt;br /&gt;
&lt;br /&gt;
2. Color clustering: fuzzy c-means clustering groups colors into clusters for efficient manipulation. Cluster centers, or &amp;quot;key colors,&amp;quot; are adjusted to reduce color confusion while preserving visual coherence.&lt;br /&gt;
&lt;br /&gt;
3. Recoloring optimization: an objective function is minimized to enhance contrast and naturalness, similar to the objective functions in the methods mentioned above:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
   E = E_1 + E_2 + cE_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt; preserves the contrast between object colors and background colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \sum_{p \in T_V, q \in T_U} \|f(p) - f(q)\| - \|p - q\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt; enhances contrast within object colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \sum_{p, q \in T_V} \|f(p) - f(q)\| - \|p - q\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt; minimizes the perceptual difference between original and recolored key colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \sum_{p \in T_V} \|f(p) - p\|^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;q&amp;lt;/math&amp;gt; are pixel values in the image.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(p)&amp;lt;/math&amp;gt; is the recolored pixel value for pixel &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\| \cdot \|&amp;lt;/math&amp;gt; represents the Euclidean distance in the perceptual color space.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; is a weighting factor that controls the importance of naturalness preservation relative to contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
While the method effectively balances contrast and naturalness for CVD viewers, it has several limitations:&lt;br /&gt;
* The success of segmentation relies heavily on the pre-trained Mask R-CNN model, which may not generalize well to all styles of art or real-life images.&lt;br /&gt;
* Semantic segmentation and optimization introduce significant computational overhead, making the method slow and less suitable for real-time applications.&lt;br /&gt;
* Errors in segmentation are difficult to control and may lead to misclassification of visually important regions, resulting in suboptimal recoloring.&lt;br /&gt;
* The focus of this method is restricted to protanopia and deuteranopia and without any flexibility for personalization.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 1 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 1: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for each of MLP, U-Net and Autoencoder&lt;br /&gt;
* Recolorization script (adapting from MATLAB) and adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup and configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60510</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60510"/>
		<updated>2024-12-13T05:10:05Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Segmentation-based Method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix. For example, the correction matrix for protanopia, as implemented in tools like Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix for Protanopia} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, colors are first transformed into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The method begins with fuzzy clustering to extract representative colors (key colors) from the input image. These colors are mapped onto the CIE 1931 chromaticity diagram, where confusion lines represent loci of colors perceived as identical by individuals with CVD. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. The translation process involves:&lt;br /&gt;
&lt;br /&gt;
1. Ranking key colors by their cluster sizes:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{rank}(v_i) = \frac{|A_i|}{\sum_{j=1}^{n_A}|A_j|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A_i|&amp;lt;/math&amp;gt; is the cardinality (number of pixels) of its associated cluster,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; is the total number of clusters.&lt;br /&gt;
&lt;br /&gt;
2. Translating the highest-ranked confusing color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; to its projection on the nearest non-occupied confusion line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
v^*_{\text{tr}} = \text{proj}(v^*, L^*),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*_{\text{tr}}&amp;lt;/math&amp;gt; is the new position of the color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; after translation,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^*&amp;lt;/math&amp;gt; is the nearest non-occupied confusion line, determined as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(v^*, L^*) = \min_{L \in \text{CL}_D} d(v^*, L).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Updating the sets of confusing colors and non-occupied confusion lines iteratively:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Phi_V = \Phi_V - \{v^*\}, \quad \text{CL}_D = \text{CL}_D - \{L^*\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi_V&amp;lt;/math&amp;gt; is the set of confusing colors,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CL}_D&amp;lt;/math&amp;gt; is the set of non-occupied confusion lines.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== Segmentation Guided Recoloring Method ====&lt;br /&gt;
Lastly, one interesting method we found using machine learning algorithms is based on semantic segmentation. Chatzistamatis et al. [12] introduced a recoloring approach for digitized art paintings to enhance color perception for individuals with protanopia and deuteranopia. A key component of their method involves semantic segmentation, guided by transfer learning, to identify and preserve important visual elements in art paintings.&lt;br /&gt;
&lt;br /&gt;
The segmentation process leverages the Mask R-CNN architecture, utilizing transfer learning to adapt from natural image datasets to the domain of art paintings. This adaptation involves the following steps:&lt;br /&gt;
&lt;br /&gt;
1. Preprocessing and augmentation: images are preprocessed with techniques such as horizontal flips, random cropping, Gaussian blur, and affine transformations to enhance the diversity of the training set.&lt;br /&gt;
&lt;br /&gt;
2. Feature extraction: the ResNet-101 backbone, pre-trained on the ImageNet dataset, extracts features from input images. Lower layers detect basic features like edges, while higher layers identify complex structures such as objects within paintings.&lt;br /&gt;
&lt;br /&gt;
3. Region proposal: the Region Proposal Network (RPN) identifies regions of interest (RoIs) in the feature maps using sliding windows. These RoIs are further refined into accurate object boundaries.&lt;br /&gt;
&lt;br /&gt;
4. Object masking: masks for the identified objects are generated to preserve fine-grained details of the paintings.&lt;br /&gt;
&lt;br /&gt;
This semantic segmentation process divides the image pixels into two disjoint sets:&lt;br /&gt;
&amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt;, pixels belonging to segmented objects, and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_U&amp;lt;/math&amp;gt;, background pixels outside segmented objects.&lt;br /&gt;
&lt;br /&gt;
By separating these sets, the algorithm focuses recoloring efforts on regions that are visually significant while maintaining the natural appearance of the background.&lt;br /&gt;
&lt;br /&gt;
The recoloring process modifies the colors in the segmented object set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt; while leaving the background set &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_U&amp;lt;/math&amp;gt; largely intact. Key steps include:&lt;br /&gt;
&lt;br /&gt;
1. Color simulation: colors in &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T_V&amp;lt;/math&amp;gt; are transformed to simulate the perception of dichromatic viewers, enabling identification of indistinguishable colors.&lt;br /&gt;
&lt;br /&gt;
2. Color clustering: fuzzy c-means clustering groups colors into clusters for efficient manipulation. Cluster centers, or &amp;quot;key colors,&amp;quot; are adjusted to reduce color confusion while preserving visual coherence.&lt;br /&gt;
&lt;br /&gt;
3. Recoloring optimization: an objective function is minimized to enhance contrast and naturalness, similar to the objective functions in the methods mentioned above:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
   E = E_1 + E_2 + cE_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt; preserves the contrast between object colors and background colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \sum_{p \in T_V, q \in T_U} \|f(p) - f(q)\| - \|p - q\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt; enhances contrast within object colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \sum_{p, q \in T_V} \|f(p) - f(q)\| - \|p - q\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt; minimizes the perceptual difference between original and recolored key colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \sum_{p \in T_V} \|f(p) - p\|^2.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;q&amp;lt;/math&amp;gt; are pixel values in the image.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f(p)&amp;lt;/math&amp;gt; is the recolored pixel value for pixel &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p&amp;lt;/math&amp;gt;.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\| \cdot \|&amp;lt;/math&amp;gt; represents the Euclidean distance in the perceptual color space.&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;c&amp;lt;/math&amp;gt; is a weighting factor that controls the importance of naturalness preservation relative to contrast enhancement.&lt;br /&gt;
&lt;br /&gt;
While the method effectively balances contrast and naturalness for CVD viewers, it has several limitations:&lt;br /&gt;
* The success of segmentation relies heavily on the pre-trained Mask R-CNN model, which may not generalize well to all styles of art or real-life images.&lt;br /&gt;
* Semantic segmentation and optimization introduce significant computational overhead, making the method slow and less suitable for real-time applications.&lt;br /&gt;
* Errors in segmentation are difficult to control and may lead to misclassification of visually important regions, resulting in suboptimal recoloring.&lt;br /&gt;
* The focus of this method is restricted to protanopia and deuteranopia and without any flexibility for personalization.&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Diving into more details, the parameters of the GMM are initialized using the K-means algorithm and refined via the Expectation-Maximization (EM) algorithm, which consists of the E-step and the M-step:&lt;br /&gt;
&lt;br /&gt;
The E-step calculates the probability of each color (or pixel) belonging to a specific Gaussian component in the GMM. This probability, also known as the &amp;quot;responsibility,&amp;quot; reflects how much each Gaussian contributes to the representation of a color:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(i|x_j, \Theta^{\text{old}}) = \frac{\omega_i G_i(x_j|\theta_i)}{\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt; is the probability of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt; belonging to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian component,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian, representing its overall contribution to the color distribution,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x_j|\theta_i)&amp;lt;/math&amp;gt; is the Gaussian distribution for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th component, evaluated at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix),&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)&amp;lt;/math&amp;gt; normalizes the probabilities by considering the contributions of all &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussians to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th pixel.&lt;br /&gt;
&lt;br /&gt;
This step essentially assigns each pixel a &amp;quot;soft&amp;quot; membership to each Gaussian component, rather than forcing a hard clustering decision. Pixels that are close to a Gaussian&#039;s mean (in feature space) will have higher probabilities of belonging to that Gaussian.&lt;br /&gt;
&lt;br /&gt;
The M-step updates the parameters of each Gaussian component based on the probabilities computed in the E-step. These updates refine the Gaussian model to better fit the data:&lt;br /&gt;
&lt;br /&gt;
1. Update the mixing weights:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\omega_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}{N},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the proportion of pixels assigned to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It reflects how dominant each Gaussian is in representing the color distribution.&lt;br /&gt;
&lt;br /&gt;
2. Update the means:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mu_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) x_j}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation computes the new mean vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It is a weighted average of all pixel feature vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where the weights are the probabilities &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt;. Pixels with higher probabilities contribute more to the new mean.&lt;br /&gt;
&lt;br /&gt;
3. Update the covariance matrices:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Sigma_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) (x_j - \mu_i^{\text{new}})(x_j - \mu_i^{\text{new}})^T}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the new covariance matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Sigma_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It measures the spread of pixel features around the new mean, weighted by the probabilities from the E-step.&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 1 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 1: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for each of MLP, U-Net and Autoencoder&lt;br /&gt;
* Recolorization script (adapting from MATLAB) and adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup and configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60506</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60506"/>
		<updated>2024-12-13T04:56:33Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix. For example, the correction matrix for protanopia, as implemented in tools like Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix for Protanopia} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, colors are first transformed into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The method begins with fuzzy clustering to extract representative colors (key colors) from the input image. These colors are mapped onto the CIE 1931 chromaticity diagram, where confusion lines represent loci of colors perceived as identical by individuals with CVD. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. The translation process involves:&lt;br /&gt;
&lt;br /&gt;
1. Ranking key colors by their cluster sizes:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{rank}(v_i) = \frac{|A_i|}{\sum_{j=1}^{n_A}|A_j|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A_i|&amp;lt;/math&amp;gt; is the cardinality (number of pixels) of its associated cluster,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; is the total number of clusters.&lt;br /&gt;
&lt;br /&gt;
2. Translating the highest-ranked confusing color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; to its projection on the nearest non-occupied confusion line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
v^*_{\text{tr}} = \text{proj}(v^*, L^*),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*_{\text{tr}}&amp;lt;/math&amp;gt; is the new position of the color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; after translation,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^*&amp;lt;/math&amp;gt; is the nearest non-occupied confusion line, determined as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(v^*, L^*) = \min_{L \in \text{CL}_D} d(v^*, L).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Updating the sets of confusing colors and non-occupied confusion lines iteratively:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Phi_V = \Phi_V - \{v^*\}, \quad \text{CL}_D = \text{CL}_D - \{L^*\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi_V&amp;lt;/math&amp;gt; is the set of confusing colors,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CL}_D&amp;lt;/math&amp;gt; is the set of non-occupied confusion lines.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== Segmentation-based Method ====&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Diving into more details, the parameters of the GMM are initialized using the K-means algorithm and refined via the Expectation-Maximization (EM) algorithm, which consists of the E-step and the M-step:&lt;br /&gt;
&lt;br /&gt;
The E-step calculates the probability of each color (or pixel) belonging to a specific Gaussian component in the GMM. This probability, also known as the &amp;quot;responsibility,&amp;quot; reflects how much each Gaussian contributes to the representation of a color:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(i|x_j, \Theta^{\text{old}}) = \frac{\omega_i G_i(x_j|\theta_i)}{\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt; is the probability of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt; belonging to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian component,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian, representing its overall contribution to the color distribution,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x_j|\theta_i)&amp;lt;/math&amp;gt; is the Gaussian distribution for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th component, evaluated at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix),&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)&amp;lt;/math&amp;gt; normalizes the probabilities by considering the contributions of all &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussians to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th pixel.&lt;br /&gt;
&lt;br /&gt;
This step essentially assigns each pixel a &amp;quot;soft&amp;quot; membership to each Gaussian component, rather than forcing a hard clustering decision. Pixels that are close to a Gaussian&#039;s mean (in feature space) will have higher probabilities of belonging to that Gaussian.&lt;br /&gt;
&lt;br /&gt;
The M-step updates the parameters of each Gaussian component based on the probabilities computed in the E-step. These updates refine the Gaussian model to better fit the data:&lt;br /&gt;
&lt;br /&gt;
1. Update the mixing weights:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\omega_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}{N},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the proportion of pixels assigned to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It reflects how dominant each Gaussian is in representing the color distribution.&lt;br /&gt;
&lt;br /&gt;
2. Update the means:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mu_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) x_j}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation computes the new mean vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It is a weighted average of all pixel feature vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where the weights are the probabilities &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt;. Pixels with higher probabilities contribute more to the new mean.&lt;br /&gt;
&lt;br /&gt;
3. Update the covariance matrices:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Sigma_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) (x_j - \mu_i^{\text{new}})(x_j - \mu_i^{\text{new}})^T}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the new covariance matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Sigma_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It measures the spread of pixel features around the new mean, weighted by the probabilities from the E-step.&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 1 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 1: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] Li, H., Zhang, L., Zhang, X., Zhang, M., Zhu, G., Shen, P., ... &amp;amp; Shah, S. A. A. (2020). Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs. Multimedia Tools and Applications, 79, 27583-27614.&lt;br /&gt;
&lt;br /&gt;
[2] Chen, L., Zhu, Z., Huang, W., Go, K., Chen, X., &amp;amp; Mao, X. (2024). Image recoloring for color vision deficiency compensation using Swin transformer. Neural Computing and Applications, 36(11), 6051-6066.&lt;br /&gt;
&lt;br /&gt;
[3] Jiang, S., Liu, D., Li, D., &amp;amp; Xu, C. (2023). Personalized image generation for color vision deficiency population. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 22571-22580).&lt;br /&gt;
&lt;br /&gt;
[4] Huang, J.-B., Chen, C.-S., Jen, T.-C., &amp;amp; Wang, S.-J. (n.d.). Image recolorization for the colorblind [GitHub repository]. Retrieved December 12, 2024, from https://github.com/jbhuang0604/RecolorForColorblind&lt;br /&gt;
&lt;br /&gt;
[5] Dietrich, J. (n.d.). Daltonize Python Package [GitHub repository]. Retrieved December 12, 2024, from https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py&lt;br /&gt;
&lt;br /&gt;
[6] Dougherty, B., &amp;amp; Wade, A. (2000). Vischeck. Retrieved December 12, 2024, from https://www.vischeck.com/&lt;br /&gt;
&lt;br /&gt;
[7] Brettel, H., Viénot, F., &amp;amp; Mollon, J. D. (1997). Computerized simulation of color appearance for dichromats. Josa a, 14(10), 2647-2655.&lt;br /&gt;
&lt;br /&gt;
[8] Zhu, Z., Toyoura, M., Go, K., Fujishiro, I., Kashiwagi, K., &amp;amp; Mao, X. (2019). Processing images for red–green dichromats compensation via naturalness and information-preservation considered recoloring. The Visual Computer, 35, 1053-1066.&lt;br /&gt;
&lt;br /&gt;
[9] Zhu, Z., Toyoura, M., Go, K., Kashiwagi, K., Fujishiro, I., Wong, T. T., &amp;amp; Mao, X. (2021). Personalized image recoloring for color vision deficiency compensation. IEEE Transactions on Multimedia, 24, 1721-1734.&lt;br /&gt;
&lt;br /&gt;
[10] Tsekouras, G. E., Rigos, A., Chatzistamatis, S., Tsimikas, J., Kotis, K., Caridakis, G., &amp;amp; Anagnostopoulos, C. N. (2021). A novel approach to image recoloring for color vision deficiency. Sensors, 21(8), 2740.&lt;br /&gt;
&lt;br /&gt;
[11] Huang, J. B., Chen, C. S., Jen, T. C., &amp;amp; Wang, S. J. (2009, April). Image recolorization for the colorblind. In 2009 IEEE International Conference on Acoustics, Speech and Signal Processing (pp. 1161-1164). IEEE.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for each of MLP, U-Net and Autoencoder&lt;br /&gt;
* Recolorization script (adapting from MATLAB) and adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup and configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60504</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60504"/>
		<updated>2024-12-13T04:48:49Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* GMM-based Method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix. For example, the correction matrix for protanopia, as implemented in tools like Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix for Protanopia} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, colors are first transformed into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The method begins with fuzzy clustering to extract representative colors (key colors) from the input image. These colors are mapped onto the CIE 1931 chromaticity diagram, where confusion lines represent loci of colors perceived as identical by individuals with CVD. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. The translation process involves:&lt;br /&gt;
&lt;br /&gt;
1. Ranking key colors by their cluster sizes:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{rank}(v_i) = \frac{|A_i|}{\sum_{j=1}^{n_A}|A_j|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A_i|&amp;lt;/math&amp;gt; is the cardinality (number of pixels) of its associated cluster,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; is the total number of clusters.&lt;br /&gt;
&lt;br /&gt;
2. Translating the highest-ranked confusing color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; to its projection on the nearest non-occupied confusion line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
v^*_{\text{tr}} = \text{proj}(v^*, L^*),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*_{\text{tr}}&amp;lt;/math&amp;gt; is the new position of the color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; after translation,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^*&amp;lt;/math&amp;gt; is the nearest non-occupied confusion line, determined as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(v^*, L^*) = \min_{L \in \text{CL}_D} d(v^*, L).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Updating the sets of confusing colors and non-occupied confusion lines iteratively:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Phi_V = \Phi_V - \{v^*\}, \quad \text{CL}_D = \text{CL}_D - \{L^*\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi_V&amp;lt;/math&amp;gt; is the set of confusing colors,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CL}_D&amp;lt;/math&amp;gt; is the set of non-occupied confusion lines.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== Segmentation-based Method ====&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
Huang et al. [11] proposed an efficient and effective re-coloring algorithm for individuals with CVD using a Gaussian Mixture Model (GMM) to represent color distributions. The algorithm comprises four main steps: feature extraction, clustering using GMM, optimization of Gaussian components, and interpolation for recoloring.&lt;br /&gt;
&lt;br /&gt;
Step 1 - Feature Extraction:&lt;br /&gt;
Each pixel in the input image is represented in the CIEL*a*b* color space, which approximates perceptual differences using the Euclidean distance between colors. The color feature vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x&amp;lt;/math&amp;gt; is used as input for clustering.&lt;br /&gt;
&lt;br /&gt;
Step 2 - Clustering via GMM:&lt;br /&gt;
The color distribution of the image is modeled using a GMM with &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussian components:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(x|\Theta) = \sum_{i=1}^K \omega_i G_i(x|\theta_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Theta&amp;lt;/math&amp;gt; is the parameter set containing all weights, means, and covariance matrices,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x|\theta_i)&amp;lt;/math&amp;gt; is the 3D normal distribution with parameters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix).&lt;br /&gt;
&lt;br /&gt;
Diving into more details, the parameters of the GMM are initialized using the K-means algorithm and refined via the Expectation-Maximization (EM) algorithm, which consists of the E-step and the M-step:&lt;br /&gt;
&lt;br /&gt;
The E-step calculates the probability of each color (or pixel) belonging to a specific Gaussian component in the GMM. This probability, also known as the &amp;quot;responsibility,&amp;quot; reflects how much each Gaussian contributes to the representation of a color:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
p(i|x_j, \Theta^{\text{old}}) = \frac{\omega_i G_i(x_j|\theta_i)}{\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt; is the probability of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt; belonging to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian component,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\omega_i&amp;lt;/math&amp;gt; is the mixing weight of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian, representing its overall contribution to the color distribution,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i(x_j|\theta_i)&amp;lt;/math&amp;gt; is the Gaussian distribution for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th component, evaluated at &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\theta_i = (\mu_i, \Sigma_i)&amp;lt;/math&amp;gt; (mean vector and covariance matrix),&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\sum_{k=1}^K \omega_k G_k(x_j|\theta_k)&amp;lt;/math&amp;gt; normalizes the probabilities by considering the contributions of all &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt; Gaussians to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th pixel.&lt;br /&gt;
&lt;br /&gt;
This step essentially assigns each pixel a &amp;quot;soft&amp;quot; membership to each Gaussian component, rather than forcing a hard clustering decision. Pixels that are close to a Gaussian&#039;s mean (in feature space) will have higher probabilities of belonging to that Gaussian.&lt;br /&gt;
&lt;br /&gt;
The M-step updates the parameters of each Gaussian component based on the probabilities computed in the E-step. These updates refine the Gaussian model to better fit the data:&lt;br /&gt;
&lt;br /&gt;
1. Update the mixing weights:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\omega_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}{N},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the proportion of pixels assigned to the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It reflects how dominant each Gaussian is in representing the color distribution.&lt;br /&gt;
&lt;br /&gt;
2. Update the means:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\mu_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) x_j}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation computes the new mean vector &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\mu_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It is a weighted average of all pixel feature vectors &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;x_j&amp;lt;/math&amp;gt;, where the weights are the probabilities &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;p(i|x_j, \Theta^{\text{old}})&amp;lt;/math&amp;gt;. Pixels with higher probabilities contribute more to the new mean.&lt;br /&gt;
&lt;br /&gt;
3. Update the covariance matrices:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Sigma_i^{\text{new}} = \frac{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}}) (x_j - \mu_i^{\text{new}})(x_j - \mu_i^{\text{new}})^T}{\sum_{j=1}^N p(i|x_j, \Theta^{\text{old}})}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
This equation calculates the new covariance matrix &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Sigma_i^{\text{new}}&amp;lt;/math&amp;gt; for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian. It measures the spread of pixel features around the new mean, weighted by the probabilities from the E-step.&lt;br /&gt;
&lt;br /&gt;
Step 3 - Optimization: &lt;br /&gt;
To ensure color distinguishability for CVD viewers, the algorithm adjusts the mean vector of each Gaussian component using an optimization function that preserves the symmetric Kullback-Leibler (KL) divergence:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
D_{sKL}(G_i, G_j) = D_{KL}(G_i \| G_j) + D_{KL}(G_j \| G_i),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;D_{KL}(G_i \| G_j)&amp;lt;/math&amp;gt; measures the dissimilarity between two Gaussian distributions &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;G_j&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The optimization aims to preserve the contrast perceived by CVD viewers while maintaining naturalness. Weights are assigned to Gaussian components based on the perceptual importance of colors:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\lambda_i = \frac{\sum_{j=1}^N \alpha_j p(i|x_j, \Theta)}{\sum_{k=1}^K \sum_{j=1}^N \alpha_j p(k|x_j, \Theta)},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\alpha_j = \|x_j - \text{Sim}(x_j)\|&amp;lt;/math&amp;gt; is the perceptual error of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color feature when simulated for CVD,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{Sim}(\cdot)&amp;lt;/math&amp;gt; is the simulation function for CVD perception.&lt;br /&gt;
&lt;br /&gt;
Step 4 - Interpolation for Recoloring:&lt;br /&gt;
After optimizing the Gaussians, the mapping function &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\cdot)&amp;lt;/math&amp;gt; relocates the mean vectors while maintaining covariance matrices. Interpolation ensures smooth transitions between recolored regions:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
T(x_j)_H = x_j^H + \sum_{i=1}^K p(i|x_j, \Theta) (M_i(\mu_i)_H - \mu_i^H),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;T(x_j)_H&amp;lt;/math&amp;gt; is the hue adjustment for the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;M_i(\mu_i)_H&amp;lt;/math&amp;gt; is the mapped hue of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th Gaussian&#039;s mean.&lt;br /&gt;
&lt;br /&gt;
While the GMM-based approach effectively models color distributions and enhances the contrast of recolored images significantly, it has limitations:&lt;br /&gt;
* The accuracy of recoloring depends on the choice of &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;K&amp;lt;/math&amp;gt;, which may vary for different images.&lt;br /&gt;
* The method assumes diagonal covariance matrices for computational efficiency, which may oversimplify real-world color distributions. Sometimes the colors in the recolored images are not very natural.&lt;br /&gt;
* The high computational complexity in the optimization step of this algorithm may be difficult for real-time applications.&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 1 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 1: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] H. Li, L. Zhang, X. Zhang, M. Zhang, G. Zhu, P. Shen, P. Li, M. Bennamoun, and S. A. A. Shah, &amp;quot;Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs,&amp;quot; Multimedia Tools and Applications, vol. 79, no. 37–38, pp. 27583–27614, 2020, doi: 10.1007/s11042-020-09299-2.&lt;br /&gt;
&lt;br /&gt;
[2] L. Chen, Z. Zhu, W. Huang, K. Go, X. Chen, and X. Mao, &amp;quot;Image recoloring for color vision deficiency compensation using Swin transformer,&amp;quot; Neural Computing and Applications, vol. 36, no. 11, pp. 6051–6066, 2024, doi: 10.1007/s00521-023-09367-2.&lt;br /&gt;
&lt;br /&gt;
[3] S. Jiang, D. Liu, D. Li, and C. Xu, &amp;quot;Personalized Image Generation for Color Vision Deficiency Population,&amp;quot; in 2023 IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 2023, pp. 22514–22523, doi: 10.1109/ICCV51070.2023.02063.&lt;br /&gt;
&lt;br /&gt;
[4] J.-B. Huang, C.-S. Chen, T.-C. Jen, and S.-J. Wang, &amp;quot;Image recolorization for the colorblind,&amp;quot; GitHub repository, [Online]. Available: https://github.com/jbhuang0604/RecolorForColorblind. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[5] J. Dietrich, &amp;quot;Daltonize Python Package,&amp;quot; GitHub repository, [Online]. Available: https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[6] B. Dougherty and A. Wade, &amp;quot;Vischeck,&amp;quot; 2000. [Online]. Available: https://www.vischeck.com/. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[7] J. Brettel, F. Viénot, and J. D. Mollon, &amp;quot;Computerized simulation of color appearance for dichromats,&amp;quot; Journal of the Optical Society of America A, vol. 14, no. 10, pp. 2647–2655, 1997, doi: 10.1364/JOSAA.14.002647.&lt;br /&gt;
&lt;br /&gt;
[8] Z. Zhu, M. Toyoura, K. Go, I. Fujishiro, K. Kashiwagi, and X. Mao, &amp;quot;Processing images for red-green dichromats compensation via naturalness and information-preservation considered recoloring,&amp;quot; Visual Computer, vol. 35, no. 6–8, pp. 1053–1066, 2019, doi: 10.1007/s00371-019-01723-5.&lt;br /&gt;
&lt;br /&gt;
[9] Z. Zhu, M. Toyoura, K. Go, I. Fujishiro, K. Kashiwagi, and X. Mao, &amp;quot;Personalized image recoloring for color vision deficiency compensation,&amp;quot; IEEE Transactions on Multimedia, vol. 24, pp. 1721–1733, 2022, doi: 10.1109/TMM.2021.3130546.&lt;br /&gt;
&lt;br /&gt;
[10] G. E. Tsekouras, A. Rigos, S. Chatzistamatis, and N. Grammalidis, &amp;quot;A novel approach to image recoloring for color vision deficiency,&amp;quot; Sensors, vol. 21, no. 8, p. 2740, Apr. 2021, doi: 10.3390/s21082740.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for each of MLP, U-Net and Autoencoder&lt;br /&gt;
* Recolorization script (adapting from MATLAB) and adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup and configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60492</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60492"/>
		<updated>2024-12-13T04:23:02Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix. For example, the correction matrix for protanopia, as implemented in tools like Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix for Protanopia} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, colors are first transformed into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion lines based Method ====&lt;br /&gt;
Tsekouras et al. [10] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The method begins with fuzzy clustering to extract representative colors (key colors) from the input image. These colors are mapped onto the CIE 1931 chromaticity diagram, where confusion lines represent loci of colors perceived as identical by individuals with CVD. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. The translation process involves:&lt;br /&gt;
&lt;br /&gt;
1. Ranking key colors by their cluster sizes:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{rank}(v_i) = \frac{|A_i|}{\sum_{j=1}^{n_A}|A_j|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A_i|&amp;lt;/math&amp;gt; is the cardinality (number of pixels) of its associated cluster,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; is the total number of clusters.&lt;br /&gt;
&lt;br /&gt;
2. Translating the highest-ranked confusing color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; to its projection on the nearest non-occupied confusion line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
v^*_{\text{tr}} = \text{proj}(v^*, L^*),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*_{\text{tr}}&amp;lt;/math&amp;gt; is the new position of the color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; after translation,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^*&amp;lt;/math&amp;gt; is the nearest non-occupied confusion line, determined as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(v^*, L^*) = \min_{L \in \text{CL}_D} d(v^*, L).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Updating the sets of confusing colors and non-occupied confusion lines iteratively:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Phi_V = \Phi_V - \{v^*\}, \quad \text{CL}_D = \text{CL}_D - \{L^*\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi_V&amp;lt;/math&amp;gt; is the set of confusing colors,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CL}_D&amp;lt;/math&amp;gt; is the set of non-occupied confusion lines.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== Segmentation-based Method ====&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 1 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 1: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] H. Li, L. Zhang, X. Zhang, M. Zhang, G. Zhu, P. Shen, P. Li, M. Bennamoun, and S. A. A. Shah, &amp;quot;Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs,&amp;quot; Multimedia Tools and Applications, vol. 79, no. 37–38, pp. 27583–27614, 2020, doi: 10.1007/s11042-020-09299-2.&lt;br /&gt;
&lt;br /&gt;
[2] L. Chen, Z. Zhu, W. Huang, K. Go, X. Chen, and X. Mao, &amp;quot;Image recoloring for color vision deficiency compensation using Swin transformer,&amp;quot; Neural Computing and Applications, vol. 36, no. 11, pp. 6051–6066, 2024, doi: 10.1007/s00521-023-09367-2.&lt;br /&gt;
&lt;br /&gt;
[3] S. Jiang, D. Liu, D. Li, and C. Xu, &amp;quot;Personalized Image Generation for Color Vision Deficiency Population,&amp;quot; in 2023 IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 2023, pp. 22514–22523, doi: 10.1109/ICCV51070.2023.02063.&lt;br /&gt;
&lt;br /&gt;
[4] J.-B. Huang, C.-S. Chen, T.-C. Jen, and S.-J. Wang, &amp;quot;Image recolorization for the colorblind,&amp;quot; GitHub repository, [Online]. Available: https://github.com/jbhuang0604/RecolorForColorblind. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[5] J. Dietrich, &amp;quot;Daltonize Python Package,&amp;quot; GitHub repository, [Online]. Available: https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[6] B. Dougherty and A. Wade, &amp;quot;Vischeck,&amp;quot; 2000. [Online]. Available: https://www.vischeck.com/. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[7] J. Brettel, F. Viénot, and J. D. Mollon, &amp;quot;Computerized simulation of color appearance for dichromats,&amp;quot; Journal of the Optical Society of America A, vol. 14, no. 10, pp. 2647–2655, 1997, doi: 10.1364/JOSAA.14.002647.&lt;br /&gt;
&lt;br /&gt;
[8] Z. Zhu, M. Toyoura, K. Go, I. Fujishiro, K. Kashiwagi, and X. Mao, &amp;quot;Processing images for red-green dichromats compensation via naturalness and information-preservation considered recoloring,&amp;quot; Visual Computer, vol. 35, no. 6–8, pp. 1053–1066, 2019, doi: 10.1007/s00371-019-01723-5.&lt;br /&gt;
&lt;br /&gt;
[9] Z. Zhu, M. Toyoura, K. Go, I. Fujishiro, K. Kashiwagi, and X. Mao, &amp;quot;Personalized image recoloring for color vision deficiency compensation,&amp;quot; IEEE Transactions on Multimedia, vol. 24, pp. 1721–1733, 2022, doi: 10.1109/TMM.2021.3130546.&lt;br /&gt;
&lt;br /&gt;
[10] G. E. Tsekouras, A. Rigos, S. Chatzistamatis, and N. Grammalidis, &amp;quot;A novel approach to image recoloring for color vision deficiency,&amp;quot; Sensors, vol. 21, no. 8, p. 2740, Apr. 2021, doi: 10.3390/s21082740.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for each of MLP, U-Net and Autoencoder&lt;br /&gt;
* Recolorization script (adapting from MATLAB) and adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup and configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60490</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60490"/>
		<updated>2024-12-13T04:21:15Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Confusion-line-based Method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix. For example, the correction matrix for protanopia, as implemented in tools like Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix for Protanopia} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, colors are first transformed into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion-line-based Method ====&lt;br /&gt;
Tsekouras et al. [8] proposed a novel image recoloring approach for individuals with protanopia and deuteranopia, focusing on improving color naturalness and enhancing contrast. Their framework consists of four modules, with a key focus on shifting confusing colors along confusion lines in the CIE 1931 chromaticity diagram.&lt;br /&gt;
&lt;br /&gt;
The method begins with fuzzy clustering to extract representative colors (key colors) from the input image. These colors are mapped onto the CIE 1931 chromaticity diagram, where confusion lines represent loci of colors perceived as identical by individuals with CVD. Confusion lines are defined using the copunctal point of the missing cone type and another reference point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
d(v, L) = \frac{\left|(x_{cp} - x_0)(y_0 - y_v) - (x_0 - x_v)(y_{cp} - y_0)\right|}{\sqrt{(x_{cp} - x_0)^2 + (y_{cp} - y_0)^2}}, &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v = (x_v, y_v)&amp;lt;/math&amp;gt; is the chromaticity coordinate of the color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt; is the confusion line passing through the copunctal point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_{cp}, y_{cp})&amp;lt;/math&amp;gt; and another reference point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;(x_0, y_0)&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;d(v, L)&amp;lt;/math&amp;gt; measures the perpendicular distance from the point &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v&amp;lt;/math&amp;gt; to the confusion line &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Confusing colors, identified as key colors lying on occupied confusion lines, are iteratively shifted to the nearest non-occupied confusion lines to enhance discriminability for CVD viewers. The translation process involves:&lt;br /&gt;
&lt;br /&gt;
1. Ranking key colors by their cluster sizes:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\text{rank}(v_i) = \frac{|A_i|}{\sum_{j=1}^{n_A}|A_j|},&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;|A_i|&amp;lt;/math&amp;gt; is the cardinality (number of pixels) of its associated cluster,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; is the total number of clusters.&lt;br /&gt;
&lt;br /&gt;
2. Translating the highest-ranked confusing color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; to its projection on the nearest non-occupied confusion line:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
v^*_{\text{tr}} = \text{proj}(v^*, L^*),&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*_{\text{tr}}&amp;lt;/math&amp;gt; is the new position of the color &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;v^*&amp;lt;/math&amp;gt; after translation,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;L^*&amp;lt;/math&amp;gt; is the nearest non-occupied confusion line, determined as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
d(v^*, L^*) = \min_{L \in \text{CL}_D} d(v^*, L).&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Updating the sets of confusing colors and non-occupied confusion lines iteratively:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
\Phi_V = \Phi_V - \{v^*\}, \quad \text{CL}_D = \text{CL}_D - \{L^*\}.&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\Phi_V&amp;lt;/math&amp;gt; is the set of confusing colors,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\text{CL}_D&amp;lt;/math&amp;gt; is the set of non-occupied confusion lines.&lt;br /&gt;
&lt;br /&gt;
After shifting, the luminance of the recolored key colors is optimized using a regularized objective function to balance naturalness and contrast:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E = (E_1 + E_2) + \lambda E_3,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E&amp;lt;/math&amp;gt; is the total loss,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\lambda&amp;lt;/math&amp;gt; is a weight parameter controlling the trade-off between contrast enhancement and naturalness preservation.&lt;br /&gt;
&lt;br /&gt;
The first term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_1&amp;lt;/math&amp;gt;, measures contrast enhancement for normal trichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_1 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - b_j\| - \|f_D(a_{i,\text{rec}}) - f_D(b_j)\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;n_B&amp;lt;/math&amp;gt; are the number of key colors in clusters &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;, respectively,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;b_j&amp;lt;/math&amp;gt; is the chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;B&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D&amp;lt;/math&amp;gt; is a function simulating the dichromatic vision of individuals with color vision deficiencies,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color.&lt;br /&gt;
&lt;br /&gt;
The second term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_2&amp;lt;/math&amp;gt;, measures contrast enhancement for dichromats:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_2 = \frac{1}{n_A n_B} \sum_{i=1}^{n_A} \sum_{j=1}^{n_B} \left| \|a_i - a_j\| - \|f_D(a_{i,\text{rec}}) - f_D(a_{j,\text{rec}})\| \right|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_j&amp;lt;/math&amp;gt; are the chromaticities of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th and &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;j&amp;lt;/math&amp;gt;-th key colors in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;f_D(a_{i,\text{rec}})&amp;lt;/math&amp;gt; simulates the dichromatic perception of the recolored chromaticity &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The third term, &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;E_3&amp;lt;/math&amp;gt;, preserves the naturalness of the recolored image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt;&lt;br /&gt;
E_3 = \frac{1}{n_A} \sum_{i=1}^{n_A} \|a_i - a_{i,\text{rec}}\|,&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_i&amp;lt;/math&amp;gt; is the original chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color in cluster &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;A&amp;lt;/math&amp;gt;,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;a_{i,\text{rec}}&amp;lt;/math&amp;gt; is the recolored chromaticity of the &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;i&amp;lt;/math&amp;gt;-th key color,&lt;br /&gt;
* &amp;lt;math display=&amp;quot;inline&amp;quot;&amp;gt;\|a_i - a_{i,\text{rec}}\|&amp;lt;/math&amp;gt; is the Euclidean distance between the original and recolored chromaticities, measuring how much the naturalness is preserved.&lt;br /&gt;
&lt;br /&gt;
This method significantly enhances the contrast and naturalness of recolored images by leveraging confusion line geometry and regularized optimization. However, challenges remain in achieving real-time performance and handling cases where shifting may distort the aesthetic quality of the image.&lt;br /&gt;
&lt;br /&gt;
==== Segmentation-based Method ====&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 1 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 1: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] H. Li, L. Zhang, X. Zhang, M. Zhang, G. Zhu, P. Shen, P. Li, M. Bennamoun, and S. A. A. Shah, &amp;quot;Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs,&amp;quot; Multimedia Tools and Applications, vol. 79, no. 37–38, pp. 27583–27614, 2020, doi: 10.1007/s11042-020-09299-2.&lt;br /&gt;
&lt;br /&gt;
[2] L. Chen, Z. Zhu, W. Huang, K. Go, X. Chen, and X. Mao, &amp;quot;Image recoloring for color vision deficiency compensation using Swin transformer,&amp;quot; Neural Computing and Applications, vol. 36, no. 11, pp. 6051–6066, 2024, doi: 10.1007/s00521-023-09367-2.&lt;br /&gt;
&lt;br /&gt;
[3] S. Jiang, D. Liu, D. Li, and C. Xu, &amp;quot;Personalized Image Generation for Color Vision Deficiency Population,&amp;quot; in 2023 IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 2023, pp. 22514–22523, doi: 10.1109/ICCV51070.2023.02063.&lt;br /&gt;
&lt;br /&gt;
[4] J.-B. Huang, C.-S. Chen, T.-C. Jen, and S.-J. Wang, &amp;quot;Image recolorization for the colorblind,&amp;quot; GitHub repository, [Online]. Available: https://github.com/jbhuang0604/RecolorForColorblind. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[5] J. Dietrich, &amp;quot;Daltonize Python Package,&amp;quot; GitHub repository, [Online]. Available: https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[6] B. Dougherty and A. Wade, &amp;quot;Vischeck,&amp;quot; 2000. [Online]. Available: https://www.vischeck.com/. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[7] J. Brettel, F. Viénot, and J. D. Mollon, &amp;quot;Computerized simulation of color appearance for dichromats,&amp;quot; Journal of the Optical Society of America A, vol. 14, no. 10, pp. 2647–2655, 1997, doi: 10.1364/JOSAA.14.002647.&lt;br /&gt;
&lt;br /&gt;
[8] Z. Zhu, M. Toyoura, K. Go, I. Fujishiro, K. Kashiwagi, and X. Mao, &amp;quot;Processing images for red-green dichromats compensation via naturalness and information-preservation considered recoloring,&amp;quot; Visual Computer, vol. 35, no. 6–8, pp. 1053–1066, 2019, doi: 10.1007/s00371-019-01723-5.&lt;br /&gt;
&lt;br /&gt;
[9] Z. Zhu, M. Toyoura, K. Go, I. Fujishiro, K. Kashiwagi, and X. Mao, &amp;quot;Personalized image recoloring for color vision deficiency compensation,&amp;quot; IEEE Transactions on Multimedia, vol. 24, pp. 1721–1733, 2022, doi: 10.1109/TMM.2021.3130546.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for each of MLP, U-Net and Autoencoder&lt;br /&gt;
* Recolorization script (adapting from MATLAB) and adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup and configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60488</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60488"/>
		<updated>2024-12-13T04:11:52Z</updated>

		<summary type="html">&lt;p&gt;Rainas: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues. Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent, and only a few consider different severity levels.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix. For example, the correction matrix for protanopia, as implemented in tools like Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix for Protanopia} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, colors are first transformed into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion-line-based Method ====&lt;br /&gt;
&lt;br /&gt;
==== Segmentation-based Method ====&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 1 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 1: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] H. Li, L. Zhang, X. Zhang, M. Zhang, G. Zhu, P. Shen, P. Li, M. Bennamoun, and S. A. A. Shah, &amp;quot;Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs,&amp;quot; Multimedia Tools and Applications, vol. 79, no. 37–38, pp. 27583–27614, 2020, doi: 10.1007/s11042-020-09299-2.&lt;br /&gt;
&lt;br /&gt;
[2] L. Chen, Z. Zhu, W. Huang, K. Go, X. Chen, and X. Mao, &amp;quot;Image recoloring for color vision deficiency compensation using Swin transformer,&amp;quot; Neural Computing and Applications, vol. 36, no. 11, pp. 6051–6066, 2024, doi: 10.1007/s00521-023-09367-2.&lt;br /&gt;
&lt;br /&gt;
[3] S. Jiang, D. Liu, D. Li, and C. Xu, &amp;quot;Personalized Image Generation for Color Vision Deficiency Population,&amp;quot; in 2023 IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 2023, pp. 22514–22523, doi: 10.1109/ICCV51070.2023.02063.&lt;br /&gt;
&lt;br /&gt;
[4] J.-B. Huang, C.-S. Chen, T.-C. Jen, and S.-J. Wang, &amp;quot;Image recolorization for the colorblind,&amp;quot; GitHub repository, [Online]. Available: https://github.com/jbhuang0604/RecolorForColorblind. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[5] J. Dietrich, &amp;quot;Daltonize Python Package,&amp;quot; GitHub repository, [Online]. Available: https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[6] B. Dougherty and A. Wade, &amp;quot;Vischeck,&amp;quot; 2000. [Online]. Available: https://www.vischeck.com/. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[7] J. Brettel, F. Viénot, and J. D. Mollon, &amp;quot;Computerized simulation of color appearance for dichromats,&amp;quot; Journal of the Optical Society of America A, vol. 14, no. 10, pp. 2647–2655, 1997, doi: 10.1364/JOSAA.14.002647.&lt;br /&gt;
&lt;br /&gt;
[8] Z. Zhu, M. Toyoura, K. Go, I. Fujishiro, K. Kashiwagi, and X. Mao, &amp;quot;Processing images for red-green dichromats compensation via naturalness and information-preservation considered recoloring,&amp;quot; Visual Computer, vol. 35, no. 6–8, pp. 1053–1066, 2019, doi: 10.1007/s00371-019-01723-5.&lt;br /&gt;
&lt;br /&gt;
[9] Z. Zhu, M. Toyoura, K. Go, I. Fujishiro, K. Kashiwagi, and X. Mao, &amp;quot;Personalized image recoloring for color vision deficiency compensation,&amp;quot; IEEE Transactions on Multimedia, vol. 24, pp. 1721–1733, 2022, doi: 10.1109/TMM.2021.3130546.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for each of MLP, U-Net and Autoencoder&lt;br /&gt;
* Recolorization script (adapting from MATLAB) and adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup and configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60487</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60487"/>
		<updated>2024-12-13T04:08:28Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Color Vision Deficiency (CVD) affects approximately 350 million individuals worldwide, impairing their ability to distinguish certain colors. Image recoloring for individuals with CVDs has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent. These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
In recent years, numerous methods have been developed to recolor images for individuals with CVDs, ranging from traditional mathematical approaches to advanced deep learning techniques. This section focuses on the prominent recent works in these two categories.&lt;br /&gt;
&lt;br /&gt;
=== Mathematical-based methods ===&lt;br /&gt;
Mathematical approaches to image recoloring for individuals with CVDs have been extensively developed to enhance color discrimination while trying to preserve the natural appearance of images. These methods typically involve color space transformations, optimization techniques, and perceptual modeling to achieve their objectives. &lt;br /&gt;
&lt;br /&gt;
==== Daltonization ====&lt;br /&gt;
Daltonization enhances images for individuals with CVD by correcting colors based on the simulated deficiency. The process involves comparing the original LMS values with the simulated deficient values to compute the error:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
\text{Error}_{\text{LMS}} = \text{LMS}_{\text{original}} - \text{LMS}_{\text{simulated}} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The error is then mapped back to the RGB space using a correction matrix. For example, the correction matrix for protanopia, as implemented in tools like Vischeck [6], is:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; \text{Correction Matrix for Protanopia} = \begin{bmatrix} 0.0 &amp;amp; 0.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 1.0 &amp;amp; 0.0 \\ 0.7 &amp;amp; 0.0 &amp;amp; 1.0 \end{bmatrix} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corrected RGB values are added back to the original LMS values to generate a daltonized image that improves contrast for CVD viewers.&lt;br /&gt;
&lt;br /&gt;
The simulation of CVDs relies on the physiology of human vision, particularly the responses of the Long (L), Medium (M), and Short (S) wavelength-sensitive cones in the retina. The LMS color space is derived from the spectral sensitivities of these cones, making it an ideal framework for modeling human color perception.&lt;br /&gt;
&lt;br /&gt;
To simulate CVD, colors are first transformed into the LMS color space using the following linear transformation matrix based on Stockman and Sharpe’s cone fundamentals:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
T_{\text{RGB-to-LMS}} = \begin{bmatrix} &lt;br /&gt;
0.3904725 &amp;amp; 0.54990437 &amp;amp; 0.00890159 \\ &lt;br /&gt;
0.07092586 &amp;amp; 0.96310739 &amp;amp; 0.00135809 \\ &lt;br /&gt;
0.02314268 &amp;amp; 0.12801221 &amp;amp; 0.93605194 &lt;br /&gt;
\end{bmatrix} &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For individuals with CVD, the missing cone’s response is replaced by a weighted combination of the remaining two cones. This approach, introduced by Brettel, Viénot, and Mollon (1997) [7], uses specific coefficients derived from cone sensitivities. For example, in protanopia (L-cone deficiency), the L-cone response is approximated using the M- and S-cone responses as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
L_{\text{simulated}} = 0 \cdot L + 0.90822864 \cdot M + 0.008192 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For deuteranopia (M-cone deficiency), the M-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
M_{\text{simulated}} = 1.10104433 \cdot L + 0 \cdot M - 0.00901975 \cdot S &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For tritanopia (S-cone deficiency), the S-cone is replaced as:&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; &lt;br /&gt;
S_{\text{simulated}} = -0.15773032 \cdot L + 1.19465634 \cdot M + 0 \cdot S&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These transformations allow accurate simulation of the perceptual experience of individuals with CVD. (The numbers are derived from [5]).&lt;br /&gt;
&lt;br /&gt;
==== Optimization-based Method ====&lt;br /&gt;
Zhu et al. [8] introduced an optimization-based recoloring framework for red-green dichromacy, aiming to balance naturalness and contrast. The framework minimizes a total loss function defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta E_{\text{nat}} + E_{\text{cont}} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; is a scalar weight that controls the trade-off between the two objectives: naturalness preservation (&amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;) and contrast enhancement (&amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;). &lt;br /&gt;
&lt;br /&gt;
The naturalness term, &amp;lt;math&amp;gt;E_{\text{nat}}&amp;lt;/math&amp;gt;, ensures that the recolored image closely resembles the original image for CVD viewers by minimizing perceptual differences:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{nat}} = \sum_{i=1}^N \| c_i^+ - c_i \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; is the total number of pixels in the image,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i&amp;lt;/math&amp;gt; is the original color of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;c_i^+&amp;lt;/math&amp;gt; is the recolored value of the &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt;-th pixel,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| c_i^+ - c_i \|&amp;lt;/math&amp;gt; is the Euclidean distance, measuring the perceptual difference between the original and recolored colors.&lt;br /&gt;
&lt;br /&gt;
The contrast term, &amp;lt;math&amp;gt;E_{\text{cont}}&amp;lt;/math&amp;gt;, enhances the distinguishability of colors in the recolored image by minimizing changes in color contrast:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E_{\text{cont}} = \sum_{i \neq j} \| (c_i^+ - c_j^+) - (c_i - c_j) \|^2, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i^+ - c_j^+)&amp;lt;/math&amp;gt; is the perceived color difference between pixels &amp;lt;math&amp;gt;i&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;j&amp;lt;/math&amp;gt; after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;(c_i - c_j)&amp;lt;/math&amp;gt; is the original color difference,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| (c_i^+ - c_j^+) - (c_i - c_j) \|&amp;lt;/math&amp;gt; represents the deviation in color contrast before and after recoloring.&lt;br /&gt;
&lt;br /&gt;
To address the limitations of this approach, Zhu et al. [9] proposed a degree-adaptable framework incorporating a transformation matrix &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; that simulates CVD perception. The transformation matrix is defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; T = \begin{bmatrix} t_{11} &amp;amp; t_{12} &amp;amp; t_{13} \\ t_{21} &amp;amp; t_{22} &amp;amp; t_{23} \\ t_{31} &amp;amp; t_{32} &amp;amp; t_{33} \end{bmatrix}, &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;t_{ij}&amp;lt;/math&amp;gt; are the elements representing the relationships between the original and perceived LMS (Long, Medium, Short wavelength) cone responses for individuals with CVD.&lt;br /&gt;
&lt;br /&gt;
The degree-adaptable loss function extends the optimization by adjusting weights based on perceptual importance, defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math display=&amp;quot;block&amp;quot;&amp;gt; E = \beta \sum_{i=1}^N \alpha_i \| T(c_i^+ - c_i) \|^2 + \sum_{i \neq j} \| T(c_i^+ - c_j^+) - T(c_i - c_j) \|^2. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here:&lt;br /&gt;
* &amp;lt;math&amp;gt;\alpha_i&amp;lt;/math&amp;gt; assigns weights to each pixel, prioritizing the preservation of colors with smaller perception errors,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_i) \|&amp;lt;/math&amp;gt; measures the perceptual difference after recoloring,&lt;br /&gt;
* &amp;lt;math&amp;gt;\| T(c_i^+ - c_j^+) - T(c_i - c_j) \|&amp;lt;/math&amp;gt; quantifies the deviation in color contrast under CVD simulation.&lt;br /&gt;
&lt;br /&gt;
This framework improves both contrast and personalization but requires further optimization for real-time performance.&lt;br /&gt;
&lt;br /&gt;
==== Confusion-line-based Method ====&lt;br /&gt;
&lt;br /&gt;
==== Segmentation-based Method ====&lt;br /&gt;
&lt;br /&gt;
==== GMM-based Method ====&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
Conventional methods for recoloring, including optimization-based approaches (as discussed above), fail to generalize well across varying severity levels and CVD types. While these methods improve color differentiation, they frequently compromise naturalness or require extensive computational resources, making them less suitable for real-time, efficient, personalized applications.&lt;br /&gt;
&lt;br /&gt;
==== GAN-Based Recoloring for CVD ====&lt;br /&gt;
&lt;br /&gt;
In [1] GANs (Generative Adversarial Networks) was explored for recoloring, with a backbone Pix2Pix-GAN, Cycle-GAN, and Bicycle-GAN structure showing promising results. These models are generate creative recolored images by learning mappings between normal and CVD-affected color spaces. However, this and existing GAN approaches struggle with balancing naturalness and contrast. This specific reference also requires paired datasets (since it is adapted from style transfer), making it computationally intensive and less suitable for personalization.&lt;br /&gt;
&lt;br /&gt;
==== Swin Transformer Recoloring ====&lt;br /&gt;
&lt;br /&gt;
The authors in [2] introduced a hierarchical vision transformer (SWIN) architecture that processes images through shifted windows, effectively capturing both local and global contextual information. In computer vision, this design generally allows efficient handling of high-resolution images and has been applied to various tasks, including image classification and object detection. Despite its robust performance, this architecture is still computationally intensive and does not inherently account for the specific needs of CVD individuals, as it lacks mechanisms for personalized color adjustments.&lt;br /&gt;
&lt;br /&gt;
==== Personalized CVD-GAN ====&lt;br /&gt;
&lt;br /&gt;
To cater to the diverse needs of the CVD population, the Personalized CVD-GAN [3] was developed. This model generates images that are not only CVD-friendly but also tailored to individual degrees of color vision deficiency. By disentangling color representations using a unique triple-latent structure in their method, continuous personalization was possible to adjust images according to specific CVD severities. While effective, this approach is computationally demanding, making it less practical for real-time applications. In our experiment, it took around 18 days for one epoch (or one iteration over the entire dataset).&lt;br /&gt;
&lt;br /&gt;
Thus, existing methods either lack personalization or are too resource-intensive for widespread use.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Deep Learning based ===&lt;br /&gt;
&lt;br /&gt;
==== Task Overview ====&lt;br /&gt;
Given an input RGB image and a label for the user (as shown in the figure), we want a deep learning model to output a recolored RGB image that is specific to that user. More details on inputs and outputs are discussed in further sections but an overview is shown in Figure 1. All of the code was done in Python using a deep learning framework called [https://pytorch.org PyTorch]&lt;br /&gt;
[[File:Io.png|right|thumb|200px|Figure 1: Dataset]]&lt;br /&gt;
&lt;br /&gt;
==== Types ====&lt;br /&gt;
1. &#039;&#039;&#039; Supervised methods &#039;&#039;&#039;:&lt;br /&gt;
These are deep learning models that require a &#039;ground truth&#039; recolored image for the neural network to learn recolorization. While these methods are simple, easy to train and integrate the user label, they require an already present ground truth comparison of expected output.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; Unsupervised methods &#039;&#039;&#039;:&lt;br /&gt;
These models are trained without a ground truth and can also encode user label information while training. They are generally better at generating more natural images, but they require more compute and sophisticated model architectures or loss functions for the recoloring task&lt;br /&gt;
&lt;br /&gt;
==== Dataset ====&lt;br /&gt;
The dataset used for this project was constructed specifically to address the challenges of recoloring images for individuals with color vision deficiency (CVD). We first gathered an open-source RGB image dataset from [2]. To improve the capability of the proposed model to enhance the contrast between CVD-indistinguishable color&lt;br /&gt;
pairs, in their study, they created a new dataset consisting of 141,000 pictures of both natural scenes and artificial images containing&lt;br /&gt;
CVD-confusing colors without labels. To generate labels (and ground truth recolored images for supervised methods), we randomly sampled 15,000 images and recolored by simulating random labels for severity and type of CVD. The recoloring for ground truth images was done using a [https://github.com/jbhuang0604/RecolorForColorblind/tree/master MATLAB script] (adapted to Python) from [4]. Note: The open-source tools used in the Python version for the recoloring script were [https://scikit-image.org Scikit-Image], [https://scipy.org Scipy] and [https://python-colormath.readthedocs.io/en/latest/ Colormath].&lt;br /&gt;
&lt;br /&gt;
As shown in Figure 1, each sample in the dataset consists of:&lt;br /&gt;
1. &#039;&#039;&#039; Original RGB Image&#039;&#039;&#039; : High-resolution images, resized to &amp;lt;code&amp;gt; 256x256&amp;lt;/code&amp;gt; pixels and normalized to &amp;lt;code&amp;gt;[0,1]&amp;lt;/code&amp;gt; range, representing the standard color space.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039; CVD Labels &#039;&#039;&#039; : Condition labels encoded as &amp;lt;code&amp;gt;severity * [protan, deutan]&amp;lt;/code&amp;gt;, where severity ranges from 0.1 to 1.0. For example, a label &amp;lt;code&amp;gt;[0.6, 0]&amp;lt;/code&amp;gt; corresponds to protanopia at 60% severity.&lt;br /&gt;
&lt;br /&gt;
Data augmentation techniques such as random rotations, crops, and brightness adjustments were applied to expand the dataset, ensuring robust model generalization across diverse scenarios.&lt;br /&gt;
&lt;br /&gt;
==== Supervised Methods ====&lt;br /&gt;
===== Conditional Parallel RGB MLP =====&lt;br /&gt;
[[File:mlp.png|right|thumb|Figure 2: Conditional MLP architecture]]&lt;br /&gt;
As shown in Figure 2, the model predicts the R, G, and B channels separately using an independent multi-layer perceptron (MLP) for each channel. The input image is concatenated with the label encoding along the channel dimension and is passed to 3 parallel MLPs simultaneously. These parallel networks are learned to predicted R, G, B channels of a recolored image based on given ground truth. The outputs from each of these networks are concatenated to produce the recolored RGB image of same spatial dimensions as input. Essentially, each channel is disentangled, enabling targeted adjustments.&lt;br /&gt;
&lt;br /&gt;
The loss function used to train was pixel wise, mean-squared error loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{MSE}} = \frac{1}{N} \sum_{p=1}^{N} \left( I(p) - I&#039;(p) \right)^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I, I&#039;: Recolored (model output) image and ground truth recolored image respectively&lt;br /&gt;
* p: Image index&lt;br /&gt;
* N: Total number of images&lt;br /&gt;
&lt;br /&gt;
===== Conditional U-Net =====&lt;br /&gt;
In a similar fashion of inputs, a convolutional neural network (CNN)-based U-Net architecture was tested to generate a full recolored image as output. The conditional inputs here affect both the encoder and decoder. [[File:Unet condtional.png|right|thumb|Figure 3: Conditional U-Net architecture]]&lt;br /&gt;
U-Nets are widely used in computer vision tasks and are very robust to new tasks as well. The architecture we adopted is shown in Figure 3.&lt;br /&gt;
The loss function used to train the U-Net was a commonly used VGG Perceptual Loss:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{VGG}} = \sum_{l} \frac{1}{N_l} \| \phi_l(I) - \phi_l(I&#039;) \|_2^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I and I&#039;: are recolored (model output) and ground recolored images respectively&lt;br /&gt;
* &amp;lt;math&amp;gt;\phi_l&amp;lt;/math&amp;gt; is the l-th of the pre-trained VGG network&lt;br /&gt;
&lt;br /&gt;
==== Unsupervised Methods ====&lt;br /&gt;
===== Conditional Autoencoder =====&lt;br /&gt;
As shown in Figure4, an unsupervised CNN-based encoder-decoder network was trained to reconstruct full recolored images with a CVD-aware color palette. The key to making this network align with the recoloring task was the loss functions. The loss functions we used to train this network were inspired from [2]. [[File:Ae.png|right|350px|thumb|Figure 4: Conditional Autoencoder architecture]] &lt;br /&gt;
&lt;br /&gt;
The total loss function is given by:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{\text{naturalness}} + 2 \cdot (1 - \alpha) \cdot \mathcal{L}_{\text{contrast}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{contrast}} = \beta \cdot \mathcal{L}_{\text{global}} + (2 - \beta) \cdot \mathcal{L}_{\text{local}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The components of the loss functions are described below:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Global Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The global contrast loss ensures that the overall contrast of the recolored image is preserved. It is defined as&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{global} = \frac{1}{\|\omega\|} \sum_{&amp;lt;x, y&amp;gt; \in \epsilon \omega} \text{CL}(x, y)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Local Contrast Loss&#039;&#039;&#039;:&lt;br /&gt;
The local contrast loss focuses on preserving the contrast within a small neighborhood around each pixel. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{l} = \frac{1}{N} \sum_{x=1}^{N} \sum_{y \in \omega_x} \frac{\text{CL}(x, y)}{\|\omega_x\|}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{CL}(x, y) = \|\hat{c}_x&#039; - \hat{c}_y&#039;\| - \|c_x - c_y\|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* x,y: Two distinct pixels in the image.&lt;br /&gt;
* cx and cy: CVD simulated colors of original image&lt;br /&gt;
* c^x′and c^y: CVD simulated colors of recolored image (model output)&lt;br /&gt;
* ||w||: Global (or large) window of image&lt;br /&gt;
* ||wx||: Local window or neighborhood around a pixel x&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Naturalness Loss&#039;&#039;&#039;:&lt;br /&gt;
The naturalness loss drives output image to have colors that are visually similar and close to natural distributions. &amp;lt;math&amp;gt;&lt;br /&gt;
\mathcal{L}_{\text{natural}} = 1 - \text{SSIM}(I&#039;, I)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
* I(i), I&#039;(i): Original and recolored images respectively&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
=== Deep Learning based methods ===&lt;br /&gt;
The results focus on evaluating the performance of the above neural network architectures—Conditional Parallel RGB MLP, Deep U-Net, and Conditional Autoencoder. Quantitive metrics such as Structural Similarity Index (SSIM), total color contrast (TCC), Chromatic Difference (CD), and inference time were used to assess the effectiveness of the models provided in [1] and [2].&lt;br /&gt;
&lt;br /&gt;
==== Qualitative Results ====&lt;br /&gt;
The recolored outputs were visually evaluated to determine their alignment with expected results. The &#039;expected&#039; results for supervised mean how closely they resemble ground truth recolored image and for unsupervised method mean how much contrast and naturalness is observed in the CVD simulated recolored images compared to original.&lt;br /&gt;
The results and takeaways can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Conditional Parallel RGB MLP&#039;&#039;&#039;: (Figure 5)&lt;br /&gt;
[[File:Mlp_res.png|right|400px|thumb|Figure 5 Conditional MLP: Model failure]]&lt;br /&gt;
* Recoloring was inconsistent, with visible artifacts in regions where spatial correlations were essential.&lt;br /&gt;
* The pixels seemed more discretized, suggesting that disentanglement was not very useful for this case (especially naturalness).&lt;br /&gt;
* Failed to preserve natural color transitions, particularly in complex images.&lt;br /&gt;
2. &#039;&#039;&#039;Conditional U-Net&#039;&#039;&#039;: (Figure 6, 7)&lt;br /&gt;
[[File:Unet_res1.png|right|400px|thumb|Figure 6 Conditional U-Net: Model failure]]&lt;br /&gt;
[[File:Unet_res2.png|right|400px|thumb|Figure 7 Conditional U-Net: CVD Simulated examples]]&lt;br /&gt;
* Produced stable recoloring, preserving structural details.&lt;br /&gt;
* Initially showed improvement towards resembling ground truth, but over time started &#039;reconstructing&#039; the colors of the original image.&lt;br /&gt;
* The CVD simulations of recolored versus original were similar or worse meaning that the model was not doing well for this task&lt;br /&gt;
* Sometimes it over-saturated some colors, affecting the visual appeal.&lt;br /&gt;
3. &#039;&#039;&#039;Conditional Autoencoder&#039;&#039;&#039;: (Figure 8, 9)&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 8 Conditional Autoencoder: Majority good results]]&lt;br /&gt;
[[File:ae_res1.png|right|400px|thumb|Figure 9 Conditional Autoencoder: Marginal or negative improvement + Blurriness]]&lt;br /&gt;
* Achieved smooth and natural recoloring, with fewer artifacts.&lt;br /&gt;
* Showed the highest contrast improvement among the three models.&lt;br /&gt;
* In some cases, hurt the contrast in the CVD simulated colors and in some there was marginal improvement in contrast.&lt;br /&gt;
* Blurriness in the recolored images was seen (possibly due to naturalness factor being more prioritized even though weight coefficients in the loss term favored contrast (alpha = 0.25, beta = 1.0)).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Quantitative Results ====&lt;br /&gt;
Based on the above qualitative results, we decided to score and evaluate metrics for comparison with related work only using the Conditional Autoencoder.&lt;br /&gt;
As mentioned above, the evaluation metrics are adapted from [1] and [2]. Please refer to the definitions in the paper, as we have used the same. On a high level, the three components are:&lt;br /&gt;
* SSIM: Measures the structural similarity between the original and recolored images, ensuring the structural integrity of the recolored image is maintained. &lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
SSIM(X, Y) = \frac{(2\mu_X\mu_Y + c_1)(2\sigma_{XY} + c_2)}{(\mu_X^2 + \mu_Y^2 + c_1)(\sigma_X^2 + \sigma_Y^2 + c_2)}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Total Color Contrast: Quantifies the visibility improvement between indistinguishable colors for CVD individuals.&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
TCC = \frac{1}{n_1} \sum_{(i,j) \in \Omega_1} |x_i - x_j| &lt;br /&gt;
+ \frac{1}{N \cdot n_2} \sum_{i=1}^{N} \sum_{j \in \Omega_2} |x_i - x_j|&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
* Chromatic Difference: Quantifies the perceptual differences in color before and after recoloring, ensuring enhanced distinguishability&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
CD(i) = \sqrt{\lambda (l_i&#039; - l_i)^2 + (a_i&#039; - a_i)^2 + (b_i&#039; - b_i)^2}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
(lamda is a constant, not wavelength and l,a,b represent LAB space coordinates of recolored (&#039;) and original respectively.)&lt;br /&gt;
* Inference Time: Determines the computational efficiency of the models.&lt;br /&gt;
&lt;br /&gt;
The key results are in Table 1 and takeaways for the Conditional Autoencoder can be summarized as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center; width:30%; margin:auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Metric&lt;br /&gt;
! Value&lt;br /&gt;
|-&lt;br /&gt;
| Inference Time&lt;br /&gt;
| 2.6 seconds/image&lt;br /&gt;
|-&lt;br /&gt;
| SSIM (&amp;quot;Structure&amp;quot;)&lt;br /&gt;
| 0.8707&lt;br /&gt;
|-&lt;br /&gt;
| Total Color Contrast (&amp;quot;Distinguishability&amp;quot;)&lt;br /&gt;
| 0.5771 / (~0.851)*&lt;br /&gt;
|-&lt;br /&gt;
| Chromatic Difference (&amp;quot;Color&amp;quot;)&lt;br /&gt;
| 0.3521 / (~0.963)*&lt;br /&gt;
|+ &#039;&#039;&#039;Table 1: Quantitative Evaluation Results&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note: * indicates results from paper [2] for protan/deutan whichever is larger.&lt;br /&gt;
&lt;br /&gt;
* TCC and CD are good but not as good as paper [2] because they use optimize networks for each CVD type separately.&lt;br /&gt;
* Blurry (SSIM is not optimized for enough)&lt;br /&gt;
* Mixing CVD types in the same network needs to be more sophisticated&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
Through our (many) experiments, we learned a couple of things:&lt;br /&gt;
&lt;br /&gt;
1. &#039;&#039;&#039;Model Effectiveness&#039;&#039;&#039;:  &lt;br /&gt;
Among the models, the Conditional Autoencoder showed the best balance between enhancing color contrast and preserving naturalness. It improved the distinguishability of colors for CVD individuals while maintaining a smooth, visually appealing output. However, it produced slightly blurry images, which could be improved with better loss functions or refinement techniques. The Conditional U-Net was also effective in preserving structure and providing stable recoloring, but it required careful training to avoid overfitting. The Conditional Parallel RGB MLP, while computationally fast, lacked the ability to capture spatial relationships between pixels, making it unsuitable for this task.&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;&#039;Importance of Loss Functions&#039;&#039;&#039;:  &lt;br /&gt;
Designing appropriate loss functions was crucial for achieving the right balance between naturalness, contrast enhancement, and structural preservation. The global and local contrast losses significantly improved the visibility of recolored images, while the naturalness loss ensured that the outputs did not look artificial. Incorporating metrics like SSIM and Chromatic Difference into the evaluation also helped us better understand how well the models performed.&lt;br /&gt;
&lt;br /&gt;
3. &#039;&#039;&#039;Challenges with Data&#039;&#039;&#039;:  &lt;br /&gt;
One of the biggest challenges was ensuring that the dataset effectively represented real-world scenarios for CVD individuals. Simulating CVD perceptions and generating recolored images that matched those perceptions required a well-defined pipeline. A more diverse dataset or additional user studies with CVD participants could help fine-tune the models further.&lt;br /&gt;
&lt;br /&gt;
4. &#039;&#039;&#039;Computational Efficiency&#039;&#039;&#039;:  &lt;br /&gt;
While models like the Conditional Autoencoder and Conditional U-Net provided high-quality recoloring, their inference times were moderate, making them feasible for real-time applications. Optimizing these models further could make them more scalable for real-world use cases, such as accessibility tools in apps or websites.&lt;br /&gt;
&lt;br /&gt;
5. &#039;&#039;&#039;What Worked and What Didn’t&#039;&#039;&#039;:  &lt;br /&gt;
* Worked: Contrast enhancement methods using local and global losses were effective in improving visibility for CVD individuals. Transformer-inspired loss functions borrowed from Swin architecture added robustness.  &lt;br /&gt;
* Didn’t Work: Pixel-wise methods like the Conditional RGB MLP struggled due to their inability to handle spatial dependencies. Additionally, overfitting was a recurring issue in larger architectures without careful training.&lt;br /&gt;
&lt;br /&gt;
6. &#039;&#039;&#039;Future Directions&#039;&#039;&#039;:  &lt;br /&gt;
* Better Loss Functions: Refining the loss functions to address issues like blurriness in outputs could further improve results.  &lt;br /&gt;
* User Studies: Testing the models with real CVD participants would provide valuable insights and help validate the results.  &lt;br /&gt;
* Model Optimization: Reducing the computational cost of high-performing models like the Conditional Autoencoder could make them more practical for deployment.  &lt;br /&gt;
* Exploration of New Architectures: Trying newer methods, such as lightweight transformers or diffusion-based models, might enhance recoloring performance while maintaining efficiency.&lt;br /&gt;
&lt;br /&gt;
While there’s still room for improvement, our models demonstrated the potential of deep learning in addressing the challenges faced by individuals with CVD. Our future work would focus on refining these methods and bringing them closer to practical, everyday applications.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
[1] H. Li, L. Zhang, X. Zhang, M. Zhang, G. Zhu, P. Shen, P. Li, M. Bennamoun, and S. A. A. Shah, &amp;quot;Color vision deficiency datasets &amp;amp; recoloring evaluation using GANs,&amp;quot; Multimedia Tools and Applications, vol. 79, no. 37–38, pp. 27583–27614, 2020, doi: 10.1007/s11042-020-09299-2.&lt;br /&gt;
&lt;br /&gt;
[2] L. Chen, Z. Zhu, W. Huang, K. Go, X. Chen, and X. Mao, &amp;quot;Image recoloring for color vision deficiency compensation using Swin transformer,&amp;quot; Neural Computing and Applications, vol. 36, no. 11, pp. 6051–6066, 2024, doi: 10.1007/s00521-023-09367-2.&lt;br /&gt;
&lt;br /&gt;
[3] S. Jiang, D. Liu, D. Li, and C. Xu, &amp;quot;Personalized Image Generation for Color Vision Deficiency Population,&amp;quot; in 2023 IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 2023, pp. 22514–22523, doi: 10.1109/ICCV51070.2023.02063.&lt;br /&gt;
&lt;br /&gt;
[4] J.-B. Huang, C.-S. Chen, T.-C. Jen, and S.-J. Wang, &amp;quot;Image recolorization for the colorblind,&amp;quot; GitHub repository, [Online]. Available: https://github.com/jbhuang0604/RecolorForColorblind. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[5] J. Dietrich, &amp;quot;Daltonize Python Package,&amp;quot; GitHub repository, [Online]. Available: https://github.com/joergdietrich/daltonize/blob/main/daltonize/daltonize.py. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[6] B. Dougherty and A. Wade, &amp;quot;Vischeck,&amp;quot; 2000. [Online]. Available: https://www.vischeck.com/. [Accessed: 12-Dec-2024].&lt;br /&gt;
&lt;br /&gt;
[7] J. Brettel, F. Viénot, and J. D. Mollon, &amp;quot;Computerized simulation of color appearance for dichromats,&amp;quot; Journal of the Optical Society of America A, vol. 14, no. 10, pp. 2647–2655, 1997, doi: 10.1364/JOSAA.14.002647.&lt;br /&gt;
&lt;br /&gt;
[8] Z. Zhu, M. Toyoura, K. Go, I. Fujishiro, K. Kashiwagi, and X. Mao, &amp;quot;Processing images for red-green dichromats compensation via naturalness and information-preservation considered recoloring,&amp;quot; Visual Computer, vol. 35, no. 6–8, pp. 1053–1066, 2019, doi: 10.1007/s00371-019-01723-5.&lt;br /&gt;
&lt;br /&gt;
[9] Z. Zhu, M. Toyoura, K. Go, I. Fujishiro, K. Kashiwagi, and X. Mao, &amp;quot;Personalized image recoloring for color vision deficiency compensation,&amp;quot; IEEE Transactions on Multimedia, vol. 24, pp. 1721–1733, 2022, doi: 10.1109/TMM.2021.3130546.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
&#039;&#039;&#039;Ishikaa&#039;&#039;&#039;: &lt;br /&gt;
* Training, evaluation and visualization for each of MLP, U-Net and Autoencoder&lt;br /&gt;
* Recolorization script (adapting from MATLAB) and adding severity index&lt;br /&gt;
* &#039;Ground Truth&#039; dataset creation and logging&lt;br /&gt;
* AWS Compute setup and configuration&lt;br /&gt;
* Written Report &amp;amp; Presentation&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Raina&#039;&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60187</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60187"/>
		<updated>2024-12-12T17:56:47Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Image recoloring for individuals with color vision deficiencies (CVDs) has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent. These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences, such as the beauty of a rainbow, experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
- What is known from the literature.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
- Describe techniques you used to measure and analyze. Describe the instruments, and experimental procedures in enough detail so that someone could repeat your analysis. What software did you use? What was the idea of the algorithms and data analysis?&lt;br /&gt;
&lt;br /&gt;
=== Simulation Tools ===&lt;br /&gt;
&lt;br /&gt;
For this project, we have used three simulation tools:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039; iset3d toolbox&#039;&#039;&#039; We used the iset3d toolbox in MATLAB to provide a physically-accurate ray traced rendering of 3D scenes.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039; PBRT &#039;&#039;&#039; We Ran PBRT in MATLAB to produce physically accurate images by physically based and ray tracing through scenes.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039; Docker &#039;&#039;&#039; The implementation of iset3d with PBRT is available in a set of Docker containers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sine Wave: ===&lt;br /&gt;
&lt;br /&gt;
=== Blue Noise: ===&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
- Organize your results in a good logical order (not necessarily historical order). Include relevant graphs and/or images. Make sure graph axes are labeled. Make sure you draw the reader&#039;s attention to the key element of the figure. The key aspect should be the most visible element of the figure or graph. Help the reader by writing a clear figure caption.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
- Describe what you learned. What worked? What didn&#039;t? Why? What should someone next year try?&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
- List references. Include links to papers that are online.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
- (for groups only) - Work breakdown. Explain how the project work was divided among group members.&lt;br /&gt;
&lt;br /&gt;
Bridget:&lt;br /&gt;
&lt;br /&gt;
Caelia:&lt;br /&gt;
&lt;br /&gt;
Brian:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60186</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60186"/>
		<updated>2024-12-12T17:55:28Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Image recoloring for individuals with color vision deficiencies (CVDs) has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent. These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats (completely missing one type of cone cell), or anomalous trichromats (having all three types of cones but with altered sensitivity), causing milder color perception issues.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow, a phenomenon I find among the most beautiful in the world, with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences—such as the beauty of a rainbow—experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
- What is known from the literature.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
- Describe techniques you used to measure and analyze. Describe the instruments, and experimental procedures in enough detail so that someone could repeat your analysis. What software did you use? What was the idea of the algorithms and data analysis?&lt;br /&gt;
&lt;br /&gt;
=== Simulation Tools ===&lt;br /&gt;
&lt;br /&gt;
For this project, we have used three simulation tools:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039; iset3d toolbox&#039;&#039;&#039; We used the iset3d toolbox in MATLAB to provide a physically-accurate ray traced rendering of 3D scenes.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039; PBRT &#039;&#039;&#039; We Ran PBRT in MATLAB to produce physically accurate images by physically based and ray tracing through scenes.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039; Docker &#039;&#039;&#039; The implementation of iset3d with PBRT is available in a set of Docker containers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sine Wave: ===&lt;br /&gt;
&lt;br /&gt;
=== Blue Noise: ===&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
- Organize your results in a good logical order (not necessarily historical order). Include relevant graphs and/or images. Make sure graph axes are labeled. Make sure you draw the reader&#039;s attention to the key element of the figure. The key aspect should be the most visible element of the figure or graph. Help the reader by writing a clear figure caption.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
- Describe what you learned. What worked? What didn&#039;t? Why? What should someone next year try?&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
- List references. Include links to papers that are online.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
- (for groups only) - Work breakdown. Explain how the project work was divided among group members.&lt;br /&gt;
&lt;br /&gt;
Bridget:&lt;br /&gt;
&lt;br /&gt;
Caelia:&lt;br /&gt;
&lt;br /&gt;
Brian:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
	<entry>
		<id>http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60185</id>
		<title>Personalized Recoloring for Color Vision Deficiency using Deep Learning</title>
		<link rel="alternate" type="text/html" href="http://vista.su.domains/psych221wiki/index.php?title=Personalized_Recoloring_for_Color_Vision_Deficiency_using_Deep_Learning&amp;diff=60185"/>
		<updated>2024-12-12T17:54:03Z</updated>

		<summary type="html">&lt;p&gt;Rainas: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction == &lt;br /&gt;
Image recoloring for individuals with color vision deficiencies (CVDs) has been a well-researched area, with numerous attempts aimed at creating images that make colors more distinguishable for those with CVDs. CVDs are typically classified into three main types: protanopia (difficulty perceiving red), deuteranopia (difficulty perceiving green), and tritanopia (difficulty perceiving blue). Most research has focused on protanopia and deuteranopia, as these conditions are more prevalent. These conditions arise due to the absence or malfunction of certain types of cone cells in the retina, which are responsible for color vision. For instance, the lack or defect of red or green cones leads to protanopia or deuteranopia, respectively. This can result in partial or complete loss of perception of specific colors. Moreover, individuals with CVD can be dichromats—completely missing one type of cone cell—or anomalous trichromats—having all three types of cones but with altered sensitivity, causing milder color perception issues.&lt;br /&gt;
&lt;br /&gt;
In this work, we aim to consider all three types of CVDs, taking into account varying levels of severity for personalization. We explore existing methods in the field and experiment through two main approaches: mathematical transformations and deep learning techniques. We will start by reviewing current advancements in these two domains, followed by presenting our experiments and results. Evaluations of each method will be provided, leading to a discussion of our findings and outlining potential directions for future work.&lt;br /&gt;
&lt;br /&gt;
The motivation for this work arose from a personal experience. While admiring a rainbow—a phenomenon I find among the most beautiful in the world—with a friend who has deuteranopia, I realized that they were unable to distinguish the vibrant array of colors. This experience highlighted the emotional and perceptual gap caused by CVD, inspiring the goal of this project: to develop personalized and efficient tools that enhance color perception for individuals with CVDs. Ultimately, we aim to enable those with CVDs to enjoy the same vivid experiences—such as the beauty of a rainbow—experienced by those with normal color vision.&lt;br /&gt;
&lt;br /&gt;
== Background == &lt;br /&gt;
- What is known from the literature.&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
- Describe techniques you used to measure and analyze. Describe the instruments, and experimental procedures in enough detail so that someone could repeat your analysis. What software did you use? What was the idea of the algorithms and data analysis?&lt;br /&gt;
&lt;br /&gt;
=== Simulation Tools ===&lt;br /&gt;
&lt;br /&gt;
For this project, we have used three simulation tools:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039; iset3d toolbox&#039;&#039;&#039; We used the iset3d toolbox in MATLAB to provide a physically-accurate ray traced rendering of 3D scenes.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039; PBRT &#039;&#039;&#039; We Ran PBRT in MATLAB to produce physically accurate images by physically based and ray tracing through scenes.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039; Docker &#039;&#039;&#039; The implementation of iset3d with PBRT is available in a set of Docker containers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sine Wave: ===&lt;br /&gt;
&lt;br /&gt;
=== Blue Noise: ===&lt;br /&gt;
&lt;br /&gt;
== Results == &lt;br /&gt;
- Organize your results in a good logical order (not necessarily historical order). Include relevant graphs and/or images. Make sure graph axes are labeled. Make sure you draw the reader&#039;s attention to the key element of the figure. The key aspect should be the most visible element of the figure or graph. Help the reader by writing a clear figure caption.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
- Describe what you learned. What worked? What didn&#039;t? Why? What should someone next year try?&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
- List references. Include links to papers that are online.&lt;br /&gt;
&lt;br /&gt;
== Appendix I ==&lt;br /&gt;
- Upload source code, test images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas.&lt;br /&gt;
&lt;br /&gt;
== Appendix II ==&lt;br /&gt;
- (for groups only) - Work breakdown. Explain how the project work was divided among group members.&lt;br /&gt;
&lt;br /&gt;
Bridget:&lt;br /&gt;
&lt;br /&gt;
Caelia:&lt;br /&gt;
&lt;br /&gt;
Brian:&lt;/div&gt;</summary>
		<author><name>Rainas</name></author>
	</entry>
</feed>