Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass Keyword Argument to TabularDataBase #1522

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(<https://github.com/openvinotoolkit/datumaro/pull/1480>)
- Set label name with parents to avoid duplicates for AstypeAnnotations
(<https://github.com/openvinotoolkit/datumaro/pull/1492>)
- Pass Keyword Argument to TabularDataBase
(<https://github.com/openvinotoolkit/datumaro/pull/1522>)

### Bug fixes
- Split the video directory into subsets to avoid overwriting
Expand Down
6 changes: 4 additions & 2 deletions src/datumaro/plugins/data_formats/tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(
target: Optional[Union[str, List[str]]] = None,
dtype: Optional[Dict[str, Type[TableDtype]]] = None,
ctx: Optional[ImportContext] = None,
**kwargs,
) -> None:
"""
Read and compose a tabular dataset.
Expand All @@ -59,13 +60,14 @@ def __init__(
super().__init__(media_type=TableRow, ctx=ctx)

self._infos = {"path": path}
self._items, self._categories = self._parse(paths, target, dtype)
self._items, self._categories = self._parse(paths, target, dtype, **kwargs)

def _parse(
self,
paths: List[str],
target: Optional[Dict[str, List[str]]] = None,
dtype: Optional[Dict[str, Type[TableDtype]]] = None,
**kwargs,
) -> Tuple[List[DatasetItem], Dict[AnnotationType, Categories]]:
"""
parse tabular files. Each file is regarded as a subset.
Expand All @@ -91,7 +93,7 @@ def _parse(
raise TypeError('Target should have both "input" and "output"')

for path in paths:
table = Table.from_csv(path, dtype=dtype)
table = Table.from_csv(path, dtype=dtype, **kwargs)

targets: List[str] = []
targets_ann: List[str] = []
Expand Down
Loading