Export Slice (Legacy)
curl --request GET \
--url https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining', 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/slice/{slice_id}/exportForTraining",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body[
{
"item": {
"original_image_url": "https://your-bucket/example.png",
"dataset_item_id": "di_zwyt15cag2301b902cw0",
"reference_id": "image_ref_300000",
"metadata": {
"License Plate": "ZPH-J27",
"Recording Date": "2019-09-15",
"Recording Time": "14:24:21",
"weather": "sunny",
"camera": "back"
}
},
"annotations": {
"box": [
{
"label": "car",
"type": "box",
"geometry": {
"x": 648.1969604492188,
"y": 264.34417724609375,
"width": 70.560546875,
"height": 50.55670166015625
}
},
{
"label": "car",
"type": "box",
"geometry": {
"x": 720.8001098632812,
"y": 246.6089324951172,
"width": 139.6986083984375,
"height": 114.38755798339844
}
}
]
}
}
]{}Export Slice
Export Slice (Legacy)
GET
/
slice
/
{slice_id}
/
exportForTraining
Export Slice (Legacy)
curl --request GET \
--url https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining', 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/slice/{slice_id}/exportForTraining",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scale.com/v1/nucleus/slice/{slice_id}/exportForTraining")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body[
{
"item": {
"original_image_url": "https://your-bucket/example.png",
"dataset_item_id": "di_zwyt15cag2301b902cw0",
"reference_id": "image_ref_300000",
"metadata": {
"License Plate": "ZPH-J27",
"Recording Date": "2019-09-15",
"Recording Time": "14:24:21",
"weather": "sunny",
"camera": "back"
}
},
"annotations": {
"box": [
{
"label": "car",
"type": "box",
"geometry": {
"x": 648.1969604492188,
"y": 264.34417724609375,
"width": 70.560546875,
"height": 50.55670166015625
}
},
{
"label": "car",
"type": "box",
"geometry": {
"x": 720.8001098632812,
"y": 246.6089324951172,
"width": 139.6986083984375,
"height": 114.38755798339844
}
}
]
}
}
]{}Click for Python SDK
Slice.items_and_annotations() -> List[
Dict[str, Union[
DatasetItem,
Dict[str, List[Annotation]]]
]
]
- Annotation IDs
- Annotation-level metadata
- Reference IDs for annotations (since they are pulled down for the DatasetItem already)