Shell Identification

Upload an image and identify the taxon of the shell

Treatise // Research Manuscript

Domain Router–Guided Expert Selection for Robust Molluscan Shell Identification

Published on: January 2026

0009-0002-9238-4007

Abstract

Convolutional neural networks (CNNs) trained on controlled studio imagery can achieve high accuracy for molluscan shell identification, yet performance degrades substantially when applied to heterogeneous home and field photographs due to domain shift. Building on prior evidence that a studio-trained backbone yields transferable representations and that the dominant bottleneck under domain shift lies in the decision boundary and calibration of the classifier head, this study evaluates a domain-adaptive inference framework for family-level recognition across three acquisition domains (studio, home, field) using a frozen embedding model and a 134-family label space. A lightweight Domain Router operating on frozen embeddings is introduced to support mixture-of-experts behavior by conservatively routing high-confidence studio images to a legacy studio expert while deferring non-studio or uncertain cases to a domain-balanced generalist. On a held-out validation set, the router achieves 0.866 accuracy and 0.801 macro-F1, with particularly strong separation of field imagery (F1 ≈ 0.96). Prototype-based inference using mean class embeddings and cosine similarity is investigated as a non-parametric baseline and as an auxiliary signal for fusion; however, prototype-only performance remains below the domain-balanced head, and rule-based score fusion yields only a small improvement in overall top-1 accuracy (0.7539 → 0.7557) while changing predictions for 0.29% of samples, indicating that decision-boundary adaptation captures most discriminative signal once a strong head is in place. A field-specialized head trained on field imagery converges stably (best field validation accuracy ≈ 0.4747) but does not provide a clear operational advantage over the domain-balanced generalist under deployment-oriented criteria. Overall, the results support a practical two-expert deployment strategy—router-gated legacy studio expert plus domain-balanced generalist—as a robust, low-overhead mechanism to stabilize family-level routing in hierarchical identification pipelines.

Introduction

The accurate identification of molluscan taxa is a cornerstone of biodiversity monitoring, paleoecology, and the regulation of global wildlife trade. While deep learning models, particularly Convolutional Neural Networks (CNNs), have achieved expert-level performance in controlled settings, their utility remains constrained by the "domain gap" — the significant performance drop encountered when transitioning from high-quality studio imagery to heterogeneous, unconstrained "in-the-wild" photographs [10]. In a preceding study, Toward Universal Shell Classification: Learning Robust Family-Level Representations Across Domains [2], it was demonstrated that a high-capacity CNN backbone trained exclusively on standardized studio imagery can learn feature representations that remain broadly transferable across heterogeneous acquisition conditions. Crucially, we showed that the dominant source of performance degradation under domain shift — from studio to home or field photographs — lies not in the learned representation itself, but in the decision boundary and calibration of the classifier head. By freezing the backbone and retraining only a domain-balanced classification head, substantial gains in field accuracy and reductions in predictive uncertainty were achieved without additional representation learning [1].

While this result establishes a strong and practical baseline for domain generalization in shell identification, it does not fully resolve the challenges posed by domain heterogeneity at inference time. Real-world deployment scenarios increasingly involve mixed streams of images originating from multiple capture conditions—controlled studio photography, semi-controlled home environments, and unconstrained field imagery — often without explicit metadata indicating their provenance. Treating all such inputs identically, even with a robust backbone and balanced head, can lead to systematic mismatches between image statistics, classifier calibration, and optimal decision rules.

In parallel fields such as object recognition and fine-grained classification, several complementary strategies have emerged to address this issue. Mixture-of-experts models have shown that routing inputs to specialized predictors can improve robustness under distribution shift, provided that the routing mechanism itself is lightweight and reliable [3, 9]. Prototype-based classifiers, which summarize each class by one or more representative embeddings, have proven effective in stabilizing predictions, improving interpretability, and supporting few-shot or open-set scenarios [4, 8]. Finally, score-level fusion of heterogeneous decision signals — such as parametric classifiers and distance-based similarity measures — has been shown to mitigate overconfidence and reduce error variance without retraining the underlying representation [5, 6].

In this work, we integrate these ideas into a unified domain-adaptive inference framework for shell identification, explicitly building on the frozen, studio-trained backbone introduced in our earlier study. We introduce three tightly coupled components.

First, we propose a Domain Router, a compact classifier operating on frozen backbone embeddings, whose purpose is to infer the visual acquisition domain (studio, home, or field) of each input image. Unlike heavy domain-adversarial or multi-branch training schemes, this router adds negligible computational overhead. At inference time, it produces a probability distribution over domains and enables mixture-of-experts behavior by selectively activating domain-specific classifier heads, prototype sets, calibration parameters, or test-time augmentation policies. When the router assigns high probability to the studio domain, the system preferentially relies on the original studio-optimized model, preserving peak in-domain performance.

Second, we introduce prototype representations at the family level, computed as mean embeddings in the frozen feature space. In addition to a global prototype per family, we maintain domain-specific prototypes for studio, home, and field imagery. These centroids capture systematic shifts in appearance induced by background clutter, lighting variability, viewpoint changes, and partial occlusions—effects that are difficult to fully absorb into a single parametric classifier head. Cosine similarity in the normalized embedding space is used as the primary distance measure, yielding a non-parametric inference signal that complements the supervised classifier.

Third, we propose a fusion inference strategy that combines parametric head predictions with prototype-based similarity scores. Rather than replacing the classifier head, we fuse both signals using either fixed or learned weights, allowing the system to trade off discriminative power against geometric consistency in embedding space. In its simplest form, the fused score for a family is computed as a weighted combination of the head posterior and the minimum or averaged distance to the relevant set of prototypes (global and domain-specific). This design enables domain-aware decision making, improves robustness when the head is underconfident or miscalibrated, and provides operational control through per-domain acceptance thresholds [6, 7].

Together, these components form a modular, interpretable, and computationally efficient extension of the previously established baseline. Importantly, the backbone remains entirely frozen: all domain adaptation occurs through routing, prototype selection, and score fusion at inference time. This design choice reflects both practical deployment constraints and the empirical finding that representation quality is not the primary bottleneck in this setting.

The contributions of this paper are threefold: (1) we introduce a lightweight domain router that enables mixture-of-experts behavior without multi-branch training; (2) we demonstrate that per-domain prototype representations capture meaningful domain-induced structure in the embedding space; and (3) we show that fusing prototype similarity with a domain-balanced classifier head yields more reliable and consistent predictions across studio, home, and field imagery.

Methods

Domain router

A lightweight “Domain Router” was trained to predict the acquisition domain (studio, home, field) from an input image in order to support expert selection at inference time. The router uses the frozen embedding model as a fixed feature extractor and learns only a small classification head. Images were decoded from JPEG, resized to the embedder’s input resolution (384×384), and preprocessed using the same pixel preprocessing as before (EfficientNetV2 preprocess_input applied after scaling to 0–255). During training, light domain-safe augmentation (random horizontal flips, small brightness and contrast jitter) was applied.

Because the training distribution across domains is imbalanced, the router was trained using balanced domain sampling (uniform sampling across the three domain streams) and class-weighted cross-entropy. The head consists of Layer Normalization, a dense layer (128 units, ReLU), dropout (0.2), and a 3-way softmax output. Training used Adam (learning rate 1e-3) for up to 20 epochs with early stopping on validation accuracy (patience 5), checkpointing the best model, and learning-rate reduction on plateau. Final evaluation on the validation set used a deterministic, non-augmented pipeline consistent with the training preprocessing, reporting precision/recall/F1 per domain and overall accuracy. In addition, per-image router confidence (maximum softmax probability) and predictive entropy were computed to support an optional fallback rule, flagging uncertain cases when confidence < 0.55 or entropy> 1.0 nats.

Prototype-based non-parametric baseline

To evaluate whether the frozen embedding space supports non-parametric family recognition, we implemented a prototype-based inference baseline. A fixed feature extractor (frozen during this experiment) was used to compute L2-normalized embeddings for all images. For each of the 134 families, a class prototype was constructed as the mean of up to 200 support embeddings sampled from the training manifest (support cap = 200 per family). Prototype inference was performed using cosine similarity between a query embedding and all family prototypes, with the predicted family defined as the highest-similarity prototype.

Because cosine similarity scores are not directly comparable across families, we used per-family similarity thresholds to define an accept/reject rule. Thresholds were calibrated on the validation set by sweeping similarity cutoffs from 0.20 to 0.99 in increments of 0.005 and selecting one threshold per family according to the calibration criterion implemented in our pipeline. At inference time, a prediction was accepted only if the top-1 similarity exceeded the threshold associated with the predicted family; otherwise the sample was rejected. Performance is therefore reported using (i) coverage (fraction of accepted samples), (ii) accuracy conditional on acceptance (“accuracy_accepted”), and (iii) accuracy when rejected samples are treated as incorrect (“accuracy_with_reject_as_wrong”), alongside macro-averaged F1. All prototype artifacts (prototype vectors, calibration summaries, per-family F1, and per-image inference audits) were versioned and exported.

Fusion inference experiment

Data split and label space

Fusion inference was evaluated on the mixed-domain validation manifest containing image paths, family labels, and acquisition domains (studio, home, field). The label space comprised 134 molluscan families. Unless a dedicated test manifest was provided, the validation split was reused as the evaluation split to enable direct comparison across head-only, prototype-only, and fused inference under identical inputs and class ordering.

Frozen embedding model and head classifier

All methods used a fixed feature extractor (embedder) to generate a 1408-dimensional embedding per image. Images were decoded and preprocessed through the project pipeline, resized to the embedder input size (384×384), and embedded in batches (default 32). Head predictions were obtained from a trained classifier head operating on the frozen embeddings and producing a 134-way score vector. The head output was row-normalized to obtain a valid probability distribution.

Prototype bundle and cosine-similarity scoring

Prototype representations were loaded from a stored prototype bundle, containing one prototype vector per family (shape 134×1408) and the corresponding ordered class list. Prototype scoring was based on cosine similarity between L2-normalized embeddings and L2-normalized prototype vectors. To enable score-level fusion with the head probabilities, cosine similarities were converted into a probability-like distribution using temperature-scaled exponentiation followed by row normalization:

sc(x) = cos(ẑ(x), c)
pprotoc(x) = exp(sc(x)/T) / k exp(sk(x)/T)

with temperature 𝑇=0.07. “Prototype-only” predictions were computed as arg maxc pprotoc(x)

Domain-wise prototype threshold vectors (precision-calibrated)

Selective use of prototype signals was controlled using per-domain, per-class similarity thresholds obtained from a prior precision-oriented calibration run. Three threshold vectors (one for each domain) were loaded. These vectors define family-specific acceptance criteria used by the fusion rule engine, enabling a conservative gating mechanism based on domain and predicted class.

Rule-based fusion and domain-specific weights

Fusion was implemented as a rule-based score-level combination of head and prototype distributions, with weights dependent on the image domain. For each image, the system computes head probabilities phead(x) and prototype probabilities pproto(x) , and forms a weighted mixture:

pfused(x) = Wh(dphead(x) + Wp(dpproto(x)
where d ∈ {studio, home, field} is the acquisition domain and Wh(d) + Wp(d) = 1 Weights were set to (head/prototype): studio (0.8/0.2), home (0.5/0.5), field (0.95/0.05). Additional rule parameters constrained when prototype evidence could influence the final decision, including minimum prototype margin (0.10) and head-margin thresholds (low = 0.16, high = 0.25). Field-domain label flips were explicitly disabled (enable_field_rare_flip = False) to enforce conservative behavior under the most challenging acquisition conditions.

Acceptance flag (coverage) and selective reporting

In addition to predicting a fused top-1 family label, the fusion rule engine outputs a binary acceptance flag (proto_accepted) indicating whether the prototype evidence satisfied the per-class threshold criterion under the appropriate domain threshold vector. This acceptance flag was used to report (i) coverage (fraction of accepted samples) and (ii) accuracy restricted to accepted samples. Standard top-1 accuracy was reported for head-only, prototype-only, and fused predictions on the full evaluation set to support direct comparison.

Evaluation outputs and reproducibility artifacts

For reproducibility and downstream analysis, the fusion experiment wrote a structured set of artifacts. Random seeds were fixed, and class ordering consistency between labels and prototype bundles was enforced prior to evaluation.

Field-Specialized Head Expert

Objective and experimental design

This step implements a controlled specialization experiment in which a dedicated Field Expert is trained using field imagery only. The embedding network is held fixed, and only the classification head and temperature scaling are optimized. The experiment is positioned as a complement to the domain-balanced generalist, not as a replacement: its purpose is to test whether a field-specific decision boundary improves trust-relevant behavior on real-world field images.

Data sources, filtering, and class set

Training and validation samples were taken from mixed manifests and then hard-filtered to domain == "field". The class set comprised 134 families. The field-only datasets contained 143,536 training images and 25,148 validation images.

A per-class safety cap of 20000 was applied during manifest loading.

Frozen embedding model

All experiments used a pretrained embedding model as a fixed feature extractor (output dimension: 1408). Inputs were resized to 384 × 384, matching the embedder’s expected input geometry.

Model architecture: cosine-normalized head with temperature scaling

The field expert attaches a cosine-consistent classifier head to the frozen embedder. Embeddings are L2-normalized, and the head is implemented as a bias-free dense layer producing logits over the 134 families. A trainable temperature scaling layer is applied prior to softmax to adjust confidence calibration on field data. Two export forms were produced: (i) a head-only model that maps embeddings to probabilities and (ii) a serializable end-to-end model mapping images to probabilities.

Input pipeline and augmentation policy

Data were served through a class-balanced batch generator restricted to the field domain and wrapped in a tf.data pipeline. Conservative throughput and memory settings were used (batch size 6; bounded prefetch and parallel mapping). Random augmentation was enabled for training batches and disabled for validation batches. Mixup was disabled in the baseline run.

Optimization and training protocol

The head was trained using Adam optimization with categorical cross-entropy and label smoothing. The learning rate was 3e-4 for the head-only specialization run and label smoothing was set to 0.05. Training monitored validation accuracy with early stopping (patience 4, best weights restored). The run was configured for 7 epochs, with 7,974 steps per epoch and 1,047 validation steps, derived from the filtered field-only dataset sizes. A brief warm-up epoch (no mixup) was executed to stabilize the pipeline prior to the main training loop.

Results

Domain Router as a Studio–Adaptive Expert Switch

The primary function of the Domain Router in the proposed system is to determine whether an input image should be processed by the original studio-optimized family classifier or by the new domain-adaptive inference pipeline incorporating domain-balanced heads, prototypes, and fusion logic. Rather than acting as a symmetric three-way router, the module is used primarily as a practical expert-selection mechanism: retain the legacy model when the image is confidently identified as studio imagery, and otherwise defer to the adaptive model for home and field conditions.

The Domain Router was trained on a balanced subset of labeled images from the three domains using a frozen embedding model and a shallow classification head. Although the underlying dataset is strongly imbalanced (with studio images dominant), the training setup was designed to encourage non-trivial discrimination across all three domains rather than defaulting to the majority class. On the held-out validation set, the router achieved an overall accuracy of 0.866, with a macro-averaged F1 score of 0.801, indicating that performance is not driven solely by the studio majority.

Per-domain results show an asymmetry that is consistent with differences in visual variability across domains. Field images were classified with high precision and recall (F1 ≈ 0.96), suggesting that field imagery is well separated in the learned embedding space. Studio images achieved extremely high precision (≈ 0.996) but lower recall (≈ 0.83), indicating that a subset of studio images — particularly those that deviate from canonical studio conditions—are more likely to be assigned to a non-studio domain. Home images exhibited the opposite pattern: very high recall (≈ 0.97) but substantially lower precision (≈ 0.37), implying that the router frequently assigns ambiguous samples to the home category. This behavior is broadly consistent with home imagery functioning as an intermediate regime between controlled studio photographs and more heterogeneous field photographs.

Table 1. Domain Router — Validation Classification Report

Precision, recall, F1-score, and support per domain (held-out validation set).

Domain Precision Recall F1-score Support
studio 0.9963 0.8295 0.9053 102,947
home 0.3713 0.9675 0.5366 10,581
field 0.9559 0.9644 0.9601 27,373
Accuracy 0.8661 140,901
Macro avg 0.7745 0.9205 0.8007 140,901
Weighted avg 0.9415 0.8661 0.8883 140,901

The router outputs a probability distribution over {studio, home, field} domains. In the deployed decision logic, this distribution is intended to be converted into a single operational routing decision using a high-confidence studio criterion. When the predicted probability of the studio domain exceeds a chosen threshold and the output entropy is low, the input can be routed to the legacy studio model. In other cases — including uncertain predictions or confident home/field assignments — the image can be processed by the domain-adaptive inference pipeline.

This asymmetric routing policy is motivated by practical risk considerations. Routing non-studio images to the legacy model may reduce robustness because it bypasses the adaptation mechanisms intended to handle greater visual variability. Conversely, routing some studio images through the adaptive path is less likely to be harmful, since the adaptive stack is explicitly designed to accommodate broader conditions. Accordingly, the router can be tuned toward conservative studio assignment, favoring the adaptive path when uncertainty is present.

From an operational perspective, this routing policy ensures that:

In summary, the Domain Router functions less as a general-purpose domain classifier and more as a lightweight expert switch that estimates when the system should rely on the original studio-optimized decision boundary versus when to invoke the domain-adaptive inference stack. This framing aligns the router with the system’s core objective: improving robustness under real-world conditions while minimizing disruption to established in-domain performance.

Prototype-Based Family Representation and Inference

To assess whether class-level structure in the frozen embedding space can be exploited independently of a parametric classifier, we evaluated a prototype-based inference scheme in which each family is represented by the mean embedding of its support samples. Prototypes were computed per family using L2-normalized embeddings extracted from the frozen backbone. In addition to a single global prototype per family, domain-specific prototypes were constructed separately for studio, home, and field imagery to capture systematic domain-induced shifts in appearance.

When used as a standalone classifier with cosine similarity, prototype-based inference provided competitive accuracy on accepted predictions in studio and home imagery, but performance on field imagery was limited due to low coverage under the acceptance criterion. Prototype predictions were optionally rejected under a per-family similarity threshold rule; we therefore report coverage and accuracy conditional on acceptance. Overall accuracy (with rejected samples treated as incorrect) and macro-F1 were lower than those of the domain-balanced classifier head, indicating that mean prototypes alone are insufficient to fully capture complex inter-family decision boundaries in this setting.

Performance varied substantially across acquisition domains. Studio images showed the strongest alignment with prototype representations, reflecting the controlled imaging conditions and tight clustering of embeddings within families. Home images exhibited moderate degradation, consistent with increased background variability and pose differences. Field images remained the most challenging: although prototype similarity often identified a plausible neighborhood of related families, top-1 accuracy and macro-F1 were substantially lower, indicating that field-domain embeddings are more dispersed and less well approximated by a single centroid per family.

Despite these limitations, domain-specific prototypes revealed interpretable structure, with studio, home, and field centroids often occupying distinct regions of the embedding space within a family. This observation supports the use of domain-conditioned prototype sets rather than a single global representation when domain effects introduce systematic shifts in appearance.

Compared to the classifier head, prototype similarity scores tended to be less extreme, which can be advantageous when combining signals in downstream fusion. However, statements about calibration quality and overconfidence require dedicated calibration analyses (e.g., reliability diagrams, ECE/NLL) and are therefore not inferred solely from accuracy/F1 metrics reported here.

Taken in isolation, prototype-based inference does not outperform supervised classification and is not intended to replace it. Instead, these results demonstrate that family-level prototypes capture complementary geometric information in the frozen embedding space. They provide a non-parametric, domain-aware similarity measure that remains stable under domain shift and preserves meaningful neighborhood structure even when classification accuracy is limited.

Table 2. Prototype-Based Inference — Validation/Test Results

Metrics are reported with an accept/reject rule. Coverage is the fraction of samples accepted. Accuracy (accepted) is computed only on accepted samples. Accuracy (reject = wrong) treats all rejected samples as incorrect.

Domain N Accepted (N) Coverage Accuracy (accepted) Accuracy (reject = wrong) Macro-F1
Overall 150,739 104,092 0.6905 0.9237 0.6379 0.4971
Studio 115,243 95,420 0.8280 0.9236 0.7648 0.5828
Home 10,348 7,186 0.6944 0.9576 0.6650 0.2456
Field 25,148 1,486 0.0591 0.7645 0.0452 0.0411

Fusion Inference: Combining Classifier and Prototype Signals

Having established that the parametric classifier head and prototype-based inference capture complementary properties of the frozen embedding space, we next evaluated a fusion inference strategy that combines both signals at score level. The objective of fusion is not to replace either component, but to exploit their respective strengths: the discriminative power of the supervised head and the geometric consistency of prototype similarity, particularly under domain shift.

For each input image, the system computes (i) class posterior probabilities from the domain-balanced classifier head and (ii) cosine similarity scores to the relevant set of family prototypes (global and domain-specific, as selected by the Domain Router). These two signals are combined using a weighted linear fusion:

\[ s_{\text{fused}} = W_p \cdot s_{\text{proto}} + W_h \cdot s_{\text{head}} \]
with \[ W_p + W_h = 1\] Unless stated otherwise, equal weights W p = W h = 0.5 W_p = W_h = 0.5 were used as a default, with optional per-domain tuning evaluated on validation data.

For each image, embeddings were extracted using the fixed embedder, head probabilities were computed from the trained head, and prototype scores were obtained by computing cosine similarity to the family prototypes and converting similarities into a probability-like distribution via temperature-scaled exponentiation (temperature = 0.07) followed by row normalization. Fusion was then performed using a rule-based mechanism that combines head and prototype signals with domain-dependent weights and an acceptance gate driven by per-domain, per-class prototype thresholds calibrated for precision (Step4A2 threshold vectors).

Using the selected configuration (weights: studio 0.8 head / 0.2 proto, home 0.5 / 0.5, field 0.95 / 0.05; rule parameters: minimum prototype margin 0.10, head margin low 0.16, head margin high 0.25, epsilon threshold buffer 0.00, and field flipping disabled), fusion produced a small but consistent improvement in top-1 accuracy over head-only evaluation on the same validation split (150,739 images). Overall accuracy increased from 0.7539 (head) to 0.7557 (fused), an absolute gain of +0.0018. Prototype-only accuracy under the same evaluation setup was 0.7030, substantially below the head, confirming that prototypes alone do not match the discriminative performance of the supervised head in this setting.

The net effect of fusion was highly selective. Fused predictions differed from head-only predictions for only 0.29% of samples (changed_rate 0.00294), indicating that the rule system behaves conservatively and intervenes only when prototype evidence is sufficiently strong under the calibrated thresholding logic. Among changed cases, fusion corrected 339 head errors (help cases) while introducing 66 new errors (hurt cases), yielding a net improvement of +273 samples. This “help > hurt” pattern supports the interpretation that prototype similarity can act as a targeted stabilizing signal rather than a wholesale replacement of the learned decision boundary.

Domain-stratified results show that the gains are concentrated in studio and home imagery, while the field domain remains effectively unchanged under the selected conservative policy. Studio accuracy increased from 0.8606 (head) to 0.8626 (fused), and home accuracy increased from 0.8049 to 0.8088. In contrast, field accuracy was 0.2438 for both head and fused predictions, consistent with an explicit design choice to disable field-domain flips in this configuration (changed_rate 0.0000 in field). Prototype-only performance was markedly lower in field (0.1121) than in studio (0.8264) and home (0.7657), reinforcing that prototype discrimination in the field domain is currently insufficient to justify aggressive fusion interventions.

In addition to top-1 accuracy, the fusion pipeline provides an operational acceptance mechanism. The rule engine outputs a binary acceptance flag (proto_accepted), reflecting whether prototype evidence meets the per-class threshold criteria under the corresponding domain. Under the chosen configuration, the overall acceptance/coverage rate was 0.4581, with strong domain differences: 0.5437 in studio, 0.5483 in home, and 0.0287 in field. Conditional on acceptance, fused accuracy was high overall (0.9811) and remained high within each domain (0.9820 studio; 0.9833 home; 0.8890 field), indicating that when the prototype gate triggers, it tends to do so in relatively unambiguous cases. However, the extremely low field coverage underlines that this mechanism currently provides limited practical leverage for field images.

Taken together, these results indicate that fusion can yield measurable but modest improvements over a strong head-only baseline by applying prototype information in a conservative, precision-oriented manner. The intervention rate is low, but when intervention occurs it is more often beneficial than harmful. The primary limitation remains the field domain: prototype-only discrimination is weak and the conservative fusion policy (as configured here) does not alter field predictions, leaving field performance bounded by the head. This supports the broader conclusion that prototype signals are most useful as a stabilizing auxiliary cue under mild-to-moderate domain shift (studio/home), while robust improvements for highly variable field conditions will require stronger field prototypes, different acceptance policies, or additional adaptation mechanisms.

Table 3. Comparison of head-only, prototype-only, and fusion inference (validation split)

Results are computed on the same validation set (N = 150,739; 134 families). “Coverage” corresponds to the rule-engine acceptance flag (proto_accepted). “Fused accuracy (accepted)” is computed only on accepted samples. For head-only and prototype-only baselines, coverage/accepted metrics are not applicable.

Inference method Domain N Accuracy Coverage Fused accuracy (accepted) Notes
Head only Overall 150,739 0.7539 Domain-balanced classifier head (baseline)
Studio 115,243 0.8606 Strong in-domain performance
Home 10,348 0.8049 Moderate domain shift
Field 25,148 0.2438 Most challenging domain
Prototypes only Overall 150,739 0.7030 Cosine similarity to family prototypes (temperature = 0.07)
Studio 115,243 0.8264 Closer alignment with prototype geometry
Home 10,348 0.7657 Degradation under variability
Field 25,148 0.1121 Weak discrimination under field conditions
Fused (rule-based) Overall 150,739 0.7557 0.4581 0.9811 Domain-dependent weights; precision-calibrated prototype thresholds
Studio 115,243 0.8626 0.5437 0.9820 Weights: head/proto = 0.8/0.2
Home 10,348 0.8088 0.5483 0.9833 Weights: head/proto = 0.5/0.5
Field 25,148 0.2438 0.0287 0.8890 Field flips disabled in this configuration; weights = 0.95/0.05

Notes: Accuracy values are top-1. Coverage and “Fused accuracy (accepted)” are reported only for the fused method because acceptance is defined by the rule engine’s prototype gate. Domain sizes reflect the validation manifest.

Field Expert Head Specialization

The training split contained 143,536 images and the validation split contained 25,148 images across 134 families. The model was trained at 384 × 384 resolution with batch size 6 and conservative tf.data settings. An inline warm-up epoch (no mixup) executed successfully, reaching val_acc = 0.4263 and val_top3 = 0.5769, supporting correct end-to-end execution before full training.

Across seven epochs of head-only optimization, validation top-1 accuracy increased into the mid-0.47 range while validation top-3 accuracy approached approximately 0.64. The best validation top-1 accuracy occurred at epoch 6 (val_acc = 0.4747). Validation top-3 accuracy peaked at epoch 7 (val_top3 = 0.6388). Training accuracy remained in the 0.54–0.55 range, yielding a modest train–validation gap consistent with field-domain ambiguity and nuisance variation rather than pronounced overfitting.

Table 4. Step 4F v01 field-only training summary (134 families; 384×384; batch size 6). Best values in the validation columns are highlighted.
Epoch Train acc Val acc Train top-3 Val top-3 Train loss Val loss
1 0.5368 0.4551 0.6907 0.6226 2.3092 2.6519
2 0.5363 0.4600 0.6830 0.6273 2.3230 2.6337
3 0.5394 0.4733 0.6852 0.6334 2.3033 2.5655
4 0.5402 0.4628 0.6899 0.6246 2.2862 2.5967
5 0.5455 0.4683 0.6921 0.6316 2.2732 2.5770
6 0.5467 0.4747 0.6953 0.6366 2.2560 2.5861
7 0.5463 0.4674 0.6973 0.6388 2.2553 2.5574

The cosine head used temperature scaling; the notebook reported a post-training scale of approximately 38.0, consistent with normalized-logit classifiers. Qualitative probes indicated a broad prediction distribution on field validation imagery (e.g., 77 unique predicted classes among a 200-sample probe), arguing against collapse to a small subset of dominant families. In a small qualitative sample, predicted confidences were frequently moderate rather than uniformly extreme, consistent with the difficulty of field imagery (background clutter, lighting variation, and partial views). These observations are descriptive; robust conclusions about calibration and trust trade-offs require explicit acceptance/coverage curves and reliability metrics.

This step demonstrates stable convergence and credible field-only validation accuracy under a frozen representation. However, its acceptance criterion is comparative and trust-oriented (accepted precision at fixed thresholds, high-confidence error rate, and calibration reliability versus the domain-balanced generalist).

Discussion

Prior work established a practical baseline for domain generalization in molluscan family recognition: a studio-trained backbone can be retained as a fixed representation, and a substantial portion of the domain gap can be recovered by adapting only the decision boundary and its calibration via head retraining [12]. The present study reinforces this conclusion. Across the mixed-domain validation set, the domain-balanced parametric head remains the primary source of discriminative performance, while additional non-parametric signals provide only marginal incremental benefit once a strong head baseline is in place. Prototype-only inference underperforms the head overall, and rule-based fusion alters predictions for only a very small fraction of samples, yielding a net accuracy gain that is small relative to the added methodological and operational complexity.

This outcome has direct implications for deployment. Although prototypes and fusion can, in principle, inject geometric consistency and conservatism into the decision process, the empirical gains observed in the evaluated configuration were not commensurate with the maintenance burden introduced in a production system (artifact versioning, per-domain threshold calibration, rule tuning, and ongoing regression testing across an evolving label set). IdentifyShell is a continuously maintained service, and any inference component must be evaluated not only on offline validation improvements but also on long-term operational cost: the number of additional moving parts, the frequency with which calibration must be revisited as data distributions evolve, and the increased risk of pipeline fragility under routine updates. Under these constraints, prototype and fusion logic were not adopted in the deployed inference path.

This decision should not be interpreted as evidence that prototype mechanisms are ineffective in principle, nor that combining heterogeneous signals cannot improve reliability [4]. Rather, it clarifies the relative returns once decision-boundary adaptation has already been implemented: head adaptation accounts for the largest share of recoverable performance under domain shift, while conservative fusion — at least in the precision-oriented regime evaluated here — acts primarily as a low-frequency corrective mechanism with limited effect on the most challenging domain. Field imagery remains the dominant unresolved source of error, and in the conservative configuration used here fusion does not materially alter field outcomes. Consequently, the central remaining problem is not whether auxiliary signals can marginally refine predictions in easier regimes, but how to achieve robust improvements under strong field shift without introducing disproportionate system complexity.

Figure 1. Domain-router–guided two-expert family inference within the IdentifyShell hierarchy. An identification request is initiated via the /identifyHierarchy endpoint, which orchestrates hierarchical prediction (family → genus → species). For the family stage, the image is forwarded to the /predict endpoint, where a lightweight Domain Router estimates the acquisition domain. A conservative defer rule is applied: if the router assigns studio probability ≥ 0.8, the system uses the legacy studio family expert; otherwise, it uses the domain-balanced generalist family expert. The selected family model returns a top-k family distribution to the hierarchical pipeline, which then activates the appropriate downstream genus and species models. Solid arrows denote request/control flow; dashed arrows denote returned prediction outputs.


A key practical design decision in the deployed system is to treat domain recognition primarily as an expert-selection problem rather than as an end in itself. The Domain Router is therefore used to implement a conservative mixture-of-experts policy: when an input is confidently classified as studio, inference is delegated to the legacy studio-optimized expert; otherwise, inference defaults to the domain-balanced generalist. This asymmetric routing rule is aligned with the risk profile of the application. Routing truly non-studio images into the legacy expert is likely to amplify domain-gap failure modes (miscalibration and decision-boundary mismatch), while routing a subset of studio images through the generalist is typically lower-risk because the generalist was explicitly trained to tolerate broader appearance variation.

This strategy follows the classical mixture-of-experts formulation, in which a lightweight gating function selects among specialists trained for different regions of the input space. Early work introduced gating networks that learn to assign inputs to “local experts” to improve performance under heterogeneous data distributions [3]. More recent large-scale variants emphasize conditional computation and sparse expert activation, reinforcing the idea that selective specialization can deliver robustness and efficiency when expert selection is reliable [11]. In this context, the router’s role is not to perfectly label every image as studio/home/field; instead, it is to identify a high-precision subset of studio-like inputs for which the legacy model’s decision boundary and calibration remain optimal, while directing all remaining inputs to the adaptive pathway.

Operationally, this mixture-of-experts design provides three advantages. First, it preserves backwards-compatible peak performance on canonical studio images by default, avoiding regressions that can occur when a single unified model is forced to compromise across domains. Second, it confines additional complexity (domain-balanced head, optional adaptation components) to the subset of inputs most likely to benefit from it, reducing computational and maintenance overhead relative to always-on adaptation. Third, it enables explicit tuning of the studio-confidence threshold as a deployment control knob: the threshold can be raised to prioritize precision in selecting the legacy expert (minimizing harmful misroutes), or lowered to increase the fraction of images handled by the studio expert when operational constraints require it. The remaining limitation is intrinsic to mixture-of-experts systems: incorrect routing can dominate downstream error, so the router should be calibrated and monitored as a first-class component rather than treated as an auxiliary classifier [3].

A dedicated Field Expert was evaluated as a controlled specialization experiment, in which a field-only classification head (with temperature scaling) was trained on top of the frozen backbone using only field imagery. The motivation for this expert was straightforward: if field images form a sufficiently distinct regime, a field-specialized decision boundary could, in principle, improve trust-relevant behavior (e.g., fewer high-confidence errors or better calibration) beyond what a single domain-balanced generalist can achieve.

In comparative evaluation, however, the field-specialized head did not provide a meaningful advantage over the domain-balanced generalist under the operational success criteria. Any observed differences were either negligible, restricted to narrow subsets, or did not translate into a clear improvement in trust-oriented metrics at deployment-relevant thresholds. As a result, the additional expert was not retained in the inference pipeline. This choice reflects an explicit engineering trade-off: adding a third expert introduces ongoing maintenance costs (additional checkpoints, calibration tracking, regression testing, and router-dependent failure modes) and increases system complexity, and those costs are difficult to justify without a robust and repeatable gain on the target field use-case.

Consequently, the deployed architecture remains a two-expert configuration: the legacy studio expert is invoked only under high-confidence studio routing, while the domain-balanced generalist serves as the default for non-studio and uncertain cases. This preserves the key benefit of specialization where it is clearly justified (studio), while avoiding an additional expert whose incremental value does not offset operational overhead.

Within the IdentifyShell hierarchy, family-level prediction is not merely an intermediate label but an operational routing decision that determines which downstream genus- and species-level specialists are evaluated. In such cascaded systems, an incorrect family assignment constitutes a hard failure: it either prevents the correct downstream model from being invoked or routes the input to an incompatible specialist whose label space excludes the true class [13]. Consequently, improvements at the family stage have a multiplicative effect on end-to-end performance, because the probability of a correct final identification is bounded above by the probability that the correct family pathway is activated in the first place. This framing shifts evaluation emphasis from family accuracy as an isolated metric toward family robustness as a prerequisite for reliable system behavior under real-world deployment conditions.

The present design choices align with this gatekeeper role. The domain router combined with a two-expert strategy (legacy studio expert for high-confidence studio cases; domain-balanced generalist otherwise) can be interpreted as risk-managed routing for hierarchical inference. In practice, the router reduces exposure to known failure modes: it minimizes the chance that non-studio inputs are processed by a studio-optimized decision boundary, while still preserving the validated studio pathway when the input is confidently in-domain. This asymmetry is particularly important for hierarchical pipelines because the cost of a routing mistake is not symmetric. A non-studio image incorrectly treated as studio risks a brittle family prediction that cascades into an incorrect genus/species branch. By contrast, sending a subset of studio-like images through the domain-balanced generalist typically incurs less systemic risk, because the generalist is explicitly trained to tolerate broader variability and its output remains compatible with the downstream hierarchy.

Even without reporting genus/species results in this study, the architectural implication is clear: the primary objective of domain-robust family inference is to maximize the probability that downstream specialists are queried within the correct taxonomic neighborhood for real user images. This is a deployment-centric criterion: stable family routing enables consistent activation of the appropriate genus/species models, supports confidence-based rejection policies upstream (e.g., abstaining before triggering a downstream branch), and reduces the propagation of early-stage errors that would otherwise dominate system-level failure analysis. Future work can quantify these effects explicitly by measuring end-to-end identification accuracy and error propagation under alternative routing policies, but the gatekeeper interpretation already provides a principled rationale for prioritizing family robustness and conservative routing in mixed-domain usage.

References