You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Label Studio边界框导入异常,缩放后尺寸不符求助

问题原因

Label Studio的矩形标注规则里,value字段下的x、y、width、height必须是相对于原图尺寸的百分比,而非绝对像素值。你现在填的是原图的绝对像素(比如x=712),Label Studio会把这些数值当成百分比解析,直接导致框体被放大到离谱的程度。

举个例子:原图宽6000,你写x=712,系统会算成712%的宽度,也就是6000×7.12,这肯定远超出原图范围,所以显示异常。

解决方法

把value里的四个数值全部转成百分比,公式很简单:

  • 百分比x = (绝对像素x ÷ 原图宽度) × 100
  • 百分比y = (绝对像素y ÷ 原图高度) × 100
  • 百分比width = (绝对像素width ÷ 原图宽度) × 100
  • 百分比height = (绝对像素height ÷ 原图高度) × 100

保留1-2位小数即可,不用过度精确。

修改后的JSON代码
[{
  "data": {
    "image": "/data/upload/1/2e158a26-DSC05326.JPG" 
  },
  "predictions": [{
    "model_version": "one",
    "score": 0.5,
    "result": [
      {
        "id": "result1",
        "type": "rectanglelabels",        
        "from_name": "label", "to_name": "image",
        "original_width": 6000, "original_height": 4000,
        "image_rotation": 0,
        "value": {
          "rotation": 0,          
          "x": 11.87, "y": 38.83,
          "width": 2.57, "height": 3.58,
          "rectanglelabels": ["Olive"]
        }
      },
      {
        "id": "result2",
        "type": "rectanglelabels",        
        "from_name": "label", "to_name": "image",
        "original_width": 6000, "original_height": 4000,
        "image_rotation": 0,
        "value": {
          "rotation": 0,          
          "x": 5.92, "y": 29.03,
          "width": 3.03, "height": 4.23,
          "rectanglelabels": ["Branch"]
        }
      }
    ]
  }]
}]

计算示例(以Olive标签为例)

  • x: 712 ÷ 6000 × 100 ≈ 11.87
  • y: 1553 ÷ 4000 × 100 ≈ 38.83
  • width: 154 ÷ 6000 × 100 ≈ 2.57
  • height: 143 ÷ 4000 × 100 ≈ 3.58
注意事项

不用手动按Label Studio缩放后的尺寸(866×574)调整数值,系统会自动根据original_width、original_height和百分比值,计算出缩放后图像上的正确框体位置和大小。

内容的提问来源于stack exchange,提问作者Nikita Belooussov

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 22:30:53