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

Revert "Mergeback 1.9.0 to develop" #1605

Merged
merged 1 commit into from
Sep 13, 2024
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
17 changes: 0 additions & 17 deletions 3rd-party.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7518,22 +7518,5 @@ Apache-2.0
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------
portalocker

BSD-3-Clause

Copyright 2022 Rick van Hattem

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-------------------------------------------------------------

* Other names and brands may be claimed as the property of others.
8 changes: 1 addition & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## \[Q3 2024 Release 1.9.0\]
## \[unreleased\]
### New features
- Add a new CLI command: datum format
(<https://github.com/openvinotoolkit/datumaro/pull/1570>)
- Support language dataset for DmTorchDataset
(<https://github.com/openvinotoolkit/datumaro/pull/1592>)

### Enhancements
- Change _Shape to Shape and add comments for subclasses of Shape
(<https://github.com/openvinotoolkit/datumaro/pull/1568>)
- Fix `kitti_raw` importer and exporter for dimensions (height, width, length) in meters
(<https://github.com/openvinotoolkit/datumaro/pull/1596>)

### Bug fixes
- Fix KITTI-3D importer and exporter
(<https://github.com/openvinotoolkit/datumaro/pull/1596>)

## Q3 2024 Release 1.8.0
### New features
Expand Down
16 changes: 0 additions & 16 deletions docs/source/docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@ Release Notes
.. toctree::
:maxdepth: 1

v1.9.0 (2024 Q3)
----------------

New features
^^^^^^^^^^^^
- Add a new CLI command: datum format
- Support language dataset for DmTorchDataset

Enhancements
^^^^^^^^^^^^
- Change _Shape to Shape and add comments for subclasses of Shape

Bug fixes
^^^^^^^^^
- Fix KITTI-3D importer and exporter

v1.8.0 (2024 Q3)
----------------

Expand Down
3 changes: 0 additions & 3 deletions requirements-core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,3 @@ json-stream

# TabularValidator
nltk

# torch converter for language
portalocker
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def parse_requirements(filename=CORE_REQUIREMENTS_FILE):
extras_require={
"tf": ["tensorflow"],
"tfds": ["tensorflow-datasets<4.9.3"],
"torch": ["torch", "torchvision", "torchtext==0.16.0"],
"torch": ["torch", "torchvision"],
"default": DEFAULT_REQUIREMENTS,
},
ext_modules=ext_modules,
Expand Down
4 changes: 2 additions & 2 deletions src/datumaro/plugins/data_formats/kitti_raw/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2021-2024 Intel Corporation
# Copyright (C) 2021-2023 Intel Corporation
#
# SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -182,7 +182,7 @@ def _parse_attr(cls, value):
@classmethod
def _parse_track(cls, track_id, track, categories):
common_attrs = {k: cls._parse_attr(v) for k, v in track["attributes"].items()}
scale = [track["scale"][k] for k in ["h", "w", "l"]]
scale = [track["scale"][k] for k in ["w", "h", "l"]]
label = categories[AnnotationType.label].find(track["label"])[0]

kf_occluded = False
Expand Down
8 changes: 4 additions & 4 deletions src/datumaro/plugins/data_formats/kitti_raw/exporter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2021-2024 Intel Corporation
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -339,16 +339,16 @@ def _create_tracklets(self, subset):
if not track:
track = {
"objectType": label,
"h": ann.scale[0],
"w": ann.scale[1],
"h": ann.scale[1],
"w": ann.scale[0],
"l": ann.scale[2],
"first_frame": frame_id,
"poses": [],
"finished": 1, # keep last
}
tracks[track_id] = track
else:
if [track["h"], track["w"], track["l"]] != ann.scale:
if [track["w"], track["h"], track["l"]] != ann.scale:
# Tracks have fixed scale in the format
raise DatasetExportError(
"Item %s: mismatching track shapes, "
Expand Down
51 changes: 2 additions & 49 deletions src/datumaro/plugins/framework_converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2023-2024 Intel Corporation
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT

Expand All @@ -17,7 +17,6 @@
"detection": AnnotationType.bbox,
"instance_segmentation": AnnotationType.polygon,
"semantic_segmentation": AnnotationType.mask,
"tabular": [AnnotationType.label, AnnotationType.caption],
}


Expand Down Expand Up @@ -89,10 +88,7 @@ def _gen_item(self, idx: int):
if ann.type == TASK_ANN_TYPE[self.task]
]
label = mask_tools.merge_masks((mask, label_id) for mask, label_id in masks)
elif self.task == "tabular":
label = [
ann.as_dict() for ann in item.annotations if ann.type in TASK_ANN_TYPE[self.task]
]

return image, label


Expand All @@ -107,58 +103,15 @@ def __init__(
task: str,
transform: Optional[Callable] = None,
target_transform: Optional[Callable] = None,
target: Optional[str] = None,
tokenizer: Optional[tuple[Callable, Callable]] = None,
vocab: Optional[tuple[Callable, Callable]] = None,
):
super().__init__(dataset=dataset, subset=subset, task=task)

self.transform = transform
self.target_transform = target_transform

if self.task == "tabular":
if not isinstance(target, dict):
raise ValueError(
"Target should be a dictionary with 'input' and 'output' keys."
)
self.input_target = target.get("input")
self.output_target = target.get("output")
if not self.input_target:
raise ValueError(
"Please provide target column for tabular task which is used for input"
)

if not (tokenizer and vocab):
raise ValueError("Both tokenizer and vocab must be provided for tabular task")
self.tokenizer = tokenizer
self.vocab = vocab

def __getitem__(self, idx):
image, label = self._gen_item(idx)

if self.task == "tabular":
text = image()[self.input_target]

if self.output_target:
src_tokenizer, tgt_tokenizer = self.tokenizer
src_vocab, tgt_vocab = self.vocab
src_tokens = src_tokenizer(text)
src_token_ids = src_vocab(src_tokens)

label_text = label[0]["caption"].split(f"{self.output_target}:")[-1]
tgt_tokens = tgt_tokenizer(label_text)
tgt_token_ids = tgt_vocab(tgt_tokens)

return torch.tensor(src_token_ids, dtype=torch.long), torch.tensor(
tgt_token_ids, dtype=torch.long
)
else:
tokens = self.tokenizer(text)
token_ids = self.vocab(tokens)
return torch.tensor(token_ids, dtype=torch.long), torch.tensor(
label[0]["label"], dtype=torch.long
)

if len(image.shape) == 2:
image = np.expand_dims(image, axis=-1)

Expand Down
2 changes: 1 addition & 1 deletion src/datumaro/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.9.0"
__version__ = "1.9.0rc0"
8 changes: 4 additions & 4 deletions tests/integration/cli/test_kitti_raw_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ def test_can_convert_to_kitti_raw(self):
annotations=[
Cuboid3d(
position=[1, 2, 3],
scale=[-3.62, 7.95, -1.03],
scale=[7.95, -3.62, -1.03],
label=1,
attributes={"occluded": False, "track_id": 1},
),
Cuboid3d(
position=[1, 1, 0],
scale=[23.01, 8.34, -0.76],
scale=[8.34, 23.01, -0.76],
label=0,
attributes={"occluded": False, "track_id": 2},
),
Expand All @@ -65,7 +65,7 @@ def test_can_convert_to_kitti_raw(self):
annotations=[
Cuboid3d(
position=[0, 1, 0],
scale=[23.01, 8.34, -0.76],
scale=[8.34, 23.01, -0.76],
rotation=[1, 1, 3],
label=0,
attributes={"occluded": True, "track_id": 2},
Expand All @@ -92,7 +92,7 @@ def test_can_convert_to_kitti_raw(self):
annotations=[
Cuboid3d(
position=[1, 2, 3],
scale=[13.54, -9.41, 0.24],
scale=[-9.41, 13.54, 0.24],
label=1,
attributes={"occluded": False, "track_id": 3},
)
Expand Down
Loading
Loading