Add Annotations
curl --request POST \
--url https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"annotations": [
{
"reference_id": "<string>",
"label": "<string>",
"type": "<string>",
"geometry": {},
"annotation_id": "<string>",
"metadata": {},
"taxonomy_name": "<string>"
}
],
"update": false
}
'import requests
url = "https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate"
payload = {
"annotations": [
{
"reference_id": "<string>",
"label": "<string>",
"type": "<string>",
"geometry": {},
"annotation_id": "<string>",
"metadata": {},
"taxonomy_name": "<string>"
}
],
"update": False
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
annotations: [
{
reference_id: '<string>',
label: '<string>',
type: '<string>',
geometry: {},
annotation_id: '<string>',
metadata: {},
taxonomy_name: '<string>'
}
],
update: false
})
};
fetch('https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'annotations' => [
[
'reference_id' => '<string>',
'label' => '<string>',
'type' => '<string>',
'geometry' => [
],
'annotation_id' => '<string>',
'metadata' => [
],
'taxonomy_name' => '<string>'
]
],
'update' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate"
payload := strings.NewReader("{\n \"annotations\": [\n {\n \"reference_id\": \"<string>\",\n \"label\": \"<string>\",\n \"type\": \"<string>\",\n \"geometry\": {},\n \"annotation_id\": \"<string>\",\n \"metadata\": {},\n \"taxonomy_name\": \"<string>\"\n }\n ],\n \"update\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"annotations\": [\n {\n \"reference_id\": \"<string>\",\n \"label\": \"<string>\",\n \"type\": \"<string>\",\n \"geometry\": {},\n \"annotation_id\": \"<string>\",\n \"metadata\": {},\n \"taxonomy_name\": \"<string>\"\n }\n ],\n \"update\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"annotations\": [\n {\n \"reference_id\": \"<string>\",\n \"label\": \"<string>\",\n \"type\": \"<string>\",\n \"geometry\": {},\n \"annotation_id\": \"<string>\",\n \"metadata\": {},\n \"taxonomy_name\": \"<string>\"\n }\n ],\n \"update\": false\n}"
response = http.request(request)
puts response.read_body{
"dataset_id": "ds_bw6de8s84pe0vbn6p5zg",
"annotations_processed": 3
}{}Ground Truth Annotations
Add Annotations
POST
/
dataset
/
{dataset_id}
/
annotate
Add Annotations
curl --request POST \
--url https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"annotations": [
{
"reference_id": "<string>",
"label": "<string>",
"type": "<string>",
"geometry": {},
"annotation_id": "<string>",
"metadata": {},
"taxonomy_name": "<string>"
}
],
"update": false
}
'import requests
url = "https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate"
payload = {
"annotations": [
{
"reference_id": "<string>",
"label": "<string>",
"type": "<string>",
"geometry": {},
"annotation_id": "<string>",
"metadata": {},
"taxonomy_name": "<string>"
}
],
"update": False
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
annotations: [
{
reference_id: '<string>',
label: '<string>',
type: '<string>',
geometry: {},
annotation_id: '<string>',
metadata: {},
taxonomy_name: '<string>'
}
],
update: false
})
};
fetch('https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'annotations' => [
[
'reference_id' => '<string>',
'label' => '<string>',
'type' => '<string>',
'geometry' => [
],
'annotation_id' => '<string>',
'metadata' => [
],
'taxonomy_name' => '<string>'
]
],
'update' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate"
payload := strings.NewReader("{\n \"annotations\": [\n {\n \"reference_id\": \"<string>\",\n \"label\": \"<string>\",\n \"type\": \"<string>\",\n \"geometry\": {},\n \"annotation_id\": \"<string>\",\n \"metadata\": {},\n \"taxonomy_name\": \"<string>\"\n }\n ],\n \"update\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"annotations\": [\n {\n \"reference_id\": \"<string>\",\n \"label\": \"<string>\",\n \"type\": \"<string>\",\n \"geometry\": {},\n \"annotation_id\": \"<string>\",\n \"metadata\": {},\n \"taxonomy_name\": \"<string>\"\n }\n ],\n \"update\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scale.com/v1/nucleus/dataset/{dataset_id}/annotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"annotations\": [\n {\n \"reference_id\": \"<string>\",\n \"label\": \"<string>\",\n \"type\": \"<string>\",\n \"geometry\": {},\n \"annotation_id\": \"<string>\",\n \"metadata\": {},\n \"taxonomy_name\": \"<string>\"\n }\n ],\n \"update\": false\n}"
response = http.request(request)
puts response.read_body{
"dataset_id": "ds_bw6de8s84pe0vbn6p5zg",
"annotations_processed": 3
}{}Click for Python SDK
Dataset.annotate(
annotations: Sequence[Annotation],
update: bool = False,
batch_size: int = 5000,
asynchronous: bool = False,
remote_files_per_upload_request: int = 20,
local_files_per_upload_request: int = 10
) -> Union[dict, AsyncJob]
Dataset.
Definition: BoxGeometry
| Key | Type | Description |
|---|---|---|
x | float (required) | The distance, in pixels, between the left border of the bounding box and the left border of the image. |
y | float (required) | The distance, in pixels, between the top border of the bounding box and the top border of the image. |
width | float (required) | The width in pixels of the annotation. |
height | float (required) | The height in pixels of the annotation. |
Definition: Point2D
| Key | Type | Description |
|---|---|---|
x | float (required) | The distance, in pixels, between the point and the left border of the image. |
y | float (required) | The distance, in pixels, between the point and the top border of the image. |
Definition: PolygonGeometry
| Key | Type | Description |
|---|---|---|
vertices | array of Point2D | Array of Point2D objects that represent vertices of the polygon. |
Definition: Point3D
| Key | Type | Description |
|---|---|---|
x | float (required) | The x coordinate of the point. |
y | float (required) | The y coordinate of the point. |
z | float (required) | The z coordinate of the point. |
Definition: CuboidGeometry
Authorizations
Body
application/json