File size: 1,025 Bytes
873e677
0a5208a
873e677
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import json
from typing import Dict


def prepare_report(scheduler_name: str, results: dict):
    image_grid = results["images"]
    scores = results["scores"]
    img_str = ""

    image_name = f"{scheduler_name}_images.png"
    image_grid.save(image_name)
    img_str = img_str = f"![img_grid_{scheduler_name}](/file=./{image_name})\n"

    report_str = f"""
\n\n## {scheduler_name}

### Sample images

{img_str}

### Scores

{scores}
\n\n
    """

    return report_str


def add_psnr_ssim_to_report(
    original_scheduler_name: str, ssim_scores: Dict = None, psnr_scores: Dict = None
) -> str:
    current_str = ""
    if ssim_scores is not None:
        current_str += f"""
\n\n
## SSIM

SSIM computed w.r.t the images generated with {original_scheduler_name}:\n\n {json.dumps(ssim_scores, indent=6)}
"""
    if psnr_scores is not None:
        current_str += f"""
\n\n
## PSNR

PSNR computed w.r.t the images generated with {original_scheduler_name}:\n\n {json.dumps(psnr_scores, indent=6)}
"""
    return current_str