访问人群 HTML 输出结果

Access Crowd HTML output results

我正在使用 Crowd HTML Elements 创建一个网站,让 users/workers 使用边界框格式注释图像。表格如下所示:

<crowd-form>
  <crowd-bounding-box
    name="annotatedResult"
    labels="['Referee', 'Player']"
    src="https://s3.amazonaws.com/cv-demo-images/basketball-outdoor.jpg"
    header="Draw boxes around each basketball player and referee in this image"
  >
    <full-instructions header="Bounding Box Instructions" >
      <p>Use the bounding box tool to draw boxes around the requested target of interest:</p>
      <ol>
        <li>Draw a rectangle using your mouse over each instance of the target.</li>
        <li>Make sure the box does not cut into the target, leave a 2 - 3 pixel margin</li>
        <li>
          When targets are overlapping, draw a box around each object,
          include all contiguous parts of the target in the box.
          Do not include parts that are completely overlapped by another object.
        </li>
        <li>
          Do not include parts of the target that cannot be seen,
          even though you think you can interpolate the whole shape of the target.
        </li>
        <li>Avoid shadows, they're not considered as a part of the target.</li>
        <li>If the target goes off the screen, label up to the edge of the image.</li>
      </ol>
    </full-instructions>

    <short-instructions>
      Draw boxes around each basketball player and referee in this image.
    </short-instructions>
  </crowd-bounding-box>
</crowd-form>

工人提交的结果如下所示:

  {
    "annotatedResult": {
      "boundingBoxes": [
        {
          "height": 3300,
          "label": "Dog",
          "left": 536,
          "top": 154,
          "width": 4361
        }
      ],
      "inputImageProperties": {
        "height": 3456,
        "width": 5184
      }
    }
  }
]

我想获取此输出并将其写入数据库,将其传递给 AWS Lambda,将其存储为元数据等,但我不知道如何访问结果。 JSON输出一个属性的HTMLDOM属性我能抢到吗?

我可以将 javascript 函数附加到人群形式部分的提交操作...

<script>
  document.querySelector('crowd-form').onsubmit = function() {
      ???
  };
</script>

...但我不确定我需要抓取什么对象才能获得结果。感谢您的帮助!

您可以像这样在 onsubmit 事件期间访问边界框:

<script>
    document.querySelector('crowd-form').onsubmit = function(e) {
      const boundingBoxes = document.querySelector('crowd-bounding-box').value.boundingBoxes || document.querySelector('crowd-bounding-box')._submittableValue.boundingBoxes;
    }
</script>

Here's 一个有效的 jsfiddle。

您的用例听起来很有趣。如果您不介意分享,请发送电子邮件至 samhenry@amazon.com 我可能会提供进一步帮助。

谢谢,

亚马逊土耳其机器人