Skip to main content
. 2025 Dec 18;25(24):7678. doi: 10.3390/s25247678
Algorithm 1: YOLO-SAM AgriScan: Bounding-box-prompted ripe strawberry segmentation

Input: Input image set I={I1,I2,,IN}

Output: Segmentation masks M={M1,M2,,MN}

  •   1

    Step 1: Detection

  •   2

      Freeze backbone layers θf, train detection head θt

  •   3

      For each image IkI:

  •   4

        Predict Bboxes B^k=fθ(Ik)

  •   5

        where B^k={bk,1,bk,2,,bk,m}

  •   6

    Step 2: Segmentation

  •   7

      Encode image: Ek=ϕimg(Ik)

  •   8

      Encode prompts (Bboxes): Pk=ϕprompt(B^k)

  •   9

      Decode segmentation masks: M^k=ϕmask(Ek,Pk)

  • 10

    Output

  • 11

      Return M={M^1,M^2,,M^N}