HumanSignal / label-studio-converter

Tools for converting Label Studio annotations into common dataset formats
https://labelstud.io/
255 stars 132 forks source link

feat: Create independent subdir containing annotations for each labeler when converting from label studio .json to YOLO #177

Closed francescocarpanese closed 1 year ago

francescocarpanese commented 1 year ago

Use case:

Issue:

In case different users performed different annotation of the same image, when exporting the results to label studio standard .json, the different labels are distinguished by compled_by=<user_id> field (ex. here ).

In the current master, when converting the exported .json to YOLO, with convert_to_yolo from label_studio_converter/converter.py, a single .txt file containing the annotation for a given image is created.

However, the current looping logic overwrites the .txt for each user and, as a result, the final .txt file contains the annotation only one user (the annotations which appear at last in the .json) file.

Moreover the information regarding the user that performed the annotation is lost in YOLO format.

Implemented solution:

The function convert_to_yolo takes now an optional argument split_labelers. If true, it generates dedicated subfolders for each use, containing the annotation of the user.

By default split_labelers is set to false preserving the former behavior.

Test:

A test is implemented for the use case, converting a json file created from label-studio with multiple labelers for the same image, which servers also as an example for documentation.

KonstantinKorotaev commented 1 year ago

Hi @francescocarpanese Great feature!

Could you please add changes from latest master to fix tests issue?

francescocarpanese commented 1 year ago

Hi @francescocarpanese Great feature!

Could you please add changes from latest master to fix tests issue?

Done