# L4 Synthetic overlap pilot

Status: initial construction test ready for review. [Result page](../results/l4/) and [generation code](l4_overlap.py). The three 512 × 512 composites use the two assistant-traced candidates from GC104890a field 8, focal plane zero. The second candidate is rotated 0°, 45° or 90° before opaque compositing over uniform intensity 145. The contours are provisional and the same source field is used twice.

The locally tested diatom YOLO detector returned zero boxes on all three inputs at confidence 0.05 and input size 512. Its detector outputs are in [predictions.json](../results/l4/predictions.json). The [inference script](l4_evaluate.py) requires the temporary model and environment documented in R3. This is not a recall test and does not show that synthetic training helps. The background is unrealistically uniform, overlap obscures the lower object, and rough boundaries can introduce artificial seams. No training was run.

Promising follow-up: select real training-only backgrounds and independent expert-confirmed cutouts, test transparent or physically motivated blending, and compare augmentation against the same model trained without composites. Preserve true visible and full-object masks separately. Evaluate on held-out real overlap groups rather than synthetic examples.

## Real-background blending comparison

A second development check uses the same two candidate cutouts and a real 512 × 512 background from GC105196a field 8, plane 1. The foreground masks come from the box-prompted MobileSAM experiment in R6, which used provisional assistant contours. The background contains existing material, including a partial diatom at its left edge, and was not certified empty. One arrangement places the inserted cutouts separately and another makes them cross. Each arrangement is rendered with opaque replacement and with a simple local-intensity-ratio multiplication as a rough transparency approximation. These are not calibrated optical simulations. The input images, inserted-object boxes and detector output are in `results/l4/blending-*.png` and `blending-predictions.json`; [view the comparison](../results/l4/).

At confidence 0.05 the public diatom YOLO model returned one box for each separated arrangement and zero for each crossing arrangement. These four examples use only two foreground objects, one background and one detector. The source masks, blending artifacts, occlusion and model domain shift are confounded, so this is a debugging observation rather than evidence about performance on real overlaps or synthetic training. The inserted boxes represent the full source masks and do not describe the visible region after occlusion. No model was trained.

Reproduce with `YOLO_CONFIG_DIR=/tmp/diatom-yolo-config MPLCONFIGDIR=/tmp/mpl-diatom PYTHONDONTWRITEBYTECODE=1 /tmp/diatom-research-venv/bin/python research/l4_blending.py`. It requires the model file and environment described in R3 and the R6 mask files. Next generate examples from multiple independent specimens and confirmed backgrounds, check whether composites resemble held-out real crossings, then measure training benefit on real reviewed images.

## Synthetic two-instance prompt check · 2026-11-30

Reconstruct the two inserted source masks in each of the four blending images and choose one oracle point per object in the thickest region exclusive to that mask. Prompt MobileSAM separately for each target, first with the target point only, and then with the other object's point as a negative prompt. [View all masks](/results/l4/prompt-instances.html) and [download measurements](/results/l4/prompt-instances.json). The same two cutouts and background are used in every example; these are deliberately selected synthetic inputs, not independent real examples.

For the two separate configurations, positive-only IoU against the inserted masks was 0.95–0.97. For the opaque crossing, the two full inserted-mask IoUs were 0.30 and 0.83; with the other negative point they were 0.28 and 0.67. Since the second inserted object obscures part of the first in opaque compositing, recovery of its complete hidden mask is not a fair visible-mask target. Scoring the first object only on its unoccluded inserted pixels gives IoU 0.63 positive-only and 0.63 with the negative point; the second remains 0.83 and 0.67. For the multiply-blended crossing, full-source-mask IoUs were 0.31 and 0.20, falling to 0.29 and 0.11 with the negative point. Multiply blending is not calibrated to real transparency and does not provide a clean visible-mask target.

In the opaque crossing, negative prompts reduced overlap between the two predicted masks from 412 pixels to zero, while also decreasing fit to the front mask. The source masks overlap by 6,531 pixels, so disjoint output alone is not evidence of correct separation. This reinforces a need to evaluate both instance recovery and the visible or amodal mask definition, rather than rewarding disjointness by itself. Points were derived from known synthetic masks and do not simulate detection or ordinary analyst effort. Existing mask errors, synthetic seams, the fixed layout and possible non-diatom backgrounds restrict interpretation. No model was trained.

Reproduce after the blending images are generated: `YOLO_CONFIG_DIR=/tmp/diatom-yolo-config MPLCONFIGDIR=/tmp/mpl-diatom /tmp/diatom-research-venv/bin/python research/l4_prompt_instances.py`. Requires `/tmp/mobile_sam.pt` and the R6 source masks. Follow up on expert-verified real crossing groups with separately marked visible and, only if supportable, inferred full-object extents.
