Export classification data

I have just export my data. I’m working on image classification is there any options to export my data like this?
Screenshot from 2023-11-23 15-48-14

It will be very useful in classification.


I have made this python script just in case someone else needs it.

import os
import json
import shutil

def organize_images(dataset_path, labels_file_path, output_folder):
    with open(labels_file_path, 'r') as labels_file:
        data = json.load(labels_file)

    for file_info in data['files']:
        image_path = os.path.join(dataset_path, file_info['path'])
        image_name = file_info['name']
        label = file_info['label']['label']

        output_path = os.path.join(output_folder, label)
        os.makedirs(output_path, exist_ok=True)

        shutil.copy(image_path, os.path.join(output_path, f"{image_name}.jpg"))

dataset_path = "" # Path to the dataset folder
labels_file_path = "" # Path to the labels file
output_folder = "" # Path to the output folder

organize_images(dataset_path, labels_file_path, output_folder)