aleju / imgaug

Image augmentation for machine learning experiments.
http://imgaug.readthedocs.io
MIT License
14.36k stars 2.43k forks source link

Use imgaug with float #285

Open FrancescoSaverioZuppichini opened 5 years ago

FrancescoSaverioZuppichini commented 5 years ago

Dear All,

thank you for the amazing library. Is there a way to use it with float images? I have heightmaps and sometimes they have negative values.

aleju commented 5 years ago

There is an overview page for the dtype support at https://imgaug.readthedocs.io/en/latest/source/dtype_support.html . It shows which augmenters are currently expected to support which dtypes. Note that only uint8 is really thoroughly tested, so there is a bit of risk involved, though float32 is usually decently supported. The overview describes the support of dtypes for the augment_images() function. If your height maps are ground truth - i.e. network outputs - you might want to use heatmaps instead, which are geared towards float32. See e.g. the corresponding notebook at https://imgaug.readthedocs.io/en/latest/source/jupyter_notebooks.html . Heatmaps support custom min and max values for the value range, they just have to be decently defined (e.g. something like [-100, 100]).

FrancescoSaverioZuppichini commented 5 years ago

Okay, so probably the best solution is to normalize between [0,1], call imgaug and then denormalize back :) Got it, thank you