Skip to content

Commit 9f4a4f0

Browse files
reformat black
1 parent 7737c56 commit 9f4a4f0

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

examples/import_yolo.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import fastlabel
2-
import os
31
import glob
2+
import os
43
import time
54

5+
import fastlabel
6+
67
client = fastlabel.Client()
78

89
project = "YOUR_PROJECT_SLUG"
@@ -12,16 +13,17 @@
1213
annotations_map = client.convert_yolo_to_fastlabel(
1314
classes_file_path=input_file_path,
1415
dataset_folder_path=input_dataset_path,
15-
project_type="segmentation"
16+
project_type="segmentation",
1617
)
17-
for image_file_path in glob.iglob(os.path.join(input_dataset_path, "**/**.jpg"), recursive=True):
18+
for image_file_path in glob.iglob(
19+
os.path.join(input_dataset_path, "**/**.jpg"), recursive=True
20+
):
1821
time.sleep(1)
1922
name = image_file_path.replace(os.path.join(*[input_dataset_path, ""]), "")
2023
file_path = image_file_path
21-
annotations = annotations_map.get(name) if annotations_map.get(name) is not None else []
24+
annotations = (
25+
annotations_map.get(name) if annotations_map.get(name) is not None else []
26+
)
2227
task_id = client.create_image_task(
23-
project=project,
24-
name=name,
25-
file_path=file_path,
26-
annotations=annotations
28+
project=project, name=name, file_path=file_path, annotations=annotations
2729
)

fastlabel/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2890,7 +2890,10 @@ def convert_pascalvoc_to_fastlabel(self, folder_path: str) -> dict:
28902890
return results
28912891

28922892
def convert_yolo_to_fastlabel(
2893-
self, classes_file_path: str, dataset_folder_path: str, project_type: str,
2893+
self,
2894+
classes_file_path: str,
2895+
dataset_folder_path: str,
2896+
project_type: str,
28942897
) -> dict:
28952898
"""
28962899
Convert YOLO format to FastLabel format as annotation files.
@@ -2948,7 +2951,7 @@ def convert_yolo_to_fastlabel(
29482951
image_sizes = self.__get_yolo_image_sizes(dataset_folder_path)
29492952
yolo_annotations = self.__get_yolo_format_annotations(dataset_folder_path)
29502953

2951-
if (project_type == "segmentation"):
2954+
if project_type == "segmentation":
29522955
return converters.execute_segmentation_yolo_to_fastlabel(
29532956
classes,
29542957
image_sizes,

0 commit comments

Comments
 (0)