We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
instead of saving labels as json file i need to save it in YOLO format <class_label>
The text was updated successfully, but these errors were encountered:
to convert the json label to the yolo txt labels I use:
import json from pathlib import Path def create_yolo_label(file, class_dict): with open(file, "r") as json_file: data = json.load(json_file) height=data['imageHeight'] width=data['imageWidth'] with open(f"{file.stem}.txt", "a") as yolo_label_file: for segment in data['shapes']: label_index=class_dict[segment['label']] label_line = f'{label_index} ' + ' '.join(f'{x/width} {y/height} ' for x,y in segment['points']) yolo_label_file.write(f'{label_line}\n') filelist=list(Path('./').glob('*.json')) class_dict={'dog':0} #example sigle class for file in filelist: create_yolo_label(file, class_dict=class_dict)
this script will look for all the json files in the folder and save for each a .txt file in the yolov8 format
Sorry, something went wrong.
No branches or pull requests
instead of saving labels as json file i need to save it in YOLO format
<class_label>
The text was updated successfully, but these errors were encountered: