diff options
Diffstat (limited to 'docs/source/auto_examples/plot_otda_color_images.rst')
-rw-r--r-- | docs/source/auto_examples/plot_otda_color_images.rst | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/docs/source/auto_examples/plot_otda_color_images.rst b/docs/source/auto_examples/plot_otda_color_images.rst index e3989c8..88e93d2 100644 --- a/docs/source/auto_examples/plot_otda_color_images.rst +++ b/docs/source/auto_examples/plot_otda_color_images.rst @@ -3,9 +3,9 @@ .. _sphx_glr_auto_examples_plot_otda_color_images.py: -======================================================== -OT for domain adaptation with image color adaptation [6] -======================================================== +============================= +OT for image color adaptation +============================= This example presents a way of transferring colors between two image with Optimal Transport as introduced in [6] @@ -53,7 +53,7 @@ SIAM Journal on Imaging Sciences, 7(3), 1853-1882. -generate data +Generate data ############################################################################# @@ -83,43 +83,7 @@ generate data -Instantiate the different transport algorithms and fit them -############################################################################# - - - -.. code-block:: python - - - # EMDTransport - ot_emd = ot.da.EMDTransport() - ot_emd.fit(Xs=Xs, Xt=Xt) - - # SinkhornTransport - ot_sinkhorn = ot.da.SinkhornTransport(reg_e=1e-1) - ot_sinkhorn.fit(Xs=Xs, Xt=Xt) - - # prediction between images (using out of sample prediction as in [6]) - transp_Xs_emd = ot_emd.transform(Xs=X1) - transp_Xt_emd = ot_emd.inverse_transform(Xt=X2) - - transp_Xs_sinkhorn = ot_emd.transform(Xs=X1) - transp_Xt_sinkhorn = ot_emd.inverse_transform(Xt=X2) - - I1t = minmax(mat2im(transp_Xs_emd, I1.shape)) - I2t = minmax(mat2im(transp_Xt_emd, I2.shape)) - - I1te = minmax(mat2im(transp_Xs_sinkhorn, I1.shape)) - I2te = minmax(mat2im(transp_Xt_sinkhorn, I2.shape)) - - - - - - - - -plot original image +Plot original image ############################################################################# @@ -149,7 +113,7 @@ plot original image -scatter plot of colors +Scatter plot of colors ############################################################################# @@ -184,7 +148,43 @@ scatter plot of colors -plot new images +Instantiate the different transport algorithms and fit them +############################################################################# + + + +.. code-block:: python + + + # EMDTransport + ot_emd = ot.da.EMDTransport() + ot_emd.fit(Xs=Xs, Xt=Xt) + + # SinkhornTransport + ot_sinkhorn = ot.da.SinkhornTransport(reg_e=1e-1) + ot_sinkhorn.fit(Xs=Xs, Xt=Xt) + + # prediction between images (using out of sample prediction as in [6]) + transp_Xs_emd = ot_emd.transform(Xs=X1) + transp_Xt_emd = ot_emd.inverse_transform(Xt=X2) + + transp_Xs_sinkhorn = ot_emd.transform(Xs=X1) + transp_Xt_sinkhorn = ot_emd.inverse_transform(Xt=X2) + + I1t = minmax(mat2im(transp_Xs_emd, I1.shape)) + I2t = minmax(mat2im(transp_Xt_emd, I2.shape)) + + I1te = minmax(mat2im(transp_Xs_sinkhorn, I1.shape)) + I2te = minmax(mat2im(transp_Xt_sinkhorn, I2.shape)) + + + + + + + + +Plot new images ############################################################################# @@ -235,7 +235,7 @@ plot new images -**Total running time of the script:** ( 3 minutes 16.043 seconds) +**Total running time of the script:** ( 2 minutes 28.053 seconds) @@ -254,4 +254,4 @@ plot new images .. rst-class:: sphx-glr-signature - `Generated by Sphinx-Gallery <http://sphinx-gallery.readthedocs.io>`_ + `Generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_ |