def __init__(self, config: str):
        """Convert the Label Studio Format JSON file to COCO format JSON file
        which is needed by mmpose.

           The annotations in label studio must follow the order:
           keypoint 1, keypoint 2... keypoint n, rect of the instance,
           polygon of the instance,
           then annotations of the next instance.
           Where the order of rect and polygon can be switched,
           the bbox and area of the instance will be calculated with
           the data behind.

           Only annotating one of rect and polygon is also acceptable.
        Args:
            config (str): The annotations config xml file.
                The xml content is from Project Setting ->
                Label Interface -> Code.
                Example:
                ```
                <View>
                <KeyPointLabels name="kp-1" toName="img-1">
                    <Label value="person" background="#D4380D"/>
                </KeyPointLabels>
                <PolygonLabels name="polygonlabel" toName="img-1">
                    <Label value="person" background="#0DA39E"/>
                </PolygonLabels>
                <RectangleLabels name="label" toName="img-1">
                    <Label value="person" background="#DDA0EE"/>
                </RectangleLabels>
                <Image name="img-1" value="$img"/>
                </View>
                ```
        """
        # get label info from config file
        tree = ET.parse(config)
        root = tree.getroot()
        labels = root.findall('.//KeyPointLabels/Label')
        label_values = [label.get('value') for label in labels]

        self.categories = list()
        self.category_name_to_id = dict()
        for i, value in enumerate(label_values):
            # category id start with 1
            self.categories.append({'id': i + 1, 'name': value})
            self.category_name_to_id[value] = i + 1
Convert the Label Studio Format JSON file to COCO format JSON file
        which is needed by mmpose.

           The annotations in label studio must follow the order:
           keypoint 1, keypoint 2... keypoint n, rect of the instance,
           polygon of the instance,
           then annotations of the next instance.
           Where the order of rect and polygon can be switched,
           the bbox and area of the instance will be calculated with
           the data behind.

           Only annotating one of rect and polygon is also acceptable.
        Args:
            config (str): The annotations config xml file.
                The xml content is from Project Setting ->
                Label Interface -> Code.
                Example:
                ```
                <View>
                <KeyPointLabels name="kp-1" toName="img-1">
                    <Label value="person" background="#D4380D"/>
                </KeyPointLabels>
                <PolygonLabels name="polygonlabel" toName="img-1">
                    <Label value="person" background="#0DA39E"/>
                </PolygonLabels>
                <RectangleLabels name="label" toName="img-1">
                    <Label value="person" background="#DDA0EE"/>
                </RectangleLabels>
                <Image name="img-1" value="$img"/>
                </View>
                ```
        
mmpose/tools/dataset_converters/labelstudio2coco.py