x4d-devkit 0.61.0rc1__tar.gz → 0.63.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {x4d_devkit-0.61.0rc1/x4d_devkit.egg-info → x4d_devkit-0.63.0}/PKG-INFO +1 -1
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/pyproject.toml +1 -1
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_source.py +51 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_sdk_api.py +1 -1
- x4d_devkit-0.63.0/tests/test_work_facts.py +172 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/cli.py +11 -1
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/__init__.py +3 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/client.py +2 -0
- x4d_devkit-0.63.0/x4d_devkit/client/work_facts.py +75 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_clip.py +7 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_source.py +40 -10
- x4d_devkit-0.63.0/x4d_devkit/work_facts.py +274 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0/x4d_devkit.egg-info}/PKG-INFO +1 -1
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit.egg-info/SOURCES.txt +3 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/LICENSE +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/README.md +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/setup.cfg +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_accounts.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_annotation_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_annotation_document_hash.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_annotation_reference.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_assets_client.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_boundary.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_box.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_build_info.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_category_audit.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_clean_basemap.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_clean_basemap_client.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_cli_auth.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_client_json_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_client_projects.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_clip_archives.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_contract_validation.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_contracts.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_coordinate_frames.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_current_state.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_current_state_identity_consumers_example.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_dataset_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_dataset_identity.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_detection_eval.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_evaluate.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_export_bundle.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_clip.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_conditional_rules.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_enum_set.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_export.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_external_predictions.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_geometry.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_groups.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_polygon.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_preannotation.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_reference.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_review.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_schema_migration.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_schema_registry_client.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_schema_upgrade.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_image_work_session.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_inference_input.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_inference_schemas.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_inference_service.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_label_schemas.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_lidar_materialization.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_loader.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_matching.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_metrics.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_models.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_parse_equivalence.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_platform_pose.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_preannotation_client.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_project_discovery.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_reconstruction_client.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_release_gate.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_roadmark_preview.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_semantic_scene_authoring.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_semantic_scene_client.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_semantic_scene_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_semantic_scene_independent.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_semantic_scene_native_clip.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_source_attributes.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_source_content.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_time_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_token.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_tracking_eval.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_training_identity.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_transform.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_transform_chain.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_validation.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_vector_map.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_vector_map_geometry.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_vector_map_session.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_work_items.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_work_session.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/tests/test_work_session_validation_reuse.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/__init__.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/_image_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/accounts.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/annotation_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/annotation_reference.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/audit.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/build_info.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/clean_basemap.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/_origin.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/accounts.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/annotation_reference.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/assets.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/bags.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/capabilities.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/checkpoints.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/clean_basemap.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/clip_work_sessions.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/clips.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/dataset_identity.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/image_clips.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/image_exports.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/image_preannotations.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/image_review.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/image_schemas.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/image_work_sessions.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/label_schemas.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/preannotation.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/projects.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/reconstruction.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/semantic_scene.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/semantic_scene_authoring.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/services.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/test_sets.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/client/work_items.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/consumer_identity.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/contracts.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/coordinate_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/core/__init__.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/core/loader.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/core/models.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/core/token.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/core/transform.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/current_state.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/dataset_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/dataset_identity.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/eval/__init__.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/eval/api.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/eval/box.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/eval/detection.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/eval/matching.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/eval/metrics.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/eval/tracking.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/export_bundle.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_export.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_geometry.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_groups.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_preannotation.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_reference.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_review.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_schema.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_schema_migration.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_schema_upgrade.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/image_work_session.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/inference/__init__.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/inference/input.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/inference/models.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/inference/schemas.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/inference/service.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/inference/tasks.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/json_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/label_schema.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/lidar_materialization.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/materialize.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/project_discovery.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/roadmark_preview.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/semantic_scene_authoring.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/semantic_scene_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/source_content.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/time_contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/training_identity.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/validation/__init__.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/validation/contract.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/validation/platform_pose.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/validation/report.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/validation/validator.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/vector_map.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/vector_map_geometry.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/work_items.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit/work_session.py +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit.egg-info/dependency_links.txt +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit.egg-info/entry_points.txt +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit.egg-info/requires.txt +0 -0
- {x4d_devkit-0.61.0rc1 → x4d_devkit-0.63.0}/x4d_devkit.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "x4d-devkit"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.63.0"
|
|
8
8
|
description = "Official X-4D external SDK and CLI for datasets, platform APIs, training bridges, and automation"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
@@ -235,3 +235,54 @@ def test_cli_converts_and_validates(tmp_path):
|
|
|
235
235
|
assert checked.returncode == 0 and json.loads(checked.stdout)["image_count"] == 1
|
|
236
236
|
(tmp_path / "out" / json.loads(built.stdout)["bundles"][0]["bundle_id"] / "x.txt").write_text("x")
|
|
237
237
|
assert run("image-source", "validate", path).returncode == 1
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def test_sequence_converter_declares_synthetic_time_and_keeps_original_names(tmp_path):
|
|
241
|
+
"""X-4D #1001: images without acquisition time get an explicit synthetic order."""
|
|
242
|
+
|
|
243
|
+
source = tmp_path / "images"
|
|
244
|
+
source.mkdir()
|
|
245
|
+
for name in ("b_rear.jpg", "a_rear.JPG", "c_rear.png"):
|
|
246
|
+
(source / name).write_bytes(png(8, 6) if name.endswith(".png") else jpeg(8, 6))
|
|
247
|
+
bundles = bundles_from_images(source, tmp_path / "out", channel="cam_rear", origin_label="litter",
|
|
248
|
+
synthetic_pinhole=True, timestamp="sequence",
|
|
249
|
+
synthetic_start_ns=1_700_000_000_000_000_000, max_images=2)
|
|
250
|
+
assert [len(row.images) for row in bundles] == [2, 1]
|
|
251
|
+
first = bundles[0].to_dict()
|
|
252
|
+
assert first["timestamp_source"] == "synthetic"
|
|
253
|
+
stamps = [image["timestamp"] for row in bundles for image in row.images]
|
|
254
|
+
assert stamps == [time_ns_dict(1_700_000_000_000_000_000 + i * 1_000_000) for i in range(3)]
|
|
255
|
+
names = json.loads((tmp_path / "out" / f"{first['bundle_id']}.sources.json").read_text())
|
|
256
|
+
assert list(names.values()) == ["a_rear.JPG", "b_rear.jpg"], "ordered by file name"
|
|
257
|
+
assert read_image_source_bundle(tmp_path / "out" / first["bundle_id"]).to_dict() == first
|
|
258
|
+
|
|
259
|
+
with pytest.raises(ImageContractError):
|
|
260
|
+
bundles_from_images(source, tmp_path / "gap", channel="cam_rear", origin_label="x",
|
|
261
|
+
synthetic_pinhole=True, timestamp="sequence", split_gap_s=60)
|
|
262
|
+
with pytest.raises(ImageContractError):
|
|
263
|
+
bundles_from_images(source, tmp_path / "start", channel="cam_rear", origin_label="x",
|
|
264
|
+
synthetic_pinhole=True, synthetic_start_ns=1)
|
|
265
|
+
with pytest.raises(ImageContractError):
|
|
266
|
+
bundles_from_images(source, tmp_path / "kind", channel="cam_rear", origin_label="x",
|
|
267
|
+
synthetic_pinhole=True, timestamp="mtime")
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def test_synthetic_time_is_visible_on_the_clip_and_unknown_sources_fail():
|
|
271
|
+
value, _ = provenance_clip()
|
|
272
|
+
value["meta"]["source_provenance"]["timestamp_source"] = "synthetic"
|
|
273
|
+
value["identity"] = build_image_identity(value)
|
|
274
|
+
assert parse_image_clip(value).timestamps_are_synthetic is True
|
|
275
|
+
real, _ = provenance_clip()
|
|
276
|
+
real["identity"] = build_image_identity(real)
|
|
277
|
+
assert parse_image_clip(real).timestamps_are_synthetic is False
|
|
278
|
+
assert parse_image_clip(clip_payload()).timestamps_are_synthetic is False
|
|
279
|
+
broken = copy.deepcopy(value)
|
|
280
|
+
broken["meta"]["source_provenance"]["timestamp_source"] = "mtime"
|
|
281
|
+
broken["identity"] = build_image_identity(broken)
|
|
282
|
+
with pytest.raises(ImageContractError):
|
|
283
|
+
parse_image_clip(broken)
|
|
284
|
+
old = copy.deepcopy(value)
|
|
285
|
+
old["meta"]["source_provenance"]["contract_version"] = "x4d-image-source-provenance-v1"
|
|
286
|
+
old["identity"] = build_image_identity(old)
|
|
287
|
+
with pytest.raises(ImageContractError):
|
|
288
|
+
parse_image_clip(old)
|
|
@@ -11,7 +11,7 @@ from x4d_devkit.eval.matching import MetricData
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def test_package_version_is_current_release():
|
|
14
|
-
assert x4d_devkit.__version__ == "0.
|
|
14
|
+
assert x4d_devkit.__version__ == "0.63.0"
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def test_loader_exposes_and_enforces_only_current_schema(tmp_path):
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
from copy import deepcopy
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from x4d_devkit.client import WorkFactError, X4DClient
|
|
8
|
+
from x4d_devkit.work_facts import (
|
|
9
|
+
MAX_WORK_FACTS_PER_BATCH,
|
|
10
|
+
WORK_COUNT_KINDS,
|
|
11
|
+
WORK_FACT_BATCH_CONTRACT,
|
|
12
|
+
WORK_FACT_RECEIPT_CONTRACT,
|
|
13
|
+
parse_work_fact,
|
|
14
|
+
parse_work_fact_batch,
|
|
15
|
+
parse_work_fact_receipt,
|
|
16
|
+
work_fact_batch,
|
|
17
|
+
work_fact_time,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
BASE = {"project_id": 3, "clip_id": "clip-001", "round": 1}
|
|
21
|
+
FACTS = {
|
|
22
|
+
"progress": {
|
|
23
|
+
"fact_id": "p-1", "kind": "progress", **BASE,
|
|
24
|
+
"units_total": 40, "units_done": 12, "stage": "editing", "saved_at": "2026-11-17T01:00:00Z",
|
|
25
|
+
},
|
|
26
|
+
"unit_completed": {
|
|
27
|
+
"fact_id": "c-1", "kind": "unit_completed", **BASE, "unit_id": "cam_front/000012.jpg",
|
|
28
|
+
"counts": {"box_2d": 3, "description": 1}, "completed_at": "2026-11-17T01:00:00.5Z",
|
|
29
|
+
},
|
|
30
|
+
"unit_reviewed": {
|
|
31
|
+
"fact_id": "r-1", "kind": "unit_reviewed", **BASE, "unit_id": "cam_front/000012.jpg",
|
|
32
|
+
"verdict": "defect", "defect_count": 2, "reviewed_at": "2026-11-17T03:00:00Z",
|
|
33
|
+
},
|
|
34
|
+
"activity": {
|
|
35
|
+
"fact_id": "a-1", "kind": "activity", **BASE, "stage": "annotate",
|
|
36
|
+
"started_at": "2026-11-17T00:50:00Z", "ended_at": "2026-11-17T01:20:00Z",
|
|
37
|
+
},
|
|
38
|
+
"watermark": {
|
|
39
|
+
"fact_id": "w-1", "kind": "watermark", "project_id": 3, "delivered_through": "2026-11-17T16:00:00Z",
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def fact(kind, **changes):
|
|
45
|
+
value = deepcopy(FACTS[kind])
|
|
46
|
+
value.update(changes)
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@pytest.mark.parametrize("kind", sorted(FACTS))
|
|
51
|
+
def test_every_fact_kind_round_trips(kind):
|
|
52
|
+
assert parse_work_fact(fact(kind)) == FACTS[kind]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_occurrence_time_is_the_kind_specific_instant():
|
|
56
|
+
assert work_fact_time(fact("activity")) == "2026-11-17T01:20:00Z"
|
|
57
|
+
assert work_fact_time(fact("unit_reviewed")) == "2026-11-17T03:00:00Z"
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@pytest.mark.parametrize(
|
|
61
|
+
"value, message",
|
|
62
|
+
[
|
|
63
|
+
(fact("progress", units_done=41), "within units_total"),
|
|
64
|
+
(fact("progress", stage="accepted"), "stage must be one of"),
|
|
65
|
+
(fact("unit_completed", counts={"description": 1, "box_2d": 3}), "sorted"),
|
|
66
|
+
(fact("unit_completed", counts={"box_2d": 0}), "counts.box_2d"),
|
|
67
|
+
(fact("unit_completed", counts={"cuboid": 1}), "drawn from"),
|
|
68
|
+
(fact("unit_reviewed", verdict="pass", defect_count=1), "exactly when verdict is pass"),
|
|
69
|
+
(fact("unit_reviewed", verdict="defect", defect_count=0), "exactly when verdict is pass"),
|
|
70
|
+
(fact("activity", ended_at="2026-11-17T00:50:00Z"), "end after it starts"),
|
|
71
|
+
(fact("activity", started_at="2026-11-16T00:00:00Z"), "at most"),
|
|
72
|
+
(fact("activity", ended_at="2026-11-17T09:20:00+08:00"), "UTC timestamp"),
|
|
73
|
+
(fact("watermark", clip_id="clip-001"), "fields do not match"),
|
|
74
|
+
(fact("progress", actor_id=7), "fields do not match"),
|
|
75
|
+
(fact("progress", fact_id="-bad"), "fact_id"),
|
|
76
|
+
(fact("progress", round=0), "round"),
|
|
77
|
+
(fact("unit_completed", unit_id=" padded"), "unit_id"),
|
|
78
|
+
({**fact("progress"), "kind": "login"}, "kind must be one of"),
|
|
79
|
+
],
|
|
80
|
+
)
|
|
81
|
+
def test_facts_reject_anything_outside_the_current_contract(value, message):
|
|
82
|
+
with pytest.raises(ValueError, match=message):
|
|
83
|
+
parse_work_fact(value)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def test_confirmed_empty_unit_has_no_counts_and_3d_kinds_are_allowed():
|
|
87
|
+
parse_work_fact(fact("unit_completed", counts={}))
|
|
88
|
+
parse_work_fact(fact("unit_completed", counts={"box_3d": 7, "track_3d": 2}))
|
|
89
|
+
assert set(WORK_COUNT_KINDS) >= {"box_2d", "polyline_2d", "polygon_2d", "box_3d", "track_3d", "description"}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_batches_bound_size_require_unique_ids_and_one_source():
|
|
93
|
+
batch = work_fact_batch("x-images", [fact("progress"), fact("activity")])
|
|
94
|
+
assert batch["contract_version"] == WORK_FACT_BATCH_CONTRACT
|
|
95
|
+
with pytest.raises(ValueError, match="unique"):
|
|
96
|
+
work_fact_batch("x-images", [fact("progress"), fact("activity", fact_id="p-1")])
|
|
97
|
+
with pytest.raises(ValueError, match="1–500"):
|
|
98
|
+
work_fact_batch("x-images", [])
|
|
99
|
+
many = [fact("activity", fact_id=f"a-{i}") for i in range(MAX_WORK_FACTS_PER_BATCH + 1)]
|
|
100
|
+
with pytest.raises(ValueError, match="1–500"):
|
|
101
|
+
work_fact_batch("x-images", many)
|
|
102
|
+
with pytest.raises(ValueError, match="source"):
|
|
103
|
+
work_fact_batch("X Images", [fact("progress")])
|
|
104
|
+
with pytest.raises(ValueError, match=r"facts\[1\]"):
|
|
105
|
+
work_fact_batch("x-points", [fact("progress"), fact("progress", fact_id="p-2", units_total=-1)])
|
|
106
|
+
with pytest.raises(ValueError, match="fields do not match"):
|
|
107
|
+
parse_work_fact_batch({**batch, "actor_id": 9})
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def receipt(*results):
|
|
111
|
+
return {"contract_version": WORK_FACT_RECEIPT_CONTRACT, "results": list(results)}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def test_receipts_carry_codes_only_on_rejection():
|
|
115
|
+
parse_work_fact_receipt(receipt(
|
|
116
|
+
{"fact_id": "p-1", "status": "accepted", "code": None},
|
|
117
|
+
{"fact_id": "a-1", "status": "duplicate", "code": None},
|
|
118
|
+
{"fact_id": "r-1", "status": "rejected", "code": "work_fact_role_mismatch"},
|
|
119
|
+
))
|
|
120
|
+
with pytest.raises(ValueError, match="only on a rejected"):
|
|
121
|
+
parse_work_fact_receipt(receipt({"fact_id": "p-1", "status": "accepted", "code": "work_fact_conflict"}))
|
|
122
|
+
with pytest.raises(ValueError, match="code must be one of"):
|
|
123
|
+
parse_work_fact_receipt(receipt({"fact_id": "p-1", "status": "rejected", "code": None}))
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _client(handler):
|
|
127
|
+
client = X4DClient(api_url="http://platform.test", token="t")
|
|
128
|
+
client._http.close()
|
|
129
|
+
client._http = httpx.Client(base_url=client.api_url, transport=httpx.MockTransport(handler))
|
|
130
|
+
return client
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def test_client_reports_and_verifies_the_receipt_order():
|
|
134
|
+
seen = []
|
|
135
|
+
|
|
136
|
+
def handler(request):
|
|
137
|
+
body = json.loads(request.content)
|
|
138
|
+
seen.append((request.method, request.url.path, body))
|
|
139
|
+
return httpx.Response(200, json=receipt(*(
|
|
140
|
+
{"fact_id": row["fact_id"], "status": "accepted", "code": None} for row in body["facts"]
|
|
141
|
+
)))
|
|
142
|
+
|
|
143
|
+
with _client(handler) as client:
|
|
144
|
+
result = client.work_facts.report(source="x-images", facts=[fact("progress"), fact("watermark")])
|
|
145
|
+
assert [row["status"] for row in result["results"]] == ["accepted", "accepted"]
|
|
146
|
+
method, path, body = seen[0]
|
|
147
|
+
assert (method, path, body["source"]) == ("POST", "/api/v1/work/facts", "x-images")
|
|
148
|
+
assert "actor_id" not in json.dumps(body), "the platform derives the actor from the token"
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def test_client_rejects_foreign_receipts_and_maps_batch_errors():
|
|
152
|
+
def reordered(request):
|
|
153
|
+
return httpx.Response(200, json=receipt(
|
|
154
|
+
{"fact_id": "w-1", "status": "accepted", "code": None},
|
|
155
|
+
{"fact_id": "p-1", "status": "accepted", "code": None},
|
|
156
|
+
))
|
|
157
|
+
|
|
158
|
+
with _client(reordered) as client:
|
|
159
|
+
with pytest.raises(ValueError, match="another request"):
|
|
160
|
+
client.work_facts.report(source="x-images", facts=[fact("progress"), fact("watermark")])
|
|
161
|
+
|
|
162
|
+
def too_large(request):
|
|
163
|
+
return httpx.Response(413, json={"detail": {"code": "work_fact_batch_too_large", "message": "too many"}})
|
|
164
|
+
|
|
165
|
+
with _client(too_large) as client:
|
|
166
|
+
with pytest.raises(WorkFactError) as caught:
|
|
167
|
+
client.work_facts.report(source="x-images", facts=[fact("progress")])
|
|
168
|
+
assert caught.value.to_dict() == {"code": "work_fact_batch_too_large", "message": "too many", "status_code": 413}
|
|
169
|
+
|
|
170
|
+
with _client(lambda request: pytest.fail("invalid batches never reach the platform")) as client:
|
|
171
|
+
with pytest.raises(ValueError):
|
|
172
|
+
client.work_facts.report(source="x-images", facts=[fact("progress", units_done=99)])
|
|
@@ -456,12 +456,15 @@ def cmd_image_source_from_images(args):
|
|
|
456
456
|
calibration=calibration, synthetic_pinhole=args.synthetic_pinhole, focal_px=args.focal_px,
|
|
457
457
|
frame_id=args.frame_id, parent_frame=args.parent_frame, split_gap_s=args.split_gap_s,
|
|
458
458
|
max_images=args.max_images, bundle_prefix=args.bundle_prefix,
|
|
459
|
+
timestamp=args.timestamp, synthetic_start_ns=args.synthetic_start_ns,
|
|
459
460
|
)
|
|
460
461
|
except (OSError, ValueError, ImageContractError) as exc:
|
|
461
462
|
print_json({"ok": False, "error": str(exc)})
|
|
462
463
|
raise SystemExit(1) from exc
|
|
463
464
|
print_json({"ok": True, "bundles": [
|
|
464
465
|
{"bundle_id": row.to_dict()["bundle_id"], "path": str(Path(args.out) / row.to_dict()["bundle_id"]),
|
|
466
|
+
"sources": str(Path(args.out) / f"{row.to_dict()['bundle_id']}.sources.json"),
|
|
467
|
+
"timestamp_source": row.to_dict()["timestamp_source"],
|
|
465
468
|
"bundle_fingerprint": row.fingerprint, "image_count": len(row.images)} for row in bundles]})
|
|
466
469
|
|
|
467
470
|
|
|
@@ -885,7 +888,9 @@ def main():
|
|
|
885
888
|
p_source_validate.add_argument("path")
|
|
886
889
|
p_source_validate.add_argument("--metadata-only", action="store_true", help="Check manifest and file set only")
|
|
887
890
|
p_source_validate.set_defaults(func=cmd_image_source_validate)
|
|
888
|
-
p_source_build = p_source_sub.add_parser(
|
|
891
|
+
p_source_build = p_source_sub.add_parser(
|
|
892
|
+
"from-images", help="Convert single-camera images (<epoch_ns> names or synthetic order) into bundles"
|
|
893
|
+
)
|
|
889
894
|
p_source_build.add_argument("images_dir")
|
|
890
895
|
p_source_build.add_argument("--out", required=True)
|
|
891
896
|
p_source_build.add_argument("--channel", required=True)
|
|
@@ -896,6 +901,11 @@ def main():
|
|
|
896
901
|
p_source_build.add_argument("--focal-px", type=float)
|
|
897
902
|
p_source_build.add_argument("--frame-id")
|
|
898
903
|
p_source_build.add_argument("--parent-frame", default="base_link")
|
|
904
|
+
p_source_build.add_argument(
|
|
905
|
+
"--timestamp", choices=("filename", "sequence"), default="filename",
|
|
906
|
+
help="filename: <epoch_ns> acquisition times; sequence: synthetic order by file name (not acquisition time)",
|
|
907
|
+
)
|
|
908
|
+
p_source_build.add_argument("--synthetic-start-ns", type=int, help="First synthetic time (default: now)")
|
|
899
909
|
p_source_build.add_argument("--split-gap-s", type=float)
|
|
900
910
|
p_source_build.add_argument("--max-images", type=int, default=2000)
|
|
901
911
|
p_source_build.add_argument("--bundle-prefix")
|
|
@@ -42,6 +42,7 @@ from x4d_devkit.client.reconstruction import (
|
|
|
42
42
|
)
|
|
43
43
|
from x4d_devkit.client.services import ServicesAPI
|
|
44
44
|
from x4d_devkit.client.test_sets import TestSetsAPI
|
|
45
|
+
from x4d_devkit.client.work_facts import WorkFactError, WorkFactsAPI
|
|
45
46
|
from x4d_devkit.client.work_items import WorkItemError, WorkItemsAPI
|
|
46
47
|
|
|
47
48
|
from x4d_devkit.client.image_schemas import (
|
|
@@ -52,6 +53,8 @@ from x4d_devkit.client.image_schemas import (
|
|
|
52
53
|
|
|
53
54
|
__all__ = [
|
|
54
55
|
"WorkItemError",
|
|
56
|
+
"WorkFactError",
|
|
57
|
+
"WorkFactsAPI",
|
|
55
58
|
"WorkItemsAPI",
|
|
56
59
|
"ImageProjectSchemaEntry",
|
|
57
60
|
"ImageSchemaEntry",
|
|
@@ -37,6 +37,7 @@ from x4d_devkit.client.projects import ProjectsAPI
|
|
|
37
37
|
from x4d_devkit.client.reconstruction import ReconstructionAPI
|
|
38
38
|
from x4d_devkit.client.services import ServicesAPI
|
|
39
39
|
from x4d_devkit.client.test_sets import TestSetsAPI
|
|
40
|
+
from x4d_devkit.client.work_facts import WorkFactsAPI
|
|
40
41
|
from x4d_devkit.client.work_items import WorkItemsAPI
|
|
41
42
|
from x4d_devkit.json_contract import parse_i_json
|
|
42
43
|
|
|
@@ -92,6 +93,7 @@ class X4DClient:
|
|
|
92
93
|
self.test_sets = TestSetsAPI(self)
|
|
93
94
|
self.checkpoints = CheckpointsAPI(self)
|
|
94
95
|
self.work_items = WorkItemsAPI(self)
|
|
96
|
+
self.work_facts = WorkFactsAPI(self)
|
|
95
97
|
self._preannotation: PreannotationAPI | None = None
|
|
96
98
|
self._image_review: ImageReviewAPI | None = None
|
|
97
99
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""Typed reporting client for editor work facts (X-4D #1000).
|
|
2
|
+
|
|
3
|
+
The platform authorizes every fact against the authenticated caller's role on
|
|
4
|
+
that Clip round; a locally valid batch is never accepted on its own.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
import httpx
|
|
12
|
+
|
|
13
|
+
from x4d_devkit.work_facts import (
|
|
14
|
+
WORK_FACT_ERROR_CODES,
|
|
15
|
+
parse_work_fact_receipt,
|
|
16
|
+
work_fact_batch,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class WorkFactError(RuntimeError):
|
|
21
|
+
"""A whole-batch platform rejection carrying one ``work_fact_*`` code."""
|
|
22
|
+
|
|
23
|
+
def __init__(self, code: str, message: str, status_code: int):
|
|
24
|
+
super().__init__(message)
|
|
25
|
+
self.code = code
|
|
26
|
+
self.message = message
|
|
27
|
+
self.status_code = status_code
|
|
28
|
+
|
|
29
|
+
def to_dict(self) -> dict[str, Any]:
|
|
30
|
+
return {"code": self.code, "message": self.message, "status_code": self.status_code}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _fact_error(exc: httpx.HTTPStatusError) -> WorkFactError | None:
|
|
34
|
+
try:
|
|
35
|
+
payload = exc.response.json()
|
|
36
|
+
except Exception:
|
|
37
|
+
return None
|
|
38
|
+
detail = payload.get("detail", payload) if isinstance(payload, dict) else None
|
|
39
|
+
if not isinstance(detail, dict) or detail.get("code") not in WORK_FACT_ERROR_CODES:
|
|
40
|
+
return None
|
|
41
|
+
message = detail.get("message")
|
|
42
|
+
return WorkFactError(
|
|
43
|
+
detail["code"],
|
|
44
|
+
message if isinstance(message, str) and message else detail["code"],
|
|
45
|
+
int(exc.response.status_code),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class WorkFactsAPI:
|
|
50
|
+
def __init__(self, client):
|
|
51
|
+
self._client = client
|
|
52
|
+
|
|
53
|
+
def report(self, *, source: str, facts: list[dict]) -> dict:
|
|
54
|
+
"""Report 1–500 facts; returns the receipt with one result per fact, in order.
|
|
55
|
+
|
|
56
|
+
Resending the same facts is safe: already stored facts come back as
|
|
57
|
+
``duplicate``. A fact ID reused with different content is
|
|
58
|
+
``rejected`` with ``work_fact_conflict``.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
batch = work_fact_batch(source, facts)
|
|
62
|
+
try:
|
|
63
|
+
response = self._client.post("/work/facts", json=batch)
|
|
64
|
+
except httpx.HTTPStatusError as exc:
|
|
65
|
+
error = _fact_error(exc)
|
|
66
|
+
if error is not None:
|
|
67
|
+
raise error from exc
|
|
68
|
+
raise
|
|
69
|
+
receipt = parse_work_fact_receipt(response)
|
|
70
|
+
if [row["fact_id"] for row in receipt["results"]] != [fact["fact_id"] for fact in batch["facts"]]:
|
|
71
|
+
raise ValueError("work fact receipt belongs to another request")
|
|
72
|
+
return receipt
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
__all__ = ["WorkFactError", "WorkFactsAPI"]
|
|
@@ -699,6 +699,13 @@ class ImageClip(ImageDocument):
|
|
|
699
699
|
provenance = self.source_provenance
|
|
700
700
|
return "bag_admission" if provenance is None else provenance["kind"]
|
|
701
701
|
|
|
702
|
+
@property
|
|
703
|
+
def timestamps_are_synthetic(self) -> bool:
|
|
704
|
+
"""True when sample times are a producer-generated order, not acquisition times."""
|
|
705
|
+
|
|
706
|
+
provenance = self.source_provenance
|
|
707
|
+
return provenance is not None and provenance["timestamp_source"] == "synthetic"
|
|
708
|
+
|
|
702
709
|
def calibration_is_measured(self, calibration_id: str) -> bool:
|
|
703
710
|
"""False only for an explicitly synthetic calibration."""
|
|
704
711
|
|
|
@@ -10,11 +10,13 @@ from __future__ import annotations
|
|
|
10
10
|
|
|
11
11
|
from copy import deepcopy
|
|
12
12
|
import hashlib
|
|
13
|
+
import json
|
|
13
14
|
import os
|
|
14
15
|
from pathlib import Path
|
|
15
16
|
import re
|
|
16
17
|
import shutil
|
|
17
18
|
import struct
|
|
19
|
+
import time
|
|
18
20
|
from typing import Any, Callable
|
|
19
21
|
|
|
20
22
|
from x4d_devkit._image_contract import (
|
|
@@ -33,10 +35,13 @@ from x4d_devkit._image_contract import (
|
|
|
33
35
|
from x4d_devkit.json_contract import parse_i_json
|
|
34
36
|
|
|
35
37
|
|
|
36
|
-
IMAGE_SOURCE_BUNDLE_VERSION = "x4d-image-source-bundle-
|
|
37
|
-
IMAGE_SOURCE_PROVENANCE_VERSION = "x4d-image-source-provenance-
|
|
38
|
+
IMAGE_SOURCE_BUNDLE_VERSION = "x4d-image-source-bundle-v2"
|
|
39
|
+
IMAGE_SOURCE_PROVENANCE_VERSION = "x4d-image-source-provenance-v2"
|
|
38
40
|
IMAGE_SOURCE_MANIFEST = "manifest.json"
|
|
39
|
-
|
|
41
|
+
# ``synthetic``: a stable technical order generated by the producer, explicitly
|
|
42
|
+
# not an acquisition time (X-4D #1001). Consumers needing real time must refuse it.
|
|
43
|
+
TIMESTAMP_SOURCES = ("header_stamp", "filename", "declared", "synthetic")
|
|
44
|
+
SYNTHETIC_TIME_STEP_NS = 1_000_000
|
|
40
45
|
CALIBRATION_SOURCES = ("declared", "synthetic")
|
|
41
46
|
_EXTENSIONS = {"jpeg": "jpg", "png": "png"}
|
|
42
47
|
_DEFAULT_MAX_MANIFEST_BYTES = 64 * 1024 * 1024
|
|
@@ -354,26 +359,46 @@ def bundles_from_images(
|
|
|
354
359
|
split_gap_s: float | None = None,
|
|
355
360
|
max_images: int = 2000,
|
|
356
361
|
bundle_prefix: str | None = None,
|
|
362
|
+
timestamp: str = "filename",
|
|
363
|
+
synthetic_start_ns: int | None = None,
|
|
357
364
|
) -> list[ImageSourceBundle]:
|
|
358
|
-
"""Convert a flat directory of
|
|
365
|
+
"""Convert a flat directory of single-camera images into bundles.
|
|
359
366
|
|
|
367
|
+
``timestamp="filename"`` reads ``<epoch_ns>.jpg|png`` acquisition times.
|
|
368
|
+
``timestamp="sequence"`` accepts any ``*.jpg|jpeg|png`` names, orders them by
|
|
369
|
+
file name and assigns synthetic times from ``synthetic_start_ns`` (default:
|
|
370
|
+
now) in 1 ms steps; the bundle declares ``timestamp_source="synthetic"``.
|
|
360
371
|
Exactly one of ``calibration`` (declared) or ``synthetic_pinhole`` is required.
|
|
361
|
-
Images are split at time gaps larger than ``split_gap_s``
|
|
372
|
+
Images are split at time gaps larger than ``split_gap_s`` (real time only)
|
|
373
|
+
and at ``max_images``. Next to each bundle directory (outside it, so the
|
|
374
|
+
bundle stays closed) ``<bundle_id>.sources.json`` maps every bundle image
|
|
375
|
+
path to its original file name, for later association of external results.
|
|
362
376
|
"""
|
|
363
377
|
|
|
364
378
|
identifier(channel, "channel")
|
|
365
379
|
text(origin_label, "origin_label")
|
|
380
|
+
require(timestamp in ("filename", "sequence"), "timestamp must be filename or sequence", "timestamp")
|
|
381
|
+
sequence = timestamp == "sequence"
|
|
382
|
+
require(not sequence or split_gap_s is None, "synthetic times cannot be split by time gaps", "split_gap_s")
|
|
383
|
+
require(sequence or synthetic_start_ns is None, "synthetic_start_ns applies only to sequence times", "synthetic_start_ns")
|
|
384
|
+
if sequence:
|
|
385
|
+
start = time.time_ns() if synthetic_start_ns is None else synthetic_start_ns
|
|
386
|
+
require(type(start) is int and 0 <= start < 2**63, "synthetic_start_ns must be a non-negative epoch in ns",
|
|
387
|
+
"synthetic_start_ns")
|
|
366
388
|
require((calibration is None) == synthetic_pinhole, "choose exactly one of a declared calibration or a synthetic pinhole", "calibration")
|
|
367
389
|
integer(max_images, "max_images", minimum=1)
|
|
368
390
|
source = Path(images_dir)
|
|
369
391
|
require(source.is_dir(), "images directory is missing", str(source))
|
|
370
392
|
entries = []
|
|
371
|
-
for item in sorted(source.iterdir()):
|
|
372
|
-
|
|
373
|
-
|
|
393
|
+
for index, item in enumerate(sorted(source.iterdir(), key=lambda path: path.name)):
|
|
394
|
+
pattern = r"[^/]+\.(jpg|jpeg|png)" if sequence else r"([0-9]{1,20})\.(jpg|jpeg|png)"
|
|
395
|
+
match = re.fullmatch(pattern, item.name, flags=re.IGNORECASE)
|
|
396
|
+
expected = "*.jpg|jpeg|png" if sequence else "<epoch_ns>.jpg|png"
|
|
397
|
+
require(item.is_file() and not item.is_symlink() and match is not None, f"expected only {expected} files", str(item))
|
|
374
398
|
data = item.read_bytes()
|
|
375
399
|
encoding, width, height = image_dimensions(data)
|
|
376
|
-
|
|
400
|
+
ns = start + index * SYNTHETIC_TIME_STEP_NS if sequence else int(match.group(1))
|
|
401
|
+
entries.append({"ns": ns, "file": item, "size": len(data),
|
|
377
402
|
"sha256": hashlib.sha256(data).hexdigest(), "encoding": encoding,
|
|
378
403
|
"width": width, "height": height})
|
|
379
404
|
require(bool(entries), "no images found", str(source))
|
|
@@ -411,13 +436,18 @@ def bundles_from_images(
|
|
|
411
436
|
"contract_version": IMAGE_SOURCE_BUNDLE_VERSION,
|
|
412
437
|
"bundle_id": bundle_id,
|
|
413
438
|
"origin": {"label": origin_label},
|
|
414
|
-
"timestamp_source": "filename",
|
|
439
|
+
"timestamp_source": "synthetic" if sequence else "filename",
|
|
415
440
|
"channels": [{"channel": channel, "calibration": deepcopy(calibration), "calibration_source": calibration_source}],
|
|
416
441
|
"reference_channel": channel,
|
|
417
442
|
"sync_window_ns": 0,
|
|
418
443
|
"samples": samples,
|
|
419
444
|
}
|
|
420
445
|
result.append(write_image_source_bundle(manifest, Path(out_dir) / bundle_id, sources))
|
|
446
|
+
(Path(out_dir) / f"{bundle_id}.sources.json").write_text(
|
|
447
|
+
json.dumps({path: Path(file).name for path, file in sorted(sources.items())}, ensure_ascii=False, indent=2)
|
|
448
|
+
+ "\n",
|
|
449
|
+
encoding="utf-8",
|
|
450
|
+
)
|
|
421
451
|
return result
|
|
422
452
|
|
|
423
453
|
|