balthazarneveu / blind-deblurring-from-synthetic-data

MVA ENS Paris Saclay - Image restoration project on deblurring learnt on deadleaves
3 stars 0 forks source link

19 fix dataloader statistics #22

Closed Jamy-L closed 6 months ago

Jamy-L commented 6 months ago
balthazarneveu commented 6 months ago

It seems that we do not cover the screen any more with the new "radius alpha" (before it used to be quite dense)

image

def dead_leave_plugin(ds=1):
    interactive(
        background_intensity=(0.5, [0., 1.]),
        number_of_circles=(-1, [-1, 10000]),
        colored=(False,),
        radius_alpha=(3, [1, 4]),
        seed=(0, [-1, 42]),
        ds=(ds, [ds, ds]),
        numba_flag=(True,),  # Default CPU to avoid issues by default
        # ds=(ds, [1, 5])

    )(generate_deadleave)

def generate_deadleave(
    background_intensity: float = 0.5,
    number_of_circles: int = -1,
    colored: Optional[bool] = False,
    radius_alpha: Optional[int] = 3,
    seed=0,
    ds=3,
    numba_flag=True
) -> np.ndarray:
    bg_color = (background_intensity, background_intensity, background_intensity)
    if not numba_flag:
        chart = dead_leaves_chart((512*ds, 512*ds), number_of_circles, bg_color, colored,
                                  radius_alpha=radius_alpha,
                                  seed=None if seed < 0 else seed)
    else:
        chart = gpu_dead_leaves_chart((512*ds, 512*ds), number_of_circles, bg_color, colored,
                                      radius_alpha=radius_alpha,
                                      seed=None if seed < 0 else seed).copy_to_host()
    if chart.shape[-1] == 1:
        chart = chart.repeat(3, axis=-1)
        # Required to switch from colors to gray scale visualization.
    return chart
Jamy-L commented 6 months ago
balthazarneveu commented 6 months ago

https://web.ma.utexas.edu/users/gordanz/notes/functions_color.pdf change of variable formula for random variables https://stats.libretexts.org/Bookshelves/Probability_Theory/Probability_Mathematical_Statistics_and_Stochastic_Processes_(Siegrist)/03%3A_Distributions/3.07%3A_Transformations_of_Random_Variables