Delete Annotations
curl --request DELETE \
--url https://api.scale.com/v1/nucleus/annotation/{dataset_id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"reference_ids": [
"<string>"
],
"keep_history": true
}
'import requests
url = "https://api.scale.com/v1/nucleus/annotation/{dataset_id}"
payload = {
"reference_ids": ["<string>"],
"keep_history": True
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({reference_ids: ['<string>'], keep_history: true})
};
fetch('https://api.scale.com/v1/nucleus/annotation/{dataset_id}', 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/annotation/{dataset_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'reference_ids' => [
'<string>'
],
'keep_history' => true
]),
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/annotation/{dataset_id}"
payload := strings.NewReader("{\n \"reference_ids\": [\n \"<string>\"\n ],\n \"keep_history\": true\n}")
req, _ := http.NewRequest("DELETE", 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.delete("https://api.scale.com/v1/nucleus/annotation/{dataset_id}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"reference_ids\": [\n \"<string>\"\n ],\n \"keep_history\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scale.com/v1/nucleus/annotation/{dataset_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reference_ids\": [\n \"<string>\"\n ],\n \"keep_history\": true\n}"
response = http.request(request)
puts response.read_body{
"job_id": "job_c19xcf9mkws46gah0000",
"job_last_known_status": "Running",
"job_type": "ingestTasks",
"job_creation_time": "2021-07-20T18:07:13.055Z",
"dataset_id": "ds_bw6de8s84pe0vbn6p5zg",
"message": "Deleting ground truth annotations, this may take a few minutes."
}{}Ground Truth Annotations
Delete Annotations
Deletes all ground truth annotations on the given dataset items or scenes. This runs asynchronously and returns a job to poll.
DELETE
/
annotation
/
{dataset_id}
Delete Annotations
curl --request DELETE \
--url https://api.scale.com/v1/nucleus/annotation/{dataset_id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"reference_ids": [
"<string>"
],
"keep_history": true
}
'import requests
url = "https://api.scale.com/v1/nucleus/annotation/{dataset_id}"
payload = {
"reference_ids": ["<string>"],
"keep_history": True
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.delete(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'DELETE',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({reference_ids: ['<string>'], keep_history: true})
};
fetch('https://api.scale.com/v1/nucleus/annotation/{dataset_id}', 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/annotation/{dataset_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'reference_ids' => [
'<string>'
],
'keep_history' => true
]),
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/annotation/{dataset_id}"
payload := strings.NewReader("{\n \"reference_ids\": [\n \"<string>\"\n ],\n \"keep_history\": true\n}")
req, _ := http.NewRequest("DELETE", 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.delete("https://api.scale.com/v1/nucleus/annotation/{dataset_id}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"reference_ids\": [\n \"<string>\"\n ],\n \"keep_history\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scale.com/v1/nucleus/annotation/{dataset_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reference_ids\": [\n \"<string>\"\n ],\n \"keep_history\": true\n}"
response = http.request(request)
puts response.read_body{
"job_id": "job_c19xcf9mkws46gah0000",
"job_last_known_status": "Running",
"job_type": "ingestTasks",
"job_creation_time": "2021-07-20T18:07:13.055Z",
"dataset_id": "ds_bw6de8s84pe0vbn6p5zg",
"message": "Deleting ground truth annotations, this may take a few minutes."
}{}Click for Python SDK
Dataset.delete_annotations(
reference_ids: Optional[list] = None,
keep_history: bool = True
) -> AsyncJob
reference_idsis required and must contain at least one reference ID. Each ID can be a dataset item or a scene. If any ID isn’t in the dataset, the whole request fails with a 400.- For dataset items, this removes the item’s ground truth annotations and segmentation masks. For scenes, it removes the scene’s category annotations. Model predictions are not affected.
keep_historydefaults totrue, which keeps the annotations’ version history. Set it tofalseto delete the history as well.
202 with a job_id before deletion has finished; use the job to check its status.
job = dataset.delete_annotations(reference_ids=["item_ref_1"], keep_history=True)
job.sleep_until_complete()
update=True doesn’t remove annotations: it only overwrites annotations that match on annotation_id and reference_id, and leaves the rest in place. To keep only some of an item’s annotations, delete all of the item’s annotations with this endpoint, wait for the job to complete, then upload the annotations you want to keep. See Add Geometric Annotations.Authorizations
Body
application/json
Response
202