The current v2 brightness augmentation doesn’t support the ability to have a min or max brightness limit, instead it only generates a symmetric distribution… which is a problem for the work I am doing (reading medical diagnostics) as I want to train with mostly neutral -> bright images
I’ve rewritten the functions locally to support it but wanted to see if this is worth doing a PR for to add it in? It’s back compat with the current “max_lighting” default param
class _BrightnessLogit(): def __init__(self, max_lighting=0.2, min_brightness=None, max_brightness=None, p=0.75, draw=None, batch=False): store_attr(self, 'max_lighting, min_brightness,max_brightness,p,draw,batch') def _def_draw(self, x): min_rand = self.min_brightness if self.min_brightness is not None else (.5*(1-self.max_lighting)) max_rand = self.max_brightness if self.max_brightness is not None else (.5*(1+self.max_lighting)) if not self.batch: return x.new(x.size(0)).uniform_(min_rand, max_rand) return x.new_zeros(x.size(0)) + random.uniform(min_rand, max_rand) def before_call(self, x): self.change = _draw_mask(x, self._def_draw, draw=self.draw, p=self.p, neutral=0.5, batch=self.batch) def __call__(self, x): return x.add_(logit(self.change[:,None,None,None]))
or is this something where we are just expected to provide our own draw function/lambda to accomplish this?
( btw max_lighting is a very non-intuitive name…abs_lighting_change would be clearer since max_lighting is also being used to generate a min_lighting ):