Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/content/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -607,13 +607,13 @@ argument for branching on `code`.
| Status | Codes |
| --- | --- |
| **401** | `UNAUTHORIZED` — with a `WWW-Authenticate: Bearer` challenge |
| **404** | `PROJECT_NOT_FOUND` · `SCHEMA_NOT_FOUND` · `SCHEMA_DRAFT_NOT_FOUND` · `BATCH_NOT_FOUND` · `JOB_NOT_FOUND` · `INGEST_JOB_NOT_FOUND` · `BACKGROUND_JOB_NOT_FOUND` · `ASSET_NOT_FOUND` · `SOURCE_NOT_FOUND` · `DATASET_NOT_FOUND` · `ANNOTATION_NOT_FOUND` · `RELEASE_NOT_FOUND` · `TOKEN_NOT_FOUND` · `INFERENCE_CONNECTION_NOT_FOUND` · `ASSET_NOT_IN_JOB` · `ASSET_NOT_IN_DATASET` · `NO_SPLIT_RECIPE` · `EXPORT_FORMAT_NOT_FOUND` · `THUMBNAIL_NOT_CACHED` · `NOT_FOUND` (no such route) |
| **404** | `PROJECT_NOT_FOUND` · `SCHEMA_NOT_FOUND` · `SCHEMA_DRAFT_NOT_FOUND` · `BATCH_NOT_FOUND` · `JOB_NOT_FOUND` · `INGEST_JOB_NOT_FOUND` · `BACKGROUND_JOB_NOT_FOUND` · `ASSET_NOT_FOUND` · `SOURCE_NOT_FOUND` · `DATASET_NOT_FOUND` · `ANNOTATION_NOT_FOUND` · `RELEASE_NOT_FOUND` · `TOKEN_NOT_FOUND` · `INFERENCE_CONNECTION_NOT_FOUND` · `ASSET_NOT_IN_JOB` · `ASSET_NOT_IN_DATASET` · `NO_SPLIT_RECIPE` · `EXPORT_FORMAT_NOT_FOUND` · `EXPORT_TARGET_NOT_FOUND` · `THUMBNAIL_NOT_CACHED` · `NOT_FOUND` (no such route) |
| **405** | `METHOD_NOT_ALLOWED` |
| **409** | `PROJECT_NAME_TAKEN` · `RELEASE_TAG_TAKEN` · `TOKEN_NAME_TAKEN` · `INFERENCE_CONNECTION_NAME_TAKEN` · `WORKSPACE_ALREADY_EXISTS` · `WORKSPACE_NOT_EMPTY` · `SCHEMA_VERSION_CONFLICT` · `INVALID_TRANSITION` · `STALE_WRITE` · `BATCH_NOT_EDITABLE` · `BATCH_IMMUTABLE` · `BATCH_NOT_IN_ANNOTATION` · `ASSET_NOT_WRITABLE` · `JOB_FINISHED` · `BATCH_NOT_COMPLETE` · `JOB_NOT_COMPLETE` · `EMPTY_BATCH` · `EMPTY_RELEASE` · `RELEASE_CONTENT_WOULD_VIOLATE_SCHEMA` · `CONFIRMATION_REQUIRED` · `DESTRUCTIVE_SCHEMA_CHANGE` · `SCHEMA_CHANGE_WOULD_ORPHAN` · `SCHEMA_HAS_NO_DETECTABLE_CLASS` · `UNSERIALIZABLE_MANIFEST` · `LOSSY_EXPORT_NOT_CONSENTED` · `EXPORT_SOURCE_UNREADABLE` · `INFERENCE_CONNECTION_NOT_DOWNLOADABLE` · `INFERENCE_CONNECTION_NOT_CHECKABLE` · `INFERENCE_CONNECTION_NOT_TESTABLE` · `INFERENCE_CONNECTION_MODEL_FIXED` · `WEIGHTS_DAMAGED` · `INFERENCE_CONNECTION_NOT_SET_UP` |
| **409** | `PROJECT_NAME_TAKEN` · `RELEASE_TAG_TAKEN` · `TOKEN_NAME_TAKEN` · `INFERENCE_CONNECTION_NAME_TAKEN` · `WORKSPACE_ALREADY_EXISTS` · `WORKSPACE_NOT_EMPTY` · `SCHEMA_VERSION_CONFLICT` · `INVALID_TRANSITION` · `STALE_WRITE` · `BATCH_NOT_EDITABLE` · `BATCH_IMMUTABLE` · `BATCH_NOT_IN_ANNOTATION` · `ASSET_NOT_WRITABLE` · `JOB_FINISHED` · `BATCH_NOT_COMPLETE` · `JOB_NOT_COMPLETE` · `EMPTY_BATCH` · `EMPTY_RELEASE` · `RELEASE_CONTENT_WOULD_VIOLATE_SCHEMA` · `CONFIRMATION_REQUIRED` · `DESTRUCTIVE_SCHEMA_CHANGE` · `SCHEMA_CHANGE_WOULD_ORPHAN` · `SCHEMA_HAS_NO_DETECTABLE_CLASS` · `UNSERIALIZABLE_MANIFEST` · `LOSSY_EXPORT_NOT_CONSENTED` · `EXPORT_SOURCE_UNREADABLE` · `INFERENCE_CONNECTION_NOT_DOWNLOADABLE` · `INFERENCE_CONNECTION_NOT_CHECKABLE` · `INFERENCE_CONNECTION_NOT_TESTABLE` · `INFERENCE_CONNECTION_MODEL_FIXED` · `WEIGHTS_DAMAGED` · `INFERENCE_CONNECTION_NOT_SET_UP` · `AUGMENTATION_REQUIRES_SPLIT` · `PREPROCESSING_STEP_UNSUPPORTED_GEOMETRY` |
| **422** | `VALIDATION_ERROR` · `ASSET_NOT_IN_BATCH` · `ANNOTATION_NOT_FROM_MODEL` · `INVALID_NAME` · `INFERENCE_CONNECTION_INVALID` · `INVALID_SCHEMA` · `UNSUPPORTED_GEOMETRY` · `INVALID_ANNOTATION` · `LABEL_CLASS_NOT_IN_SCHEMA` · `DISALLOWED_GEOMETRY` · `ANNOTATION_GEOMETRY_OUT_OF_BOUNDS` · `DUPLICATE_CLASSIFICATION_TAG` · `MISSING_REQUIRED_ATTRIBUTE` · `UNKNOWN_ATTRIBUTE` · `INVALID_ATTRIBUTE_VALUE` · `INVALID_PARTITION` · `UNKNOWN_JOB_TYPE` · `MEDIA_ERROR` · `UNSUPPORTED_MEDIA` · `CORRUPT_MEDIA` · `UNSUPPORTED_PROMPT` · `PROMPT_POINT_OUT_OF_BOUNDS` · `GEOMETRY_NOT_PRODUCED` |
| **502** | `INFERENCE_ENDPOINT_UNAVAILABLE` |
| **503** | `WORKSPACE_BUSY` |
| **500** | `WORKSPACE_CORRUPT` · `NOT_A_WORKSPACE` · `WORKSPACE_FORMAT_TOO_NEW` · `WORKSPACE_SCHEMA_MISMATCH` · `ENTITY_NOT_FOUND` · `ENTITY_ALREADY_EXISTS` · `CONSTRAINT_VIOLATED` · `MEDIA_TOOL_UNAVAILABLE` · `LOCAL_INFERENCE_UNAVAILABLE` · `INFERENCE_CONNECTION_NOT_RUNNABLE` · `INFERENCE_OUT_OF_MEMORY` · `INTERNAL_ERROR` |
| **500** | `WORKSPACE_CORRUPT` · `NOT_A_WORKSPACE` · `WORKSPACE_FORMAT_TOO_NEW` · `WORKSPACE_SCHEMA_MISMATCH` · `ENTITY_NOT_FOUND` · `ENTITY_ALREADY_EXISTS` · `CONSTRAINT_VIOLATED` · `MEDIA_TOOL_UNAVAILABLE` · `LOCAL_INFERENCE_UNAVAILABLE` · `INFERENCE_CONNECTION_NOT_RUNNABLE` · `INFERENCE_OUT_OF_MEMORY` · `EXPORT_TARGET_CONFLICT` · `INVALID_EXPORT_TARGET` · `INTERNAL_ERROR` |

Every row but `VALIDATION_ERROR`, `NOT_FOUND`, `METHOD_NOT_ALLOWED`, `UNAUTHORIZED` and
`INTERNAL_ERROR` — the five the framework and the auth guard raise — comes from `ERROR_RULES`
Expand Down
3 changes: 3 additions & 0 deletions src/visionset/formats/_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from pathlib import Path

from visionset.formats._targets import self_target
from visionset.kernel.domain import GeometryType, Manifest, Release
from visionset.kernel.ports import ContentReader

Expand Down Expand Up @@ -40,6 +41,8 @@ class DummyExporter:
#: that named it would have to grow when the domain does.
supported_modalities = frozenset({"image", "video", "point_cloud"})

targets = self_target(format_name, supported_geometries)

def export(
self,
release: Release,
Expand Down
43 changes: 43 additions & 0 deletions src/visionset/formats/_targets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# usage: from visionset.formats._targets import self_target
"""The one-target declaration every non-YOLO exporter shares.

An exporter that is not a trainer's format still declares exactly one target,
named after itself, family ``other``, with no trainer tasks — so a surface
renders one control for every export rather than a target select beside a
format select. Spelled once here for the same reason ``_layout`` exists:
the day two spellings of the rule disagree, the catalog and the format list
stop describing the same thing.

Private to :mod:`visionset.formats`, like ``_layout``: importable, but not part
of the ``Exporter`` contract.
"""

from __future__ import annotations

from visionset.kernel.domain import (
ExportTarget,
GeometryType,
PreprocessingHints,
TargetFamily,
)


def self_target(format_name: str, geometries: frozenset[GeometryType]) -> frozenset[ExportTarget]:
"""The whole ``targets`` declaration for a format that is its own target."""
return frozenset(
{
ExportTarget(
name=format_name,
label=format_name,
family=TargetFamily.OTHER,
tasks=frozenset(),
supported_geometries=geometries,
hints=PreprocessingHints(
recommended_size=None,
recommended_strategy=None,
trainer_resizes=True,
augmentation_common=False,
),
)
}
)
3 changes: 3 additions & 0 deletions src/visionset/formats/classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class index on the *from-the-schema-not-the-data* half of its rule — deriving
from typing import Final

from visionset.formats._layout import IMAGES_DIRNAME, folds_of, write_image
from visionset.formats._targets import self_target
from visionset.kernel.domain import (
ClassificationGeometry,
GeometryType,
Expand Down Expand Up @@ -107,6 +108,8 @@ class ClassificationExporter:
#: A classification dataset is a directory of pictures.
supported_modalities = frozenset({"image"})

targets = self_target(format_name, supported_geometries)

def export(
self,
release: Release,
Expand Down
3 changes: 3 additions & 0 deletions src/visionset/formats/coco/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
folds_of,
write_image,
)
from visionset.formats._targets import self_target
from visionset.kernel.domain import (
BboxGeometry,
GeometryType,
Expand Down Expand Up @@ -115,6 +116,8 @@ class CocoExporter:

supported_modalities = frozenset({"image"})

targets = self_target(format_name, supported_geometries)

def export(
self,
release: Release,
Expand Down
14 changes: 14 additions & 0 deletions src/visionset/formats/lanes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
folds_of,
write_image,
)
from visionset.formats._targets import self_target
from visionset.formats.lanes._core import (
BDD100K_CATEGORIES,
CULANE_SLOTS,
Expand Down Expand Up @@ -106,6 +107,11 @@ class TuSimpleExporter:

supported_modalities = frozenset({"image"})

#: The one self-named target whose geometries are not the supported set:
#: that set is empty here, everything arriving degraded, and a target must
#: carry at least one geometry — so it names the polyline this format writes.
targets = self_target(format_name, frozenset({GeometryType.POLYLINE}))

def export(
self,
release: Release,
Expand Down Expand Up @@ -138,6 +144,8 @@ class CurveLanesExporter:
degraded_geometries: frozenset[GeometryType] = frozenset()
supported_modalities = frozenset({"image"})

targets = self_target(format_name, supported_geometries)

def export(
self,
release: Release,
Expand All @@ -164,6 +172,8 @@ class Bdd100kLaneExporter:
degraded_geometries: frozenset[GeometryType] = frozenset()
supported_modalities = frozenset({"image"})

targets = self_target(format_name, supported_geometries)

def export(
self,
release: Release,
Expand Down Expand Up @@ -196,6 +206,8 @@ class CuLaneExporter:
degraded_geometries: frozenset[GeometryType] = frozenset()
supported_modalities = frozenset({"image"})

targets = self_target(format_name, supported_geometries)

def export(
self,
release: Release,
Expand Down Expand Up @@ -229,6 +241,8 @@ class OpenLane2dExporter:
degraded_geometries: frozenset[GeometryType] = frozenset()
supported_modalities = frozenset({"image"})

targets = self_target(format_name, supported_geometries)

def export(
self,
release: Release,
Expand Down
3 changes: 3 additions & 0 deletions src/visionset/formats/voc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
folds_of,
write_image,
)
from visionset.formats._targets import self_target
from visionset.kernel.domain import (
BboxGeometry,
GeometryType,
Expand Down Expand Up @@ -101,6 +102,8 @@ class VocExporter:

supported_modalities = frozenset({"image"})

targets = self_target(format_name, supported_geometries)

def export(
self,
release: Release,
Expand Down
3 changes: 3 additions & 0 deletions src/visionset/formats/yolo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
folds_of,
write_image,
)
from visionset.formats._targets import self_target
from visionset.kernel.domain import (
BboxGeometry,
Geometry,
Expand Down Expand Up @@ -118,6 +119,8 @@ class YoloDetectionExporter:
#: A YOLO dataset is a directory of pictures.
supported_modalities = frozenset({"image"})

targets = self_target(format_name, supported_geometries)

def export(
self,
release: Release,
Expand Down
10 changes: 10 additions & 0 deletions src/visionset/kernel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
AssetNotInDataset,
AssetNotInJob,
AssetNotWritable,
AugmentationRequiresSplit,
BackgroundJobNotFound,
BatchImmutable,
BatchNotComplete,
Expand All @@ -34,6 +35,8 @@
EntityNotFound,
ExportFormatNotFound,
ExportSourceUnreadable,
ExportTargetConflict,
ExportTargetNotFound,
GeometryNotProduced,
InferenceConnectionInvalid,
InferenceConnectionModelFixed,
Expand All @@ -49,6 +52,7 @@
IngestJobNotFound,
InvalidAnnotation,
InvalidAttributeValue,
InvalidExportTarget,
InvalidName,
InvalidPartition,
InvalidSchema,
Expand All @@ -64,6 +68,7 @@
MissingRequiredAttribute,
NoSplitRecipe,
NotAWorkspace,
PreprocessingStepUnsupportedGeometry,
ProjectNameTaken,
ProjectNotFound,
PromptPointOutOfBounds,
Expand Down Expand Up @@ -105,6 +110,7 @@
"AssetNotInDataset",
"AssetNotInJob",
"AssetNotWritable",
"AugmentationRequiresSplit",
"BackgroundJobNotFound",
"BatchImmutable",
"BatchNotComplete",
Expand All @@ -124,10 +130,13 @@
"EntityNotFound",
"ExportFormatNotFound",
"ExportSourceUnreadable",
"ExportTargetConflict",
"ExportTargetNotFound",
"GeometryNotProduced",
"IngestJobNotFound",
"InvalidAnnotation",
"InvalidAttributeValue",
"InvalidExportTarget",
"InvalidName",
"InvalidPartition",
"InvalidSchema",
Expand All @@ -143,6 +152,7 @@
"MissingRequiredAttribute",
"NoSplitRecipe",
"NotAWorkspace",
"PreprocessingStepUnsupportedGeometry",
"ProjectNameTaken",
"ProjectNotFound",
"PromptPointOutOfBounds",
Expand Down
54 changes: 54 additions & 0 deletions src/visionset/kernel/domain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@
IngestCompleted,
ReleasePublished,
)
from visionset.kernel.domain.export_target import (
TARGET_NAME_PATTERN,
ExportTarget,
PreprocessingHints,
ResizeStrategy,
TargetFamily,
Task,
)
from visionset.kernel.domain.geometry import (
IMPLEMENTED_GEOMETRIES,
BboxGeometry,
Expand Down Expand Up @@ -162,6 +170,28 @@
TextPrompt,
require_points_on_asset,
)
from visionset.kernel.domain.preprocessing import (
AugmentOp,
AugmentStep,
PreprocessingRecipe,
RecipeSpec,
ResizeStep,
Step,
brightness_contrast_factors,
hflip_applied,
recipe_hash,
rot90_quarter_turns,
variant_seed,
)
from visionset.kernel.domain.preprocessing_transform import (
Fold,
LetterboxFit,
TransformedAnnotation,
TransformedFile,
TransformedView,
letterbox_fit,
transform_manifest,
)
from visionset.kernel.domain.project import Project, ProjectPreview, ProjectStats
from visionset.kernel.domain.release import (
MANIFEST_VERSION,
Expand Down Expand Up @@ -379,6 +409,30 @@
"ClassExportStatus",
"ExportCompatibility",
"ExportResult",
"ExportTarget",
"PreprocessingHints",
"ResizeStrategy",
"TargetFamily",
"Task",
"TARGET_NAME_PATTERN",
"AugmentOp",
"AugmentStep",
"Fold",
"LetterboxFit",
"PreprocessingRecipe",
"RecipeSpec",
"ResizeStep",
"Step",
"TransformedAnnotation",
"TransformedFile",
"TransformedView",
"brightness_contrast_factors",
"hflip_applied",
"letterbox_fit",
"recipe_hash",
"rot90_quarter_turns",
"transform_manifest",
"variant_seed",
"Geometry",
"GeometryType",
"ImageFormat",
Expand Down
Loading
Loading