k1lib.kdata module¶
Everything related to data transformation and loading. This is exposed automatically with:
from k1lib.imports import *
kdata.FunctionData # exposed
-
class
k1lib.kdata.
FunctionData
[source]¶ Bases:
object
-
k1lib.kdata.
tfImg
(size: Optional[int] = None, /, flip=True) → k1lib.cli.init.BaseCli[source]¶ Get typical image transforms. Example:
"path/img.png" | toPIL() | kdata.imgTf(224)
-
k1lib.kdata.
tfFloat
(t: Union[Iterator[float], torch.Tensor], force=True) → k1lib.cli.init.BaseCli[source]¶ Suggested float input transformation function. Example:
# before training data = torch.randn(10, 20) * 100 + 20 # weird data with weird hist distribution f = kdata.tfFloat(data) # while training newData = torch.randn(10, 20) * 105 + 15 newData | f # nicely formatted Tensor, going uniformly from -1 to 1
- Parameters
force – if True, forces weird values to 0.0, else filters out all weird rows.