-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: video/path dataframe cross-reference (#33)
- add VideoDataFrameBuilder - update PathDataFrameBuilder - update yaak dataset template
- Loading branch information
1 parent
2f8e584
commit ffd14dc
Showing
9 changed files
with
122 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name = "rbyte" | ||
version = "0.10.2" | ||
version = "0.11.0" | ||
description = "Multimodal PyTorch dataset library" | ||
authors = [{ name = "Evgenii Gorchakov", email = "[email protected]" }] | ||
maintainers = [{ name = "Evgenii Gorchakov", email = "[email protected]" }] | ||
|
@@ -18,7 +18,7 @@ dependencies = [ | |
"parse>=1.20.2", | ||
"structlog>=24.4.0", | ||
"tqdm>=4.66.5", | ||
"pipefunc>=0.46.0", | ||
"pipefunc>=0.50.0", | ||
] | ||
readme = "README.md" | ||
requires-python = ">=3.12,<3.13" | ||
|
@@ -49,7 +49,7 @@ yaak = ["protobuf", "ptars>=0.0.3"] | |
jpeg = ["simplejpeg>=1.7.6"] | ||
video = [ | ||
"python-vali>=4.2.0.post0; sys_platform == 'linux'", | ||
"video-reader-rs>=0.2.1", | ||
"video-reader-rs>=0.2.2", | ||
] | ||
hdf5 = ["h5py>=3.12.1"] | ||
rrd = ["rerun-sdk>=0.21.0", "pyarrow-stubs"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from collections.abc import Mapping | ||
from os import PathLike | ||
from pathlib import Path | ||
from typing import Literal, final | ||
|
||
import polars as pl | ||
from polars._typing import PolarsIntegerType # noqa: PLC2701 | ||
from polars.datatypes import ( | ||
IntegerType, # pyright: ignore[reportUnusedImport] # noqa: F401 | ||
) | ||
from pydantic import ConfigDict, validate_call | ||
from video_reader import ( | ||
PyVideoReader, # pyright: ignore[reportAttributeAccessIssue, reportUnknownVariableType] | ||
) | ||
|
||
type Fields = Mapping[Literal["frame_idx"], PolarsIntegerType] | ||
|
||
|
||
@final | ||
class VideoDataFrameBuilder: | ||
__name__ = __qualname__ | ||
|
||
@validate_call(config=ConfigDict(arbitrary_types_allowed=True)) | ||
def __init__(self, fields: Fields) -> None: | ||
self._fields = fields | ||
|
||
def __call__(self, path: PathLike[str]) -> pl.DataFrame: | ||
vr = PyVideoReader(Path(path).resolve().as_posix()) # pyright: ignore[reportUnknownVariableType] | ||
info = vr.get_info() # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType] | ||
frame_count = int(info["frame_count"]) # pyright: ignore[reportUnknownArgumentType] | ||
data = pl.arange(frame_count, eager=True) | ||
|
||
return pl.DataFrame(data=data, schema=self._fields) # pyright: ignore[reportArgumentType] |
Submodule idl-repo
updated
from d87f1e to fe299e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters