图像标注任务管理

在现代的机器学习和计算机视觉项目中,图像标注是一项基础且关键的任务。通过精确的标注,可以训练出更准确的模型。本文将介绍如何使用REST API来管理图像标注任务,包括创建新的任务、检索任务数据等操作。

创建新的标注任务

要创建一个新的标注任务,需要通过POST请求向项目中的/jobs端点发送JSON编码的数据。在发送请求时,需要设置reviewer(审核者)和labeler(标注者)为工作区中用户的电子邮件地址。如果工作区没有启用高级审核模式功能,不会在应用界面中看到审核者,但作为API请求的一部分,仍需要设置一个审核者。在Web界面中,这会自动设置为在界面上创建任务的用户。可以传递任何是工作区管理员成员的用户作为审核者。

以下是一个创建新标注任务的示例请求,该任务将从项目中的一个批次分配10张图像给指定的标注者进行标注:

curl --location --request POST 'https://api.roboflow.com/${WORKSPACE}/${PROJECT}/jobs?api_key=${ROBOFLOW_API_KEY}' \ --header 'Content-Type: application/json' \ --data-raw '{ "name": "Job created by API", "batch": "", "num_images": 10, "labelerEmail": "[email protected]", "reviewerEmail": "[email protected]" }'

这个请求将返回以下数据:

{ "created": { "_seconds": 1669234345, "_nanoseconds": 61000000 }, "rejected": 0, "annotated": 0, "numImages": 2, "createdBy": "API", "owner": "holeSv3hwbzrOv37vH5b", "instructionsText": "No instructions provided", "unannotated": 2, "reviewer": "[email protected]", "labeler": "[email protected]", "name": "API Job 1", "project": "PBDhem3YRI1rKtQZSqRK", "approved": 0, "status": "assigned", "sourceBatch": "PBDhem3YRI1rKtQZSqRK/6VN0fFQIWU1E24bDjGsN", "id": "0IzntY4ms4ogwHwJNkIB" }

检索标注任务数据

要检索标注任务数据,需要向REST API发送请求以获取数据。以下是获取所有标注任务数据的请求示例:

curl https://api.roboflow.com/${WORKSPACE}/${PROJECT}/jobs?api_key=${ROBOFLOW_API_KEY}

这个请求将返回以下格式的数据:

{ "jobs": [ { "owner": "holeSv3hwbzrOv37vH5b", "approved": 0, "createdBy": "g12lCVib0pgurZ6EqWLnApJJ4gr1", "sourceBatch": "PBDhem3YRI1rKtQZSqRK/6VN0fFQIWU1E24bDjGsN", "annotated": 3, "rejected": 0, "labeler": "[email protected]", "numImages": 26, "status": "assigned", "instructionsText": "", "name": "Uploaded on 11/22/22 at 1:39 pm: Job 9", "reviewer": "[email protected]", "created": { "_seconds": 1669148088, "_nanoseconds": 297000000 }, "project": "PBDhem3YRI1rKtQZSqRK", "unannotated": 23, "id": "5LfYNJg10Z9Kvx5Tt5Uq" }, { "approved": 0, "unannotated": 2, "instructionsText": "Please label all the racoons in the images using polygons", "annotated": 12, "sourceBatch": "PBDhem3YRI1rKtQZSqRK/6VN0fFQIWU1E24bDjGsN", "project": "PBDhem3YRI1rKtQZSqRK", "rejected": 0, "owner": "holeSv3hwbzrOv37vH5b", "createdBy": "API", "status": "assigned", "created": { "_seconds": 1669148192, "_nanoseconds": 651000000 }, "labeler": "[email protected]", "name": "Test Job", "numImages": 25, "reviewer": "[email protected]", "id": "h2E42jt686yLyMIxxqOQ" } ] }

如果需要检索特定任务的信息,可以通过指定任务ID来获取:

curl https://api.roboflow.com/${WORKSPACE}/${PROJECT}/jobs/${JOB_ID}?api_key=${ROBOFLOW_API_KEY}

这个请求将返回特定任务的详细信息,包括任务的批准状态、未标注图像数量、标注说明文本、已标注图像数量、源批次、项目、拒绝数量、所有者、创建者、任务状态、创建时间、标注者、任务名称、图像数量、审核者和任务ID。

沪ICP备2024098111号-1
上海秋旦网络科技中心:上海市奉贤区金大公路8218号1幢 联系电话:17898875485