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

Fix RLE counts #144

Merged
merged 1 commit into from
Aug 12, 2024
Merged
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
16 changes: 8 additions & 8 deletions luxonis_ml/data/datasets/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pycocotools.mask as mask_util
from PIL import Image, ImageDraw
from pydantic import ConfigDict, Field, field_validator, model_validator
from pydantic.types import FilePath, PositiveInt
from pydantic.types import FilePath, NonNegativeInt, PositiveInt
from typing_extensions import Annotated, TypeAlias

from luxonis_ml.utils import BaseModelExtraForbid, Registry
Expand Down Expand Up @@ -229,7 +229,7 @@ class RLESegmentationAnnotation(SegmentationAnnotation):

height: PositiveInt
width: PositiveInt
counts: Union[List[PositiveInt], bytes]
counts: Union[List[NonNegativeInt], bytes]

def get_value(self) -> Dict[str, Any]:
if isinstance(self.counts, bytes):
Expand Down Expand Up @@ -438,12 +438,12 @@ def to_parquet_dict(self) -> ParquetDict:
"file": self.file.name,
"type": self.annotation.__class__.__name__,
"created_at": datetime.utcnow(),
"class": self.annotation.class_ or ""
if self.annotation is not None
else "",
"instance_id": self.annotation.instance_id or -1
if self.annotation is not None
else -1,
"class": (
self.annotation.class_ or "" if self.annotation is not None else ""
),
"instance_id": (
self.annotation.instance_id or -1 if self.annotation is not None else -1
),
"task": self.annotation.task if self.annotation is not None else "",
"annotation": json_value,
}
Loading