Solved: Help needed: Brightness has no effect on TensorImage

I create a batch of 9 images, with 0.0 as background and a 1.0 rectangle in the middle.
The Brightness transformation does not seem to touch these images, the min and max remain at 0 and 1 after the transformation.

What did I do wrong? Any hint will be greatly appreciated. Thanks!

bs=9
a=np.zeros((bs,3,100,100), dtype=np.float32)
a[...,30:70,30:70]=1.0
b=TensorImage(torch.from_numpy(a))
out=Brightness(max_lighting=0.5, p=1.0, batch=False)(b)
for i in range(bs):
    print(i, out[i].min(), out[i].max())
    show_image(out[i], vmin=0, vmax=1)

The output:

0 tensor(0.) tensor(1.)
1 tensor(0.) tensor(1.)
2 tensor(0.) tensor(1.)
3 tensor(0.) tensor(1.)
4 tensor(0.) tensor(1.)
5 tensor(0.) tensor(1.)
6 tensor(0.) tensor(1.)
7 tensor(0.) tensor(1.)
8 tensor(0.) tensor(1.)

Okay, after tracing the code, I need to add split_idx=0, in order for Brightness to be applied. I also need to change the range of the initial intensity, as brightness change won’t affect the super bright or super dark pixels. The new code works now:

bs=9
a=np.zeros((bs,3,100,100), dtype=np.float32)+0.2
a[...,30:70,30:70]=0.8
b=TensorImage(torch.from_numpy(a))
out=Brightness(max_lighting=0.5, p=1.0, batch=False)(b, split_idx=0)
for i in range(bs):
    print(i, out[i].min(), out[i].max())
    show_image(out[i], vmin=0, vmax=1)

output

0 tensor(0.3079) tensor(0.8768)
1 tensor(0.3053) tensor(0.8755)
2 tensor(0.2997) tensor(0.8726)
3 tensor(0.1618) tensor(0.7554)
4 tensor(0.2975) tensor(0.8714)
5 tensor(0.4164) tensor(0.9194)
6 tensor(0.1323) tensor(0.7092)
7 tensor(0.1203) tensor(0.6864)
8 tensor(0.0809) tensor(0.5847)