Artificial Intelligence
Categories:
Artificial Intelligence in RawCull
This section explains how RawCull uses reusable AI components without allowing model-runtime details to spread through the application. It is written as a learning path: first understand the boundary between RawCull and PhotoAIKit, then study the package itself, and finally follow CLIP from application startup to a persisted similarity artifact.
The source for this section comes from the pinned PhotoAIKit dependency and the
RawCull repository. Paths beginning with Sources/ refer to PhotoAIKit at the
revision in Package.resolved. RawCull intelligence code lives under
RawCull/Intelligence; app composition and presentation remain under
RawCull/Main, RawCull/Model, and RawCull/Views.
What This Section Documents
| Document | Main question | Start here when |
|---|---|---|
| This overview | Where does AI belong in the system? | You need the vocabulary and responsibility split |
| The RawCull AI Runtime | How are providers and long-lived features assembled? | You are tracing startup, refresh, or service replacement |
| AI Models in RawCull | How do CLIP, Vision, SAM 3, Qwen, and Objects work in the app? | You are tracing an analysis from input to result |
| Download AI models | How are the three release packs rebuilt? | You are preparing source weights, conversions, or archives |
| AI Model Licence and Provenance Clearance | What evidence is required before a model can ship? | You are reviewing licences, provenance, or release readiness |
| Publishing and Testing RawCull AI Models | How are packs published and Objects tested? | You are preparing a model release or updating the download manifest |
PhotoAIKit and RawCull use these AI backends:
- CLIP image embeddings for visual similarity and semantic search.
- SAM 3 and EfficientSAM subject segmentation for subject masks.
- Apple Vision feature prints for always-available image similarity.
- Qwen3-VL for local photo analysis and for concept discovery and assessment of numbered SAM 3 objects.
The 3.2.6 production download catalog exposes DataComp CLIP, Meta SAM 3,
and Qwen3-VL-2B-Instruct. OpenAI CLIP remains excluded and EfficientSAM is not
a production download. SAM 3 requires acceptance of its verified bundled
licence before download. The App Store build uses Apple-hosted Managed
Background Assets; the Direct/Developer ID build retains a self-hosted v3
manifest. See AI Model Downloads for the exact distinction.
Vision is the startup and service-selection fallback: RawCull uses it when CLIP is disabled or the selected CLIP bundle cannot produce a validated provider. A selected CLIP indexing pass keeps its valid per-file artifacts and records the files that fail; it does not mix Vision artifacts into that pass or automatically rerun the whole batch.
The AI Models in RawCull guide follows code connected to similarity, semantic search, burst analysis, Deep Review, Qwen, and Objects. The PhotoAIKit architecture guide covers SAM 3 contracts, workflows, and storage so that the package design is understandable. Not every reusable package capability is necessarily exposed as a finished RawCull user workflow.
Objects test-release status
The maintainer is preparing a user test of AI Analysis → Objects. The feature combines Qwen concept discovery, separate SAM 3 masks, and Qwen assessment of numbered crops. The structural decoder checks board IDs and response fields; it cannot verify that generated text matches the photograph. A recent two-puffin result had two retained objects but an invented third bird in its summary, and a separate two-puffin result has an unresolved crop/description mismatch. Treat Objects output as advisory and verify it against the source. See Publishing and Testing RawCull AI Models for the known issues, tester checks, and release evidence still needed.
The Central Design Idea
RawCull and PhotoAIKit answer different kinds of questions.
PhotoAIKit asks:
- What does an image source look like at a package boundary?
- How is a model bundle validated and identified?
- How does a backend produce and compare a similarity artifact?
- How is bounded indexing or segmentation orchestrated?
- How can reusable artifacts and masks be encoded or cached?
RawCull asks:
- Where are models installed for this application?
- How is a Sony, Nikon, or DNG RAW file decoded for AI input?
- Which backend did the user request?
- When should a catalog be indexed or reindexed?
- How do similarity distances affect burst grouping and culling?
- What state and wording should SwiftUI present?
This is dependency inversion in practical form. PhotoAIKit defines small
protocols such as ImageDecoding, ImageSimilarityArtifactProviding, and
ImageSimilarityArtifactComparing. RawCull injects app-specific implementations
and keeps its file model, UI, sandbox policy, and culling decisions outside the
package.
flowchart LR
UI["RawCull SwiftUI and settings"] --> Integration["RawCullApplicationState composition root"]
Integration --> AppAdapter["RawCull adapters: paths, RAW decoding, policy"]
AppAdapter --> Contracts["PhotoAIContracts"]
Integration --> CLIP["CoreAICLIPBackend"]
Integration --> SAM3["CoreAISAM3Backend"]
Integration --> Vision["VisionFeaturePrintBackend"]
AppAdapter --> Workflows["PhotoAIWorkflows"]
Workflows --> Contracts
Storage["PhotoAIStorage"] --> Contracts
CLIP --> Contracts
SAM3 --> Contracts
Vision --> ContractsThe arrow direction matters: PhotoAIKit does not import RawCull. A reusable
package should not need to know what FileItem, RawCullViewModel, an
app-specific model folder, or a burst winner means.
Responsibility Boundary
| Concern | Owner | Reason |
|---|---|---|
| Typed model, image, artifact, and segmentation contracts | PhotoAIKit | Backends and hosts need one stable language |
| Core AI CLIP and SAM 3 inference | PhotoAIKit backend products | Framework-specific tensor and inference code is reusable |
| Vision feature-print generation and native distance | PhotoAIKit backend product | The opaque Vision payload stays behind its backend boundary |
| Bounded indexing, optional fallback mechanisms, segmentation, and mask selection | PhotoAIKit workflows | These mechanisms do not depend on RawCull UI or culling policy |
| Optional embedding codecs and mask stores | PhotoAIKit storage | Persistence mechanics are reusable, but locations are not |
| Model installation directories and candidate order | RawCull | Paths and sandbox policy belong to the host application |
| RAW decoding | RawCull | PhotoAIKit should not depend on RawParserKit or camera formats |
| Settings and capability wording | RawCull | User-facing state and localization belong to the app |
| Similarity ranking adjustments and burst grouping | RawCull | These are photo-culling product decisions, not CLIP behavior |
| Burst-analysis cache location and lifecycle | RawCull | The host owns when and where catalog results persist |
Current Runtime Shape
RawCullApplicationState is the object-graph assembly boundary. It creates one
RawCullAIModelRuntime, one shared SimilarityScoringModel, the focused
similarity and semantic-search features, Deep Review, Qwen and Objects features,
the main view model, and one RawCullIntelligenceRuntime. Identity assertions
protect against accidentally constructing parallel observable state.
RawCullAIModelRuntime owns concrete providers, resource managers, Qwen
inference, and separate subject/object mask stores. RawCullIntelligenceRuntime
owns stable feature lifetimes and applies complete revisioned configurations
from settings. See The RawCull AI Runtime for the full
construction and refresh sequence. Views receive focused feature surfaces
instead of the composition root or low-level scoring model:
| Consumer | Narrow dependency | Capability and persistence rule |
|---|---|---|
RawCullSimilarityFeature | Shared SimilarityScoringModel plus RawCullSimilarityServicing | Owns the public hydration, indexing, ranking, cancellation, and backend-presentation surface while persisting descriptor-valid artifacts |
RawCullSemanticSearchFeature | Shared scoring model and optional semantic-search service | Projects semantic-search state, binds weakly to application selection/navigation, and never indexes missing images as a query side effect |
BurstAnalysisCoordinator | Similarity feature, scoring models, and cache repository | Owns burst generation, progress, cache preparation, missing computation, grouping, ranking, cancellation, and derived-cache saving |
DeepAIReviewController | DeepAIReviewFeature | Builds immutable requests from app evidence and validates the group signature before recommendations reach culling policy |
RawCullAISettingsModel | RawCullIntelligenceConfigurationApplying | Publishes one ordered configuration; the runtime ignores stale revisions and applies only meaningful identity changes |
The safe startup and refresh path is:
RawCullAppcallsRawCullApplicationState.live()and retains its view model and intelligence runtime as stable@Stateroots.- Assembly creates the shared scoring model and focused features from the initial Vision-backed configuration.
RawCullAISettingsModel.refresh()asks the model runtime to validate both CLIP and both segmentation-model candidates.- PhotoAIKit validates model bundles and derives model-asset fingerprints.
- Settings publishes a monotonically revisioned configuration. The runtime replaces similarity or semantic-search services only when their identities changed and applies segmentation selection independently.
- Missing, invalid, or disabled CLIP leaves burst similarity on Vision and semantic search unavailable.
- CLIP indexing retains valid files and logs per-file failures; Vision is not inserted into that CLIP result set.
- Changing the segmentation selection immediately updates the active provider. A full refresh rechecks every candidate and saved-evidence state.
stateDiagram-v2
[*] --> VisionStartup
VisionStartup --> CheckingModels: settings refresh
CheckingModels --> Configuration: publish newer configuration revision
Configuration --> CLIPSelected: preference enabled and provider ready
Configuration --> VisionSelected: selected CLIP unavailable
CLIPSelected --> CLIPArtifacts: keep valid per-file artifacts
CLIPSelected --> PartialCLIP: record and exclude failed files
VisionSelected --> VisionArtifacts: index catalog
CheckingModels --> SegmentationSelected: activate SAM 3 or EfficientSAMBurst similarity, semantic search, and Deep Review are separate features even when they share package code. Burst similarity may use Vision or CLIP. Semantic search requires CLIP image artifacts whose descriptor exactly matches the text provider. Deep Review uses segmentation masks and has its own availability, selection, and storage lifecycle.
Vocabulary
| Term | Meaning in this codebase |
|---|---|
| Provider | A backend object that performs inference or creates an artifact |
| Backend descriptor | Identity of the backend, model, representation, preprocessing, normalization, and configuration |
| Similarity artifact | A descriptor plus a backend-owned payload; CLIP stores an encoded vector, while Vision stores an opaque archived observation |
| Source fingerprint | Standardized file path, size, and modification date used to detect changed source images |
| Model fingerprint | Identity derived from the selected .aimodel or .aimodelc, cryptographically verified when the manifest provides a checksum |
| Composition root | The one place where concrete providers, stores, paths, and app adapters are assembled |
| Partial CLIP result | Valid CLIP artifacts plus per-file failures; failed files remain unavailable to similarity and burst grouping until a later successful index |
| Host | The application integrating PhotoAIKit; here, RawCull |
AI Model Licence and Provenance Clearance
Current catalog status and historical model-clearance evidence.
AI Models in RawCull
Code-level guide to local CLIP, Vision, SAM 3, Qwen, Deep Review, and numbered Objects analysis in RawCull.
The RawCull AI Runtime
How RawCull owns and refreshes local CLIP, SAM 3, Qwen, Vision, Deep Review, and Objects runtimes.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.