Skip to the page
Docs menu

Docs API reference

Models

On-device model downloads (the log detector, the lumber board-end counter).

Current detector model#

GET/v1/models/detector

Returns the current on-device detector for a platform with a signed download URL. download_url serves exactly one file per platform, and size_bytes and sha256 describe exactly those bytes: for ios (format: coreml_mlpackage_zip) a ZIP archive of the .mlpackage directory, which the client unzips and compiles with Core ML; for android (format: tflite) the .tflite flatbuffer, used as downloaded. Check the SHA-256 after download and record id@version with measurements. The current release is timbereye-log-detector 1.0.0 (input 960 x 960; variant=640 asks for the 640 x 640 fallback, timbereye-log-detector-640). The answer also states the pre-processing the model expects (letterbox: scale to fit, centre on a grey 114 square), its thresholds and, on Android, the output layout the decoder reads. 503 model_unavailable means this environment has no detector to offer yet (the file is not in its storage): run without on-device detection and ask again later.

Keys: secret key; restricted key with models:read; capture token (Allowed); publishable key (Allowed).

Parameters

FieldDescription
platform requiredios \| android, queryWhich build of the model to describe and serve: ios (Core ML) or android (TensorFlow Lite).
variant960 \| 640, queryInput size of the model: 960 (the default) or 640, a smaller fallback for older devices with about 0.45 x the compute.

Request

A phone does not call this itself: the Swift and Kotlin SDKs make this call for the scanner, with the app's key. See Scan in your app. The samples are for your server.

TypeScript
const result = await timbereye.models.retrieveDetector({ platform: "ios" })
curl
curl "https://api.timbereye.com/v1/models/detector?platform=ios" \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye models detector --platform ios --json

Response

JSON
// 200
{
  "object": "model",
  "id": "timbereye-log-detector",
  "version": "1.0.0",
  "platform": "ios",
  "format": "coreml_mlpackage_zip",
  "variant": "960",
  "size_bytes": 16500006,
  "sha256": "5528fda77ac4a14e5a6451f3f0018c0539a92ab6c905ad9b895ba49ee1b2c062",
  "licence": "Apache-2.0",
  "input_size": { "width": 960, "height": 960 },
  "preprocessing": {
    "resize": "letterbox",
    "pad_value": 114,
    "color": "rgb",
    "pixel_range": "0_255"
  },
  "thresholds": {
    "nms_confidence": 0.25,
    "nms_iou": 0.45,
    "recommended_confidence": 0.5
  },
  "download_url": "https://storage.googleapis.com/timbereye-models/models/detector/1.0.0/timbereye-log-detector-1.0.0.mlpackage.zip?X-Goog-Expires=900&X-Goog-Signature=c3b2e1",
  "download_url_expires_at": "2027-02-03T15:05:00Z"
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.
503api_error: isolation_unavailable (the resource's account isolation is not in place), service_unavailable (for example image storage not available in this environment) or model_unavailable (no on-device detector to offer in this environment). Retry later.

Current board-end counter model#

GET/v1/models/board-end-counter

Returns the current on-device lumber board-end counter for a platform with a signed download URL, in the same shape as the detector (GET /models/detector) plus the counting recipe: tiling (resize the photo to a photo_long_side long side, cut a grid of tiles with overlap, letterbox each to tile_input, keep a box in the tile whose core holds its centre) and count (a dot per box centre at or above thresholds.recommended_confidence; check thin, dense boards closely when the median short side is below check_if_median_short_side_px_below). The current release is timbereye-board-end-counter 0.9.0: its count is a proposal the operator corrects and confirms, never a measurement on its own (variant=s asks for the smaller timbereye-board-end-counter-s). 503 model_unavailable means this environment has no counter to offer: count by hand and ask again later.

Keys: secret key; restricted key with models:read; capture token (Allowed); publishable key (Allowed).

Parameters

FieldDescription
platform requiredios \| android, queryWhich build of the model to describe and serve: ios (Core ML) or android (TensorFlow Lite).
variantm \| s, querym (the default, timbereye-board-end-counter) or s, a smaller fallback for slower phones (timbereye-board-end-counter-s).

Request

A phone does not call this itself: the Swift and Kotlin SDKs make this call for the scanner, with the app's key. See Scan in your app. The samples are for your server.

TypeScript
const result = await timbereye.models.retrieveBoardEndCounter({ platform: "ios" })
curl
curl "https://api.timbereye.com/v1/models/board-end-counter?platform=ios" \
  -H "Authorization: Bearer $TIMBEREYE_SECRET_KEY"
CLI
timbereye models board-end-counter --platform ios --json

Response

JSON
// 200
{
  "object": "model",
  "id": "timbereye-board-end-counter",
  "version": "0.9.0",
  "platform": "ios",
  "format": "coreml_mlpackage_zip",
  "variant": "m",
  "size_bytes": 46008906,
  "sha256": "f13cb88c9c719cc0a789cb919216ebd15e005f5a4ab796d4d870a95b7b95cba4",
  "licence": "Apache-2.0",
  "input_size": { "width": 960, "height": 960 },
  "preprocessing": {
    "resize": "letterbox",
    "pad_value": 114,
    "color": "rgb",
    "pixel_range": "0_255"
  },
  "thresholds": {
    "nms_confidence": 0.25,
    "nms_iou": 0.45,
    "recommended_confidence": 0.68
  },
  "tiling": {
    "photo_long_side": 2048,
    "grid": [2, 2],
    "overlap": 0.15,
    "tile_input": 960,
    "merge": "core",
    "max_per_tile": 2000
  },
  "count": {
    "dots": "box_centres",
    "check_if_median_short_side_px_below": 30
  },
  "download_url": "https://storage.googleapis.com/timbereye-models/models/board-end-counter/0.9.0/timbereye-board-end-counter-0.9.0.mlpackage.zip?X-Goog-Expires=900&X-Goog-Signature=c3b2e1",
  "download_url_expires_at": "2027-02-03T15:05:00Z"
}
Errors
StatusWhen
400invalid_request_error: the request was malformed or a field was invalid.
401authentication_error: missing, malformed, expired or revoked key.
403permission_error: the key lacks the scope, the capture token is limited to other groups, or the resource is read-only to you.
404invalid_request_error, resource_missing: no such object. Objects in another account are also reported as 404.
429rate_limit_error: slow down and retry after the Retry-After delay.
500api_error: something went wrong on our side. Safe to retry with the same Idempotency-Key.
503api_error: isolation_unavailable (the resource's account isolation is not in place), service_unavailable (for example image storage not available in this environment) or model_unavailable (no on-device detector to offer in this environment). Retry later.