Skip to content

Commit dfcb6a4

Browse files
authored
Merge pull request #54 from fastlabel/develop
Merge to main
2 parents b802610 + d84ac1b commit dfcb6a4

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

fastlabel/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import glob
33
import json
4+
from typing import List
45
from logging import getLogger
56
from PIL import Image, ImageDraw
67

@@ -615,7 +616,7 @@ def export_labelme(self, tasks: list, output_dir: str = os.path.join("output", "
615616

616617

617618
# Instance / Semantic Segmetation
618-
def export_instance_segmentation(self, tasks: list, output_dir: str = os.path.join("output", "instance_segmentation"), pallete: list[int] = const.COLOR_PALETTE) -> None:
619+
def export_instance_segmentation(self, tasks: list, output_dir: str = os.path.join("output", "instance_segmentation"), pallete: List[int] = const.COLOR_PALETTE) -> None:
619620
"""
620621
Convert tasks to index color instance segmentation (PNG files).
621622
Supports only bbox, polygon and segmentation annotation types. Hollowed points are not supported.
@@ -629,7 +630,7 @@ def export_instance_segmentation(self, tasks: list, output_dir: str = os.path.jo
629630
for task in tasks:
630631
self.__export_index_color_image(task=task, output_dir=output_dir, pallete=pallete, is_instance_segmentation=True)
631632

632-
def export_semantic_segmentation(self, tasks: list, output_dir: str = os.path.join("output", "semantic_segmentation"), pallete: list[int] = const.COLOR_PALETTE) -> None:
633+
def export_semantic_segmentation(self, tasks: list, output_dir: str = os.path.join("output", "semantic_segmentation"), pallete: List[int] = const.COLOR_PALETTE) -> None:
633634
"""
634635
Convert tasks to index color semantic segmentation (PNG files).
635636
Supports only bbox, polygon and segmentation annotation types. Hollowed points are not supported.
@@ -650,7 +651,7 @@ def export_semantic_segmentation(self, tasks: list, output_dir: str = os.path.jo
650651
for task in tasks:
651652
self.__export_index_color_image(task=task, output_dir=output_dir, pallete=pallete, is_instance_segmentation=False, classes=classes)
652653

653-
def __export_index_color_image(self, task: list, output_dir: str, pallete: list[int], is_instance_segmentation: bool = True, classes: list = []) -> None:
654+
def __export_index_color_image(self, task: list, output_dir: str, pallete: List[int], is_instance_segmentation: bool = True, classes: list = []) -> None:
654655
image = Image.new("RGB", (task["width"], task["height"]), 0)
655656
image = image.convert('P')
656657
image.putpalette(pallete)
@@ -680,7 +681,7 @@ def __export_index_color_image(self, task: list, output_dir: str, pallete: list[
680681
os.makedirs(os.path.dirname(image_path), exist_ok=True)
681682
image.save(image_path)
682683

683-
def __get_pillow_draw_points(self, points: list[int]) -> list[int]:
684+
def __get_pillow_draw_points(self, points: List[int]) -> List[int]:
684685
"""
685686
Convert points to pillow draw points. Diagonal points are not supported.
686687
"""

fastlabel/converters.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from concurrent.futures import ThreadPoolExecutor
2+
from typing import List
23

34
import copy
45
import geojson
@@ -302,7 +303,7 @@ def to_pixel_coordinates(tasks: list) -> list:
302303
continue
303304
return tasks
304305

305-
def __get_pixel_coordinates(points: list[int or float]) -> list[int]:
306+
def __get_pixel_coordinates(points: List[int or float]) -> List[int]:
306307
"""
307308
Remove diagonal coordinates and return pixel outline coordinates.
308309
"""

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setuptools.setup(
1010
name="fastlabel",
11-
version="0.9.7",
11+
version="0.9.8",
1212
author="eisuke-ueta",
1313
author_email="[email protected]",
1414
description="The official Python SDK for FastLabel API, the Data Platform for AI",

0 commit comments

Comments
 (0)