Multi-task Classification involves training a model to perform multiple classification tasks simultaneously. For example, a model could be trained to classify both the type of person and vehicle attributes in a single image.
Step 0: Preparation
Prepare a attributes file like attributes.json. An example is shown below:
{
"vehicle": {
"bodyColor": [
"red",
"white",
"blue"
],
"vehicleType": [
"SUV",
"sedan",
"bus",
"truck"
]
},
"person": {
"wearsGlasses": ["yes", "no"],
"wearsMask": ["yes", "no"],
"clothingColor": [
"red",
"green",
"blue"
]
},
"__widget_types__": {
"vehicle": {
"bodyColor": "radiobutton",
"vehicleType": "combobox"
},
"person": {
"wearsGlasses": "radiobutton",
"wearsMask": "radiobutton",
"clothingColor": "combobox"
}
}
}
Note
Widget Types Configuration (X-AnyLabeling v3.2.4+)
You can specify the widget type for each attribute using the __widget_types__ section:
"radiobutton": Single-click selection, ideal for yes/no or few options"group_id": Dropdown selection containing thegroup_ids of all objects, if any"lineedit": Free-form text input"combobox": Dropdown selection, suitable for many options (default)
If __widget_types__ is not specified, all attributes default to combobox.
Example of group_id and lineedit attributes:
{
"vehicle": {
"occluded_by": [],
"occluded_by_string": ""
},
"__widget_types__": {
"vehicle": {
"occluded_by": "group_id",
"occluded_by_string": "lineedit"
}
}
}Step 1: Run the Application
python anylabeling/app.pyStep 2: Upload the Configuration File
Click on Upload -> Upload Attributes File in the top menu bar and select the prepared configuration file to upload.
Tip
Starting from X-AnyLabeling v3.2.4+, you can use Loop Select Shapes (Ctrl+Shift+C) to sequentially select each shape on the canvas for efficient attribute annotation. This enables you to quickly cycle through all shapes and assign attributes without having to manually click each one.
Note
Attributes Label Color Customization (X-AnyLabeling v3.3.0+)
You can customize the colors of attribute labels displayed on the canvas by configuring the .xanylabelingrc file in your user directory. Add or modify the following settings under the canvas section:
canvas:
attributes:
background_color: [33, 33, 33, 255] # Background color (RGBA)
border_color: [66, 66, 66, 255] # Border color (RGBA)
text_color: [33, 150, 243, 255] # Text color (RGBA)Color values use RGBA format: [R, G, B, A], where each value ranges from 0-255.
For detailed output examples, refer to this file.
Similar to Image-Level Classification, you can also conduct multiclass and multilabel classification for Shape-Level Annotation.
Step 0: Preparation
Prepare a flags file like label_flags.yaml. An example is shown below:
person:
- male
- female
helmet:
- white
- red
- blue
- yellow
- greenStep 1: Run the Application
python anylabeling/app.pyStep 2: Upload the Configuration File
Click on Upload -> Upload Label Flags File in the top menu bar and select the prepared configuration file to upload.
Option 1: Quick Start
python anylabeling/app.py --labels person,helmet --labelflags "{'person': ['male', 'female'], 'helmet': ['white', 'red', 'blue', 'yellow', 'green']}" --validatelabel exactTip
The labelflags key field supports regular expressions. For instance, you can use patterns like {person-\d+: [male, tall], "dog-\d+": [black, brown, white], .*: [occluded]}.
Option 2: Using a Configuration File
python anylabeling/app.py --labels labels.txt --labelflags label_flags.yaml --validatelabel exactFor detailed output examples, refer to this file.



