Neil Wadhvana
11/28/2024, 9:31 PMtorchvision or kornia on a daft dataframe column.
To do this, I have 3 options:
• wrap it in a function and apply it using transform()
• wrap it in a stateful udf and take care of all the typing (this needs to be done for every class I want to use) to make it behave nicely
• try applying it with .apply() directly.
I think the latter should be the best bet, especially if I know that the transform state does not change with each application.
Is there any better API you could suggest for applying such transforms without wrapping them in extra boilerplate code? The blocker is specifically the __qualname__ check in .apply().Neil Wadhvana
11/28/2024, 9:34 PMfrom kornia.augmentation import RandomHorizontalFlip
df = df.with_column(
"image",
df["image"].apply(
RandomHorizontalFlip(p=0.7, keepdim=True), return_dtype=daft.DataType.python()
),
)Neil Wadhvana
11/28/2024, 9:35 PMjay
11/28/2024, 9:37 PMjay
11/28/2024, 9:37 PMNeil Wadhvana
11/28/2024, 9:38 PMNeil Wadhvana
11/28/2024, 9:39 PMjay
11/28/2024, 9:41 PMNeil Wadhvana
11/28/2024, 9:42 PMNeil Wadhvana
11/28/2024, 9:42 PMapply() directlyNeil Wadhvana
11/28/2024, 9:57 PMdef with_qualname(obj: object) -> object:
if not hasattr(obj, "__qualname__"):
obj.__qualname__ = obj.__class__.__name__
return obj