0%

对Lavalindoor数据集crops曝光程度进行分析

在分析emlight的intensity项loss为何不下降的过程中,我发现有一张全黑的crop,经过tonemapping后仍然为全黑的,但是重新曝光系数ahpla竟然能达到10的6次方数量级。

我觉得这是由于不合理的tonemapping函数设计导致的。参照另一个人的tonemapping函数设计方法,我在检测到全黑crop时直接将re-expose系数设置为1。

修改后函数如下:

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
class TonemapHDR(object):
"""
Tonemap HDR image globally. First, we find alpha that maps the (max(numpy_img) * percentile) to max_mapping.
Then, we calculate I_out = alpha * I_in ^ (1/gamma)
input : nd.array batch of images : [H, W, C]
output : nd.array batch of images : [H, W, C]
"""

def __init__(self, gamma=2.4, percentile=50, max_mapping=0.5):
self.gamma = gamma
self.percentile = percentile
self.max_mapping = max_mapping # the value to which alpha will map the (max(numpy_img) * percentile) to

def __call__(self, numpy_img, clip=True, alpha=None, gamma=True):
if gamma:
power_numpy_img = np.power(numpy_img, 1 / self.gamma)
else:
power_numpy_img = numpy_img
non_zero = power_numpy_img > 0
if non_zero.any():
r_percentile = np.percentile(power_numpy_img[non_zero], self.percentile)
else:
# r_percentile = np.percentile(power_numpy_img, self.percentile)
# https://github.com/weberhen/Illumination-Estimation-1/blob/9bd3bc4533960afd72b3496ff8601f03b6e799f6/gen_hdr_crops.py#L8
# 全零输入,直接不变动
alpha = 1

if alpha is None:
alpha = self.max_mapping / (r_percentile + 1e-10)
tonemapped_img = np.multiply(alpha, power_numpy_img)

if clip:
tonemapped_img = np.clip(tonemapped_img, 0, 1)

return tonemapped_img.astype('float32'), alpha

这种修改应该能禁止全黑crop干扰emlight的学习了。为了看看我这次改动ban掉了多少坏crops,我专门写了点代码遍历了一遍数据集,搜寻这种全黑crop。结果只发现了之前发现的那一张。所以说,就一张坏图片,对emlight的影响应该没那么大?

接着我想看看有多少crops的ahpla是大于100或小于0.01的。这种图我觉得算是太亮或者太暗的图。结果一张都没有。数据集还是不错的。

然后缩小范围,用20个线程分布式地检查整个数据集的不同区间,搜一下有多少crops的ahpla是大于50或小于0.02的。下面列出了输出结果,先是被查出的图片名称及其ahpla系数,接着是20个线程各自查出多少张(可以看出“坏数据”在整个数据集上的分布),最后还统计了总的张数。

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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
AG8A0159-others-320-1    59.52106566873854
AG8A3897-others-120-1 54.21067904036069
AG8A0251-others-240-2 63.29404408421544
9C4A8715-others-80-1 54.52313750036537
AG8A9361-others-320-1 69.897020251167
9C4A8673-others-240-2 50.71437620814117
AG8A0781-others-160-2 53.904227630950764
AG8A0907-others-40-1 55.95169051131642
AG8A9487-others-40-2 60.097283122808314
AG8A9746-others-80-1 61.94711944112786
9C4A9751-others-200-1 56.29987194255647
AG8A8113-others-120-1 56.775796094339576
9C4A6681-others-120-1 58.55627943106775
AG8A7177-others-280-1 54.52313750036537
AG8A9109-others-00-1 62.947978191196626
9C4A8967-others-120-1 63.4695208240741
9C4A1187-others-280-1 53.01900870581253
9C4A9709-others-200-2 55.83724905204878
AG8A4366-others-280-1 52.92366673902601
9C4A2158-others-40-1 64.3724313136348
9C4A8624-others-80-1 62.440731624923764
AG8A7681-others-00-1 78.8903822032828
9C4A2158-others-200-2 68.25202044003838
AG8A9872-others-160-1 60.392608722473895
9C4A8715-others-00-1 63.6466598767675
AG8A9704-others-320-2 55.38729787186675
AG8A9361-others-200-1 71.68512492472499
AG8A0293-others-280-2 62.274710888086645
AG8A0781-others-120-2 50.149691875628925
AG8A8197-others-280-1 58.15874175266221
AG8A1806-others-240-1 59.52106566873854
9C4A9373-others-00-1 51.47326169317001
AG8A9746-others-00-1 71.68512492472499
AG8A8941-others-40-1 56.18299192134972
9C4A8967-others-160-1 67.3690127490823
AG8A9529-others-320-1 67.58612249688619
9C4A8925-others-200-1 71.68512492472499
9C4A2158-others-80-2 65.51595327495049
AG8A0083-others-160-1 51.046937918071244
AG8A0907-others-00-1 54.73488042832818
9C4A8967-others-40-1 58.42274478888599
AG8A9788-others-00-2 66.3179101202389
9C4A9709-others-00-1 59.379920759525675
9C4A2116-others-240-1 82.47374789984309
AG8A9788-others-160-1 64.93563386069304
AG8A2937-others-240-1 67.80562950082691
9C4A2116-others-320-1 52.82890618336761
AG8A9184-others-00-2 50.87973512453133
AG8A9361-others-240-1 76.11116288715907
AG8A8983-others-200-2 64.74604133176966
AG8A7681-others-320-1 76.11116288715907
9C4A8540-others-280-1 56.89693094853549
9C4A9009-others-240-1 59.52106566873854
AG8A5608-others-40-1 53.01900870581253
AG8A7681-others-280-1 73.34870621789909
AG8A7723-others-240-1 62.11018141933448
9C4A8239-others-80-1 58.55627943106775
AG8A9151-others-320-1 50.38907056264851
AG8A0041-others-200-1 62.274710888086645
AG8A8113-others-160-1 59.52106566873854
AG8A9830-others-160-1 52.091011626246505
9C4A8582-others-320-2 70.3924047660264
AG8A4366-others-120-2 55.61072681522241
AG8A9788-others-120-1 69.17565881787097
AG8A9788-others-40-1 62.11018141933448
9C4A8715-others-40-1 56.41758314133693
9C4A9373-others-160-1 71.15840799045587
9C4A2158-others-120-2 59.95145395042885
9C4A9709-others-320-1 70.3924047660264
AG8A9445-others-240-1 55.27672199457408
AG8A0251-others-320-2 57.26567409864556
9C4A8715-others-320-2 73.63896886593696
AG8A9746-others-280-1 53.01900870581253
AG8A9746-others-320-1 60.84499975427419
AG8A1806-others-200-1 59.23990777528832
9C4A9709-others-80-1 50.632383277580864
AG8A9487-others-320-1 68.25202044003838
AG8A9235-others-320-1 56.18299192134972
9C4A6723-others-280-1 53.904227630950764
AG8A9529-others-280-1 66.52367512570203
AG8A9529-others-00-1 69.65373181055384
AG8A0151-others-240-2 52.82890618336761
AG8A9445-others-00-1 61.94711944112786
9C4A8925-others-40-1 68.94076571897297
AG8A7723-others-200-1 56.775796094339576
AG8A9109-others-280-2 50.070755389724226
9C4A8925-others-240-1 76.44050481264026
AG8A9746-others-240-1 68.25202044003838
AG8A1932-others-280-1 58.42274478888599
AG8A7135-others-280-1 55.72359288919754
9C4A8365-others-80-2 57.64268123863262
9C4A8582-others-200-1 62.11018141933448
9C4A9261-others-280-1 62.60826782694604
9C4A8155-others-320-1 51.73494991199591
AG8A9487-others-00-1 51.64722164972049
AG8A9487-others-160-1 58.42274478888599
AG8A3897-others-280-2 52.64110142130879
AG8A9361-others-160-1 59.379920759525675
AG8A0251-others-280-1 69.17565881787097
AG8A9529-others-200-1 66.73162920445048
9C4A8239-others-40-2 61.15307361066433
9C4A8967-others-240-1 59.806817141111736
AG8A9746-others-200-1 9C4A9583-others-200-1 65.32055771938946
51.64722164972049
AG8A2937-others-00-2 9C4A2158-others-240-1 76.44050481264026
50.22905621671314
AG8A9025-others-00-1 56.29987194255647
AG8A8983-others-120-1 62.274710888086645
9C4A2116-others-200-2 70.14322385072398
AG8A7051-others-80-1 57.516073643446866
AG8A2937-others-280-1 62.947978191196626
9C4A8624-others-160-2 65.91278500140373
AG8A9487-others-240-1 66.11429340057413
AG8A8941-others-00-2 52.82890618336761
9C4A8925-others-160-2 65.32055771938946
9C4A9583-others-240-2 9C4A8624-others-320-1 50.22905621671314
54.10787130177366
9C4A2116-others-280-1 73.63896886593696
AG8A4366-others-240-1 73.63896886593696
9C4A9373-others-40-1 54.73488042832818
9C4A6216-others-320-2 60.392608722473895
AG8A0041-others-160-1 62.77734412061457
9C4A8582-others-00-1 72.7796584112398
AG8A9330-others-280-2 58.42274478888599
AG8A7681-others-240-1 55.72359288919754
AG8A9361-others-00-1 63.8254961244078
9C4A8925-others-120-1 77.45842713113146
AG8A0083-others-120-1 51.046937918071244
9C4A8582-others-280-2 69.65373181055384
9C4A6216-others-240-1 55.057804196312304
AG8A9830-others-40-2 67.80562950082691
9C4A8967-others-320-2 65.12713003817497
9C4A9583-others-280-2 54.949444191393724
9C4A6216-others-00-1 50.38907056264851
AG8A9529-others-120-1 60.24433048485841
AG8A9830-others-80-1 65.91278500140373
AG8A9235-others-240-1 59.52106566873854
AG8A7681-others-40-1 66.3179101202389
AG8A9361-others-280-1 75.46667986552272
9C4A9261-others-00-1 61.78550158595973
9C4A2116-others-80-2 51.55999342944569
9C4A6174-others-200-2 61.30912004791065
AG8A9872-others-40-1 68.70856157408781
9C4A8365-others-120-1 55.057804196312304
AG8A0159-others-200-1 50.632383277580864
9C4A8967-others-80-1 60.097283122808314
9C4A8925-others-80-1 62.11018141933448
9C4A8673-others-40-1 63.6466598767675
9C4A9835-others-280-1 55.057804196312304
AG8A7261-others-280-2 68.47899946200108
9C4A1203-others-00-1 55.61072681522241
9C4A9877-others-00-1 57.018947149273814
9C4A7619-others-00-1 61.46652084417405
AG8A0697-others-320-2 54.21067904036069
9C4A8239-others-320-1 68.02757980392502
AG8A3897-others-40-1 58.96321322763749
9C4A8582-others-80-1 65.51595327495049
9C4A9261-others-320-2 68.70856157408781
9C4A6723-others-120-1 57.516073643446866
AG8A9193-others-200-1 56.41758314133693
AG8A9788-others-200-1 59.23990777528832
9C4A8715-others-200-1 66.3179101202389
9C4A8715-others-280-1 73.06229877077423
AG8A9788-others-80-1 65.12713003817497
AG8A0159-others-280-1 68.25202044003838
9C4A8673-others-80-1 64.00604986249729
AG8A9872-others-80-1 71.15840799045587
9C4A8582-others-240-1 69.65373181055384
9C4A2158-others-280-1 73.63896886593696
AG8A8899-others-200-1 51.91194607304803
AG8A9487-others-80-2 57.770232868617896
AG8A9330-others-00-1 65.32055771938946
AG8A2811-others-200-1 61.30912004791065
AG8A8603-others-240-1 53.40629634227548
AG8A9529-others-40-1 50.96310262486813
9C4A8239-others-00-1 73.63896886593696
AG8A9445-others-280-2 66.52367512570203
AG8A9704-others-200-2 58.42274478888599
AG8A9529-others-240-1 67.58612249688619
AG8A9704-others-00-1 66.52367512570203
AG8A9109-others-320-1 65.51595327495049
AG8A9193-others-240-1 51.82319181513371
AG8A9487-others-200-1 67.58612249688619
AG8A3897-others-80-1 62.947978191196626
9C4A8239-others-120-1 53.703169352270685
AG8A2937-others-320-1 77.45842713113146
AG8A9487-others-280-1 64.18834940534127
AG8A4366-others-200-1 74.53378341049564
AG8A9361-others-40-2 56.89693094853549
9C4A2074-others-280-1 56.29987194255647
AG8A1806-others-280-1 AG8A9830-others-00-1 51.21602499759086
55.72359288919754
AG8A9025-others-80-1 50.308846581013185
AG8A7051-others-40-1 50.070755389724226
9C4A8540-others-240-2 57.64268123863262
AG8A9582-others-40-1 53.30857310427664
AG8A9830-others-120-1 64.55831734135951
AG8A7051-others-120-1 57.770232868617896
9C4A8673-others-320-1 52.64110142130879
AG8A0697-others-120-2 53.40629634227548
AG8A8983-others-240-1 52.73471745690875
AG8A9529-others-160-2 57.770232868617896
9C4A8715-others-240-1 76.11116288715907
9C4A8624-others-200-1 65.51595327495049
AG8A8983-others-160-1 61.46652084417405
9C4A8925-others-280-1 65.12713003817497
AG8A7135-others-320-1 51.046937918071244
9C4A6723-others-80-1 64.00604986249729
AG8A9788-others-320-1 63.8254961244078
9C4A9709-others-280-1 66.11429340057413
9C4A8925-others-00-1 79.26268618502056
9C4A9835-others-120-2 62.947978191196626
AG8A9872-others-120-1 59.23990777528832
9C4A8673-others-00-1 61.94711944112786
AG8A9151-others-120-1 60.097283122808314
AG8A9025-others-120-1 62.77734412061457
9C4A8673-others-120-1 61.30912004791065
9C4A9709-others-120-1 56.29987194255647
AG8A0251-others-00-1 57.26567409864556
9C4A8624-others-120-1 64.74604133176966
9C4A8967-others-280-1 60.84499975427419
9C4A9625-others-320-1 61.6253119608176
AG8A0655-others-160-1 50.55083591566897
AG8A0697-others-00-1 51.13124427466885
9C4A9373-others-200-1 70.6446173180134
AG8A7681-others-120-2 61.6253119608176
AG8A9372-others-200-1 56.775796094339576
9C4A8582-others-40-1 70.6446173180134
AG8A1932-others-200-2 50.070755389724226
9C4A7787-others-00-1 54.628659258679996
AG8A4366-others-160-1 61.6253119608176
9C4A2158-others-320-1 56.18299192134972
AG8A9746-others-40-1 69.65373181055384
9C4A6723-others-40-1 52.272202347256666
AG8A9704-others-280-1 61.94711944112786
AG8A9704-others-240-1 9C4A9835-others-160-1 53.114931278458094
63.6466598767675
MyThread17 :11
MyThread12 :15AG8A9445-others-320-2
63.120202854156545
AG8A9330-others-320-1 71.95351091236348
MyThread5 :13
MyThread0 :6
MyThread6 :12
MyThread10 :6
MyThread7AG8A1932-others-240-1 66.94180564168063 :17

MyThread13 :13
MyThread18 :9
MyThread1 :11
MyThread3 :13
9C4A8673-others-280-2 AG8A0293-others-240-1 61.94711944112786
57.64268123863262
MyThread11 :10
MyThread15 :11
MyThread16 :7
MyThread4 :20
MyThread8 :14
MyThread2 :15
MyThread19 :11
MyThread9 :13
MyThread14 :15
(emlight) jixinlong@ubun:~/Illumination-Estimation-1/RegressionNetwork/representation$ ls tmp|wc -l
191

有191张,且绝大部分是太暗的,需要用50~70的系数重曝光。坏数据在数据集上的分布基本均匀。