HumanSignal / label-studio-converter

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

Python directions in README are wrong #221

Open ericchansen opened 1 year ago

ericchansen commented 1 year ago

The "running from Python" instructions in your README are wrong or outdated.

Your README includes the following.

from label_studio_converter import Converter

c = Converter('examples/sentiment_analysis/config.xml')
c.convert_to_json('examples/sentiment_analysis/completions/', 'tmp/output.json')

This code raises TypeError: __init__() missing 1 required positional argument: 'project_dir'.

It's clear from the definition of Converter https://github.com/heartexlabs/label-studio-converter/blob/master/label_studio_converter/converter.py#L145-L160 that project_dir is required.

williamAddison commented 1 year ago

I had this same issue and I completely agree the documentation for this needs to be updated because it is not reflective at all for what is actually going on in the code.

To solve the issue that you were experiencing(at least for the JSON configuration) I did the following: `def makeJsonLS(src):

c = Converter("./label.xml", src)
c.convert_to_json(src, 'out.json')`

where src is just the source directory of my images and ./label/xml is the related xml labeling configuration file for the images