HumanSignal / label-studio

Label Studio is a multi-type data labeling and annotation tool with standardized output format
https://labelstud.io
Apache License 2.0
19.47k stars 2.42k forks source link

[Rating] defaultValue not working #6557

Open mspronesti opened 1 month ago

mspronesti commented 1 month ago

According to the docs, defaultValue should preset Rating's value. It does not seem to work though.

playground example.

heidi-humansignal commented 3 weeks ago

Hello,

Thank you for bringing this issue to our attention. After reviewing your report, we've confirmed that this is indeed a bug. We have submitted the issue to our engineering team for further investigation. Please note that our team prioritizes bugs based on impact and how they align with our current roadmap, so we can't provide an exact timeline for a fix at this time. However, we’ll keep you updated as we make progress and will notify you once work begins and when the fix is delivered. Thank you for your patience.

Here is workaround as well:

To set a default rating value, you can use pre-annotations in your task data. Pre-annotations allow you to provide initial annotation results that will be loaded when the task is opened.

Here's how you can modify your task data to include a pre-annotation for the rating:

Modify Your Task Data:

Add an annotations field to your task JSON that includes the initial rating value.

{
  "data": {
    "image": "path_or_url_to_your_image"
  },
  "annotations": [
    {
      "result": [
        {
          "from_name": "rating",
          "to_name": "image",
          "type": "rating",
          "value": {
            "rating": 4
          }
        }
      ]
    }
  ]
}

Replace "path_or_url_to_your_image" with the actual path or URL to your image.

Adjust Your Labeling Configuration:

You can keep your labeling configuration as is, using the correct attribute names:

<View>
  <Image name="image" value="$image"/>
  <Rating name="rating" toName="image" defaultvalue="4" icon="fire" size="large" />
</View>

Note that while defaultvalue="4" is correctly specified, due to the current implementation, it won't set the initial rating. The pre-annotation in the task data is necessary.

Thank you, Abu

Comment by Abubakar Saad Workflow Run