File size: 1,994 Bytes
424188c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import os
import os.path as osp
import numpy as np


head = '''
<html>
<head>
<style>
td {text-align: center;}
</style>
</head>
<p>  
</p>
<br>
<table border="1">
'''

end = '''
</table>
<br>`
</html>
'''

def writeHTML(out_path, results_dirs):
    f = open(out_path, 'w')
    f.write(head + '\n')
    f.write('<tr>'
            '<td style="background-color:#FFFFFF"> ID </td> '
            '<td style="background-color:#FFFFFF"> Input </td> '
            '<td style="background-color:#FFFFFF"> ConvMPN </td> '
            '<td style="background-color:#FFFFFF"> Exp-cls </td> '
            '<td style="background-color:#FFFFFF"> HAWP </td> '
            '<td style="background-color:#FFFFFF"> LETR </td> '
            '<td style="background-color:#FFFFFF"> HEAT (Ours) </td> '
            '<td style="background-color:#FFFFFF"> G.T.  </td> '
            '</tr>')

    fileids_path = '../data/cities_dataset/valid_list.txt'
    img_base = '../data/cities_dataset/rgb'
    with open(fileids_path) as ff:
        file_ids = ff.readlines()
        file_ids = file_ids[50:]
    file_ids = [file_id.strip() for file_id in file_ids]
    permuted_ids = np.random.permutation(file_ids)
    file_ids = permuted_ids[:100]

    for file_id in file_ids:
        row_str = '<tr>'
        row_str += '<td> {} </td>'.format(file_id)
        row_str += '<td> <img src="{}" width="180"> </td>'.format(os.path.join(img_base, file_id + '.jpg'))
        for dir_idx, result_dir in enumerate(results_dirs):
            pred_filepath = osp.join(result_dir, '{}.png'.format(file_id))
            row_str += '<td> <img src="{}" width="180"> </td>'.format(pred_filepath)
        row_str += '</tr>'
        f.write(row_str + '\n')

    f.write(end + '\n')


if __name__ == '__main__':
    results_dirs = ['svg_images_256/convmpn', 'svg_images_256/exp_cls', 'svg_images_256/hawp', 'svg_images_256/letr', 'svg_images_256/heat', 'svg_images_256/gt']

    writeHTML(out_path='./outdoor_qual.html', results_dirs=results_dirs)