-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from fastlabel/feature/export-yolo
segementationのプロジェクトのyolo形式でのexport
- Loading branch information
Showing
5 changed files
with
205 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import fastlabel | ||
|
||
client = fastlabel.Client() | ||
|
||
project_slug = "YOUR_PROJECT_SLUG" | ||
tasks = client.get_image_tasks(project=project_slug) | ||
|
||
client.export_yolo(project=project_slug, tasks=tasks, output_dir="./export_yolo/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import glob | ||
import os | ||
import time | ||
|
||
import fastlabel | ||
|
||
client = fastlabel.Client() | ||
|
||
project = "YOUR_PROJECT_SLUG" | ||
|
||
input_file_path = "./classes.txt" | ||
input_dataset_path = "./dataset/" | ||
annotations_map = client.convert_yolo_to_fastlabel( | ||
classes_file_path=input_file_path, | ||
dataset_folder_path=input_dataset_path, | ||
project_type="segmentation", | ||
) | ||
for image_file_path in glob.iglob( | ||
os.path.join(input_dataset_path, "**/**.jpg"), recursive=True | ||
): | ||
time.sleep(1) | ||
name = image_file_path.replace(os.path.join(*[input_dataset_path, ""]), "") | ||
file_path = image_file_path | ||
annotations = ( | ||
annotations_map.get(name) if annotations_map.get(name) is not None else [] | ||
) | ||
task_id = client.create_image_task( | ||
project=project, name=name, file_path=file_path, annotations=annotations | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters