Skip to content

Commit

Permalink
Fix RLE counts (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
klemen1999 authored and kozlov721 committed Aug 19, 2024
1 parent 7c0fa0f commit 8893d30
Showing 1 changed file with 8 additions and 8 deletions.
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,
}

0 comments on commit 8893d30

Please sign in to comment.