From c90ccb4b9d3ff32c8f87727d179bdff1bf8cbaaf Mon Sep 17 00:00:00 2001 From: Takafumi Iju Date: Tue, 14 Dec 2021 12:31:21 +0900 Subject: [PATCH 01/13] Add size check of image --- fastlabel/__init__.py | 14 +++++++++++++- fastlabel/const.py | 3 +++ fastlabel/utils.py | 9 +++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/fastlabel/__init__.py b/fastlabel/__init__.py index cd942ce..de11928 100644 --- a/fastlabel/__init__.py +++ b/fastlabel/__init__.py @@ -375,6 +375,10 @@ def create_image_task( if not utils.is_image_supported_ext(file_path): raise FastLabelInvalidException( "Supported extensions are png, jpg, jpeg.", 422) + if not utils.is_image_supported_size(file_path): + raise FastLabelInvalidException( + f"Supported image size is under 20 MB.", 422) + file = utils.base64_encode(file_path) payload = {"project": project, "name": name, "file": file} if status: @@ -424,6 +428,10 @@ def create_image_classification_task( if not utils.is_image_supported_ext(file_path): raise FastLabelInvalidException( "Supported extensions are png, jpg, jpeg.", 422) + if not utils.is_image_supported_size(file_path): + raise FastLabelInvalidException( + f"Supported image size is under 20 MB.", 422) + file = utils.base64_encode(file_path) payload = {"project": project, "name": name, "file": file} if status: @@ -483,6 +491,10 @@ def create_multi_image_task( raise FastLabelInvalidException( "Supported extensions are png, jpg, jpeg.", 422) + if not utils.is_image_supported_size(file_path): + raise FastLabelInvalidException( + f"Supported image size is under 20 MB.", 422) + if len(contents) == 250: raise FastLabelInvalidException( "The count of files should be under 250", 422) @@ -543,7 +555,7 @@ def create_video_task( if not utils.is_video_supported_ext(file_path): raise FastLabelInvalidException( "Supported extensions are mp4.", 422) - if os.path.getsize(file_path) > const.SUPPORTED_VIDEO_SIZE: + if not utils.is_video_supported_size(file_path): raise FastLabelInvalidException( f"Supported video size is under 250 MB.", 422) diff --git a/fastlabel/const.py b/fastlabel/const.py index ef10f5e..8f60ff2 100644 --- a/fastlabel/const.py +++ b/fastlabel/const.py @@ -10,6 +10,9 @@ # API can accept under 250 MB ( 250 * 1024 * 1024 ) SUPPORTED_VIDEO_SIZE = 262144000 +# API can accept under 20 MB ( 20 * 1024 * 1024 ) +SUPPORTED_IMAGE_SIZE = 20971520 + class AnnotationType(Enum): bbox = "bbox" diff --git a/fastlabel/utils.py b/fastlabel/utils.py index d78ec65..54afb67 100644 --- a/fastlabel/utils.py +++ b/fastlabel/utils.py @@ -4,6 +4,7 @@ import geojson import json from typing import List +import const def base64_encode(file_path: str) -> str: @@ -19,6 +20,14 @@ def is_video_supported_ext(file_path: str) -> bool: return file_path.lower().endswith('.mp4') +def is_image_supported_size(file_path: str) -> bool: + return os.path.getsize(file_path) <= const.SUPPORTED_IMAGE_SIZE + + +def is_video_supported_size(file_path: str) -> bool: + return os.path.getsize(file_path) <= const.SUPPORTED_VIDEO_SIZE + + def is_json_ext(file_name: str) -> bool: return file_name.lower().endswith('.json') From 42a73cf963372315d3633d20195bef40402acc5c Mon Sep 17 00:00:00 2001 From: Takafumi Iju Date: Tue, 14 Dec 2021 12:36:22 +0900 Subject: [PATCH 02/13] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 303fbd9..1ed9273 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,9 @@ task_id = client.create_image_task( > Check [examples/create_image_task.py](/examples/create_image_task.py). +##### Limitation +* You can upload up to a size of 20 MB. + #### Find Task Find a single task. @@ -321,6 +324,9 @@ task_id = client.create_image_classification_task( ) ``` +##### Limitation +* You can upload up to a size of 20 MB. + #### Find Task Find a single task. @@ -433,6 +439,7 @@ task = client.create_multi_image_task( ``` ##### Limitation +* You can upload up to a size of 20 MB. * You can upload up to a total size of 512 MB. * You can upload up to 250 files in total. From 7de6368d41e2d95cf2d325501698503d76c70133 Mon Sep 17 00:00:00 2001 From: Takafumi Iju Date: Sat, 18 Dec 2021 10:27:35 +0900 Subject: [PATCH 03/13] Modify to calculate content size. --- fastlabel/const.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fastlabel/const.py b/fastlabel/const.py index 8f60ff2..9a20a07 100644 --- a/fastlabel/const.py +++ b/fastlabel/const.py @@ -1,3 +1,4 @@ +import math from enum import Enum # only 57 types @@ -7,11 +8,11 @@ # Because of V8's limitation, API only can accept the JSON string that length is under this. SUPPORTED_CONTENTS_SIZE = 536870000 -# API can accept under 250 MB ( 250 * 1024 * 1024 ) -SUPPORTED_VIDEO_SIZE = 262144000 +# API can accept under 250 MB +SUPPORTED_VIDEO_SIZE = 250 * math.pow(1024, 2) -# API can accept under 20 MB ( 20 * 1024 * 1024 ) -SUPPORTED_IMAGE_SIZE = 20971520 +# API can accept under 20 MB +SUPPORTED_IMAGE_SIZE = 20 * math.pow(1024, 2) class AnnotationType(Enum): From 1d4fc4930c69f3f0e0cb144ec8b40baa03187153 Mon Sep 17 00:00:00 2001 From: Takafumi Iju Date: Sat, 18 Dec 2021 10:40:55 +0900 Subject: [PATCH 04/13] Fixed how to import const. --- fastlabel/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlabel/utils.py b/fastlabel/utils.py index 54afb67..b717f6e 100644 --- a/fastlabel/utils.py +++ b/fastlabel/utils.py @@ -4,7 +4,7 @@ import geojson import json from typing import List -import const +from fastlabel import const def base64_encode(file_path: str) -> str: From 4dd7e51dd2c97e915acac66df664c871e7e337c0 Mon Sep 17 00:00:00 2001 From: Takafumi Iju Date: Sat, 18 Dec 2021 14:29:45 +0900 Subject: [PATCH 05/13] Modify check video size. --- fastlabel/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlabel/__init__.py b/fastlabel/__init__.py index de11928..214158b 100644 --- a/fastlabel/__init__.py +++ b/fastlabel/__init__.py @@ -608,7 +608,7 @@ def create_video_classification_task( if not utils.is_video_supported_ext(file_path): raise FastLabelInvalidException( "Supported extensions are mp4.", 422) - if os.path.getsize(file_path) > const.SUPPORTED_VIDEO_SIZE: + if not utils.is_video_supported_size(file_path): raise FastLabelInvalidException( f"Supported video size is under 250 MB.", 422) From 6be501b34de6fb8c1172d95c2d592c40b0336ac5 Mon Sep 17 00:00:00 2001 From: Takafumi Iju Date: Tue, 28 Dec 2021 16:24:35 +0900 Subject: [PATCH 06/13] Add code formatter --- .pre-commit-config.yaml | 14 ++++++++++++++ contributing/README.md | 19 ++++++++++++++++++- contributing/requirements.txt | 3 ++- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b42009f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +- repo: https://github.com/psf/black + rev: 20.8b1 + hooks: + - id: black +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.4 + hooks: + - id: flake8 + args: ['--extend-ignore=E203', '--max-line-length=88'] +- repo: https://github.com/pycqa/isort + rev: 5.6.4 + hooks: + - id: isort + args: ['--profile black'] diff --git a/contributing/README.md b/contributing/README.md index 1d9d69d..069bdc3 100644 --- a/contributing/README.md +++ b/contributing/README.md @@ -18,5 +18,22 @@ $ pip install -r contributing/requirements.txt ### Run Formatter and Linter ```bash -make all +$ make all ``` + +### Enable pre-commit hook + +```bash +$ pre-commit install +``` + +Basically, `pre-commit` will only run on the changed files. +But if you execute the bellow command, you can run on all of files. + +```bash +$ pre-commit run --all-files +``` + +#### How to enable on your IDE + +* [VS code](https://marketplace.visualstudio.com/items?itemName=MarkLarah.pre-commit-vscode) diff --git a/contributing/requirements.txt b/contributing/requirements.txt index b3b14f7..e892e8f 100644 --- a/contributing/requirements.txt +++ b/contributing/requirements.txt @@ -1,3 +1,4 @@ black==20.8b1 flake8==3.8.4 -isort==5.6.4 \ No newline at end of file +isort==5.6.4 +pre-commit==2.16.0 From f7d024b5e1f9458f1c731c25345ade975a175141 Mon Sep 17 00:00:00 2001 From: Takafumi Iju Date: Tue, 28 Dec 2021 20:11:46 +0900 Subject: [PATCH 07/13] Modify yaml file. --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b42009f..e0c4415 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,4 @@ +repos: - repo: https://github.com/psf/black rev: 20.8b1 hooks: From 35dc88e6a28872a6f99269d57366bbd076a52ede Mon Sep 17 00:00:00 2001 From: Takafumi Iju Date: Tue, 28 Dec 2021 20:31:20 +0900 Subject: [PATCH 08/13] Fixed option of isort. --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e0c4415..11f31ac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,4 +12,4 @@ repos: rev: 5.6.4 hooks: - id: isort - args: ['--profile black'] + args: ['--profile', 'black'] From 0d166c5f35facf443366f0f419e310f85e8f9ab3 Mon Sep 17 00:00:00 2001 From: Takafumi Iju Date: Wed, 29 Dec 2021 08:02:48 +0900 Subject: [PATCH 09/13] Modify README.md --- contributing/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contributing/README.md b/contributing/README.md index 069bdc3..6d1ecc4 100644 --- a/contributing/README.md +++ b/contributing/README.md @@ -28,7 +28,7 @@ $ pre-commit install ``` Basically, `pre-commit` will only run on the changed files. -But if you execute the bellow command, you can run on all of files. +But if you execute the bellow command, you can run on all files. ```bash $ pre-commit run --all-files @@ -36,4 +36,7 @@ $ pre-commit run --all-files #### How to enable on your IDE +`pre-commit` will only run when you commit the file by manual. +So, you should do additional settings if you want to commit the file using IDE. + * [VS code](https://marketplace.visualstudio.com/items?itemName=MarkLarah.pre-commit-vscode) From 4160c3779914210070125897a1149b5f14bec6ba Mon Sep 17 00:00:00 2001 From: Takafumi Iju Date: Thu, 30 Dec 2021 21:38:56 +0900 Subject: [PATCH 10/13] Add types --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 11f31ac..6312378 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,13 +3,19 @@ repos: rev: 20.8b1 hooks: - id: black + files: '^.*\.py' + types: [file] - repo: https://gitlab.com/pycqa/flake8 rev: 3.8.4 hooks: - id: flake8 args: ['--extend-ignore=E203', '--max-line-length=88'] + files: '^.*\.py' + types: [file] - repo: https://github.com/pycqa/isort rev: 5.6.4 hooks: - id: isort args: ['--profile', 'black'] + files: '^.*\.py' + types: [file] From b3bce7c3a28b14e37052f3bf04d668fb6caf23d3 Mon Sep 17 00:00:00 2001 From: Takafumi Iju Date: Thu, 30 Dec 2021 22:24:40 +0900 Subject: [PATCH 11/13] Remove inappropriate explanation --- contributing/README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/contributing/README.md b/contributing/README.md index 6d1ecc4..0832187 100644 --- a/contributing/README.md +++ b/contributing/README.md @@ -33,10 +33,3 @@ But if you execute the bellow command, you can run on all files. ```bash $ pre-commit run --all-files ``` - -#### How to enable on your IDE - -`pre-commit` will only run when you commit the file by manual. -So, you should do additional settings if you want to commit the file using IDE. - -* [VS code](https://marketplace.visualstudio.com/items?itemName=MarkLarah.pre-commit-vscode) From 485e675acaf02743c06b44cd4a92f55a41c20ed8 Mon Sep 17 00:00:00 2001 From: ryoKaz Date: Wed, 26 Jan 2022 22:15:22 +0900 Subject: [PATCH 12/13] support segmentation for coco export --- fastlabel/converters.py | 197 ++++++++++++++++++++++++++++------------ 1 file changed, 137 insertions(+), 60 deletions(-) diff --git a/fastlabel/converters.py b/fastlabel/converters.py index 7b0a4d9..f98d39e 100644 --- a/fastlabel/converters.py +++ b/fastlabel/converters.py @@ -1,4 +1,6 @@ from concurrent.futures import ThreadPoolExecutor +from datetime import datetime +from decimal import Decimal from typing import List import copy @@ -76,7 +78,7 @@ def __get_categories(tasks: list, annotations: list) -> list: values = [] for task in tasks: for task_annotation in task["annotations"]: - if task_annotation["type"] != AnnotationType.bbox.value and task_annotation["type"] != AnnotationType.polygon.value and task_annotation["type"] != AnnotationType.pose_estimation.value: + if task_annotation["type"] not in [AnnotationType.bbox.value, AnnotationType.polygon.value, AnnotationType.segmentation.value, AnnotationType.pose_estimation.value]: continue values.append(task_annotation["value"]) values = list(set(values)) @@ -131,7 +133,7 @@ def __to_annotation(data: dict) -> dict: annotation_type = annotation["type"] annotation_id = 0 - if annotation_type != AnnotationType.bbox.value and annotation_type != AnnotationType.polygon.value and annotation_type != AnnotationType.pose_estimation.value: + if annotation_type not in [AnnotationType.bbox.value, AnnotationType.polygon.value, AnnotationType.segmentation.value, AnnotationType.pose_estimation.value]: return None if annotation_type != AnnotationType.pose_estimation.value and (not points or len(points)) == 0: return None @@ -144,7 +146,6 @@ def __to_annotation(data: dict) -> dict: annotation_id, points, keypoints, category["id"], image, annotation_type) - def __get_category_by_name(categories: list, name: str) -> str: category = [ category for category in categories if category["name"] == name][0] @@ -169,46 +170,104 @@ def __get_annotation(id_: int, points: list, keypoints: list, category_id: int, annotation["num_keypoints"] = len(keypoints) if keypoints else 0 annotation["keypoints"] = __get_coco_annotation_keypoints( keypoints) if keypoints else [] - annotation["segmentation"] = [points] if points else [] + annotation["segmentation"] = __to_coco_segmentation( + annotation_type, points) annotation["iscrowd"] = 0 - annotation["area"] = __calc_area(annotation_type, points) if points else 0 + annotation["area"] = __to_area(annotation_type, points) annotation["image_id"] = image["id"] - annotation["bbox"] = __to_bbox(points) if points else [] + annotation["bbox"] = __to_bbox(annotation_type, points) annotation["category_id"] = category_id annotation["id"] = id_ return annotation -def __to_bbox(points: list) -> list: - points_splitted = [points[idx:idx + 2] - for idx in range(0, len(points), 2)] +def __get_without_hollowed_points(points: list) -> list: + return [region[0] for region in points] + + +def __to_coco_segmentation(annotation_type: str, points: list) -> list: + if not points: + return [] + if annotation_type == AnnotationType.segmentation.value: + # Remove hollowed points + return __get_without_hollowed_points(points) + return [points] + + +def __to_bbox(annotation_type: str, points: list) -> list: + if not points: + return [] + base_points = [] + if annotation_type == AnnotationType.segmentation.value: + base_points = sum(__get_without_hollowed_points(points), []) + else: + base_points = points + points_splitted = [ + base_points[idx: idx + 2] for idx in range(0, len(base_points), 2) + ] polygon_geo = geojson.Polygon(points_splitted) coords = np.array(list(geojson.utils.coords(polygon_geo))) left_top_x = coords[:, 0].min() left_top_y = coords[:, 1].min() right_bottom_x = coords[:, 0].max() right_bottom_y = coords[:, 1].max() + width = right_bottom_x - left_top_x + height = right_bottom_y - left_top_y + return [__serialize(point) for point in [left_top_x, left_top_y, width, height]] - return [ - left_top_x, # x - left_top_y, # y - right_bottom_x - left_top_x, # width - right_bottom_y - left_top_y, # height - ] + +def __to_area(annotation_type: str, points: list) -> float: + if not points: + return 0 + area = 0 + if annotation_type == AnnotationType.segmentation.value: + for region in __get_without_hollowed_points(points): + area += __calc_area(annotation_type, region) + else: + area = __calc_area(annotation_type, points) + return __serialize(area) def __calc_area(annotation_type: str, points: list) -> float: - area = 0 + if not points: + return 0 if annotation_type == AnnotationType.bbox.value: width = points[0] - points[2] height = points[1] - points[3] - area = width * height - elif annotation_type == AnnotationType.polygon.value: + return width * height + elif annotation_type in [AnnotationType.polygon.value, AnnotationType.segmentation.value]: x = points[0::2] y = points[1::2] - area = 0.5 * np.abs(np.dot(x, np.roll(y, 1)) - - np.dot(y, np.roll(x, 1))) - return area + return 0.5 * np.abs( + np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1)) + ) + else: + raise Exception(f"Unsupported annotation type: {annotation_type}") + + +def __serialize(value: any) -> any: + if isinstance(value, datetime): + return value.isoformat() + if isinstance(value, Decimal): + float_value = float(value) + if float_value.is_integer(): + return int(value) + else: + return float_value + if isinstance(value, float): + if value.is_integer(): + return int(value) + if isinstance(value, np.integer): + return int(value) + if isinstance(value, np.floating): + float_value = float(value) + if float_value.is_integer(): + return int(value) + else: + return float_value + if isinstance(value, np.ndarray): + return value.tolist() + return value # YOLO @@ -373,6 +432,7 @@ def to_pascalvoc(tasks: list) -> list: pascalvoc.append(voc) return pascalvoc + def __get_pascalvoc_obj(data: dict) -> dict: annotation = data["annotation"] points = annotation["points"] @@ -403,6 +463,7 @@ def __get_pascalvoc_obj(data: dict) -> dict: }, } + def __get_pascalvoc_tag_value(annotation: dict, target_tag_name: str) -> int: attributes = annotation["attributes"] if not attributes: @@ -416,44 +477,46 @@ def __get_pascalvoc_tag_value(annotation: dict, target_tag_name: str) -> int: def to_labelme(tasks: list) -> list: - labelmes =[] + labelmes = [] for task in tasks: shapes = [] for annotation in task["annotations"]: - shape_type = __to_labelme_shape_type(annotation["type"]) - if not shape_type: - continue - points = annotation["points"] - if len(points) == 0: - continue + shape_type = __to_labelme_shape_type(annotation["type"]) + if not shape_type: + continue + points = annotation["points"] + if len(points) == 0: + continue - shape_points = [] - if annotation["type"] == "segmentation": - for i in range(int(len(points[0][0]) / 2)): - shape_points.append([points[0][0][i * 2], points[0][0][(i * 2) + 1]]) - else: - for i in range(int(len(points) / 2)): - shape_points.append([points[i * 2], points[(i * 2) + 1]]) - - shape = { - "label": annotation["value"], - "points": shape_points, - "group_id": None, - "shape_type": shape_type, - "flags": {} - } - shapes.append(shape) + shape_points = [] + if annotation["type"] == "segmentation": + for i in range(int(len(points[0][0]) / 2)): + shape_points.append( + [points[0][0][i * 2], points[0][0][(i * 2) + 1]]) + else: + for i in range(int(len(points) / 2)): + shape_points.append([points[i * 2], points[(i * 2) + 1]]) + + shape = { + "label": annotation["value"], + "points": shape_points, + "group_id": None, + "shape_type": shape_type, + "flags": {} + } + shapes.append(shape) labelmes.append({ - "version": "4.5.9", - "flags": {}, - "shapes": shapes, - "imagePath": task["name"], - "imageData": None, - "imageHeight": task["height"], - "imageWidth": task["width"], + "version": "4.5.9", + "flags": {}, + "shapes": shapes, + "imagePath": task["name"], + "imageData": None, + "imageHeight": task["height"], + "imageWidth": task["width"], }) return labelmes + def __to_labelme_shape_type(annotation_type: str) -> str: if annotation_type == "polygon" or annotation_type == "segmentation": return "polygon" @@ -515,10 +578,12 @@ def to_pixel_coordinates(tasks: list) -> list: new_regions.append(new_region) annotation["points"] = new_regions elif annotation["type"] == AnnotationType.polygon.value: - new_points = __remove_duplicated_coordinates(annotation["points"]) + new_points = __remove_duplicated_coordinates( + annotation["points"]) annotation["points"] = new_points return tasks + def __remove_duplicated_coordinates(points: List[int]) -> List[int]: """ Remove duplicated coordinates. @@ -554,6 +619,7 @@ def __remove_duplicated_coordinates(points: List[int]) -> List[int]: new_points.append(points[i*2 + 1]) return new_points + def __get_pixel_coordinates(points: List[int or float]) -> List[int]: """ Remove diagonal coordinates and return pixel outline coordinates. @@ -632,6 +698,7 @@ def execute_coco_to_fastlabel(coco: dict) -> dict: results[coco_images[coco_image_key]] = annotations return results + def execute_labelme_to_fastlabel(labelme: dict, file_path: str = None) -> tuple: file_name = "" if file_path: @@ -658,6 +725,7 @@ def execute_labelme_to_fastlabel(labelme: dict, file_path: str = None) -> tuple: return (file_name, annotations) + def execute_pascalvoc_to_fastlabel(pascalvoc: dict, file_path: str = None) -> tuple: target_pascalvoc = pascalvoc["annotation"] file_name = "" # file_path if file_path else target_pascalvoc["filename"] @@ -713,16 +781,24 @@ def execute_yolo_to_fastlabel( classs_name = classes[str(yolo_class_id)] - yolo_center_x_point = float(image_width) * float(yolo_center_x_ratio) - yolo_center_y_point = float(image_height) * float(yolo_center_y_ratio) - yolo_anno_width_size = float(image_width) * float(yolo_anno_width_ratio) - yolo_anno_height_size = float(image_height) * float(yolo_anno_height_ratio) + yolo_center_x_point = float( + image_width) * float(yolo_center_x_ratio) + yolo_center_y_point = float( + image_height) * float(yolo_center_y_ratio) + yolo_anno_width_size = float( + image_width) * float(yolo_anno_width_ratio) + yolo_anno_height_size = float( + image_height) * float(yolo_anno_height_ratio) points = [] - points.append(yolo_center_x_point - (yolo_anno_width_size / 2)) # x1 - points.append(yolo_center_y_point - (yolo_anno_height_size / 2)) # y1 - points.append(yolo_center_x_point + (yolo_anno_width_size / 2)) # x2 - points.append(yolo_center_y_point + (yolo_anno_height_size / 2)) # y2 + points.append(yolo_center_x_point - + (yolo_anno_width_size / 2)) # x1 + points.append(yolo_center_y_point - + (yolo_anno_height_size / 2)) # y1 + points.append(yolo_center_x_point + + (yolo_anno_width_size / 2)) # x2 + points.append(yolo_center_y_point + + (yolo_anno_height_size / 2)) # y2 annotations.append( { "value": classs_name, @@ -742,6 +818,7 @@ def execute_yolo_to_fastlabel( return results + def __get_annotation_type_by_labelme(shape_type: str) -> str: if shape_type == "rectangle": return "bbox" From 54eafcc8b3cf8965ed57ea375681d7c3fe6e330e Mon Sep 17 00:00:00 2001 From: ryoKaz Date: Wed, 26 Jan 2022 22:17:17 +0900 Subject: [PATCH 13/13] update version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 366d786..605f287 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name="fastlabel", - version="0.11.12", + version="0.11.13", author="eisuke-ueta", author_email="eisuke.ueta@fastlabel.ai", description="The official Python SDK for FastLabel API, the Data Platform for AI",