Question:
I have a CSV file of image URLs and their classification labels. I am trying to figure out how to construct the CSV so that the images are automatically labelled when imported.
Apologies for the basic question but I couldn’t find this in the docs. Is this possible?
For Label Studio to use the CSV data for pre-annotations, you need to format your CSV to match your labeling configuration.
Answer:
For Label Studio to use the CSV data for pre-annotations, you need to format your CSV to match your labeling configuration.
CSV Format:
- Image URL Column: A column for the image URLs.
- Label Column: A column for the classification labels. These should be in a format that corresponds to your label configurations.
Your CSV should look similar to this:
image_url,category
http://example.com/image1.jpg,Cat
http://example.com/image2.jpg,Dog
Importing into Label Studio:
When importing this CSV:
- Use the Label Studio UI to select your CSV file and align the column names with the respective fields in your project’s labeling configuration.
- If using Label Studio SDK, you might use a command resembling this:
project.import_tasks('path/to/your/csvfile.csv', preannotated_from_fields=['category'])
Please ensure that the category
field in your CSV aligns with the from_name
attribute specified in your labeling configuration within Label Studio.
The above is just an example, you’d have to modify the CSV headers accordingly for your specific data.