| | """ |
| | You Learn From Failure (YLFF) |
| | |
| | BA-Supervised Fine-Tuning for Visual Geometry Models |
| | """ |
| |
|
| | __version__ = "0.0.0" |
| |
|
| | """ |
| | YLFF Package - Backward Compatibility Imports |
| | |
| | For backward compatibility, common imports are available directly: |
| | - from ylff import BAValidator, Profiler, JobResponse |
| | |
| | Preferred imports (new structure): |
| | - from ylff.services import BAValidator, ARKitProcessor |
| | - from ylff.utils.profiler import Profiler, profile |
| | - from ylff.utils.model_loader import load_da3_model |
| | - from ylff.utils.losses import pose_loss, geodesic_rotation_loss |
| | - from ylff.utils.exceptions import DataError, ModelLoadError |
| | - from ylff.models import JobResponse, ValidateSequenceRequest |
| | """ |
| |
|
| |
|
| | |
| | def __getattr__(name: str): |
| | """Lazy import for backward compatibility.""" |
| | if name == "BAValidator": |
| | from .services.ba_validator import BAValidator |
| |
|
| | return BAValidator |
| | elif name == "ARKitProcessor": |
| | from .services.arkit_processor import ARKitProcessor |
| |
|
| | return ARKitProcessor |
| | elif name == "Profiler": |
| | from .utils.profiler import Profiler |
| |
|
| | return Profiler |
| | elif name in ("profile", "profile_context"): |
| | from .utils.profiler import profile, profile_context |
| |
|
| | return profile if name == "profile" else profile_context |
| | elif name == "convert_arkit_to_opencv": |
| | from .utils.coordinate_utils import convert_arkit_to_opencv |
| |
|
| | return convert_arkit_to_opencv |
| | elif name in ("load_da3_model", "get_recommended_model", "list_available_models"): |
| | from .utils.model_loader import ( |
| | get_recommended_model, |
| | list_available_models, |
| | load_da3_model, |
| | ) |
| |
|
| | return locals().get(name) |
| | elif name in ("pose_loss", "geodesic_rotation_loss", "depth_loss", "confidence_weighted_loss"): |
| | from .utils.losses import ( |
| | confidence_weighted_loss, |
| | depth_loss, |
| | geodesic_rotation_loss, |
| | pose_loss, |
| | ) |
| |
|
| | return locals().get(name) |
| | elif name in ( |
| | "JobResponse", |
| | "ValidateSequenceRequest", |
| | "ValidateARKitRequest", |
| | "BuildDatasetRequest", |
| | "TrainRequest", |
| | "PretrainRequest", |
| | "EvaluateBAAgreementRequest", |
| | "VisualizeRequest", |
| | "HealthResponse", |
| | "ModelsResponse", |
| | "ValidationStats", |
| | "JobStatus", |
| | "DeviceType", |
| | "UseCase", |
| | ): |
| | from .models import ( |
| | BuildDatasetRequest, |
| | DeviceType, |
| | EvaluateBAAgreementRequest, |
| | HealthResponse, |
| | JobResponse, |
| | JobStatus, |
| | ModelsResponse, |
| | PretrainRequest, |
| | TrainRequest, |
| | UseCase, |
| | ValidateARKitRequest, |
| | ValidateSequenceRequest, |
| | ValidationStats, |
| | VisualizeRequest, |
| | ) |
| |
|
| | return locals().get(name) |
| | raise AttributeError(f"module 'ylff' has no attribute '{name}'") |
| |
|
| |
|
| | __all__ = [ |
| | |
| | "__version__", |
| | |
| | "BAValidator", |
| | "ARKitProcessor", |
| | |
| | "convert_arkit_to_opencv", |
| | "Profiler", |
| | "profile", |
| | "profile_context", |
| | |
| | "BuildDatasetRequest", |
| | "DeviceType", |
| | "EvaluateBAAgreementRequest", |
| | "HealthResponse", |
| | "JobResponse", |
| | "JobStatus", |
| | "ModelsResponse", |
| | "PretrainRequest", |
| | "TrainRequest", |
| | "UseCase", |
| | "ValidateARKitRequest", |
| | "ValidateSequenceRequest", |
| | "ValidationStats", |
| | "VisualizeRequest", |
| | ] |
| |
|