Skip to content

Commit

Permalink
fix(preprocessing/experiment_video): add descriptor and JSON serializ…
Browse files Browse the repository at this point in the history
…er for `ExperimentVideo`
  • Loading branch information
ruancomelli committed Jun 15, 2022
1 parent 884b993 commit ee380da
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion boiling_learning/preprocessing/experiment_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@
from loguru import logger

from boiling_learning.datasets.sliceable import SliceableDataset
from boiling_learning.io import json
from boiling_learning.preprocessing.preprocessing import sync_dataframes
from boiling_learning.preprocessing.video import PimsVideo, VideoFrame, convert_video
from boiling_learning.utils import PathLike, dataframe_categories_to_int, merge_dicts, resolve
from boiling_learning.utils.dataclasses import dataclass, field
from boiling_learning.utils.descriptions import describe
from boiling_learning.utils.utils import (
PathLike,
dataframe_categories_to_int,
merge_dicts,
resolve,
)


class ExperimentVideo:
Expand Down Expand Up @@ -338,3 +345,13 @@ def targets(self, select_columns: Optional[Union[str, List[str]]] = None) -> pd.
df = df[select_columns]

return df


@json.encode.instance(ExperimentVideo)
def _encode_video(obj: ExperimentVideo) -> json.JSONDataType:
return json.serialize(obj.path)


@describe.instance(ExperimentVideo)
def _describe_video(obj: ExperimentVideo) -> Path:
return obj.path

0 comments on commit ee380da

Please sign in to comment.