All-breed show120 breedsJudged in Swift

Lineage.

Bring a dog photo into the ring. A classifier head I trained in Swift on 12,000 Stanford Dogs photos judges it against 120 breeds and pins rosettes on its top three guesses. Everything runs in this page; the photo never leaves your browser.

91.1% right first time on 8,580 test photos it never trained on (99.6% within its top five)

The ring

Drop a dog photo in the ring

or drop or paste a photo. It stays on this device.

Or judge a sample exhibit (CC0 photos)

    Pre-judged in Swift. Pick a photo to judge live in your browser.

    Judge's awards

    Best of breed

    For this exhibit, the model's three most likely breeds.

      How the judge did

      Scored once, at the end, on the official Stanford Dogs test split: 8,580 photos the head never saw while it was trained or tuned.

      91.1%top-1: the first rosette is the right breed
      99.6%top-5: the right breed is somewhere in the awards
      A caveat about the judge's past. The backbone was pretrained on ImageNet, and Stanford Dogs was built from ImageNet's dog photos: all 120 breeds are ImageNet classes, and many of these test photos were probably in the backbone's training set. Without any training, ImageNet's own classifier already gets 92.5% of them. So these scores say how well the head reads the backbone, not how well it would do on dog photos the backbone has never seen. Expect lower on your own photos.
      • This head, trained in Swiftsoftmax regression on the backbone's 1280-number embedding91.1%
      • Course notebookEfficientNetV2-B0 + a new Dense(120); its own report, with the test photos as its validation data87.7%
      • ImageNet's classifier, no trainingthe backbone's original output, restricted to the 120 dog classes92.5%
      • Nearest training photosk nearest photos, k = 20, cosine, on the same embeddings89.6%
      • Nearest breed averagecosine similarity to each breed's mean embedding89.9%
      • Always the same breedwhat guessing gets with 120 breeds0.6%

      Lookalikes

      From the judge's notebook: the breed pairs it mixed up most on the test photos. The circled figure counts mix-ups in both directions.

        Breed index

        Every breed in the show with the share of its test photos the judge got right first time. 4 breeds were perfect; the hardest was the Eskimo dog at 58%.

        • 95% or more
        • 85 to 95%
        • 70 to 85%
        • under 70%

          Rules of the show

          How a photo gets from your device to a rosette.

          1. The photo is framed

            The page shrinks it in a canvas, then Swift code compiled to WebAssembly turns the centre 256 by 256 into the network's input. The same Swift prepared the training photos.
          2. The backbone looks

            A pretrained MobileNetV4 (timm, Apache 2.0) runs in ONNX Runtime Web and boils the photo down to 1,280 numbers. Training ran the same file from Swift through ONNX Runtime's C API.
          3. The head judges

            The head turns those numbers into 120 probabilities. It was trained from scratch in Swift: my own gradients, mini-batches, weight decay and early stopping. Its forward pass is the WebAssembly too.
          4. Rosettes are pinned

            The three most likely breeds get rosettes, the next two a highly commended ribbon. A photo of something that isn't one of the 120 breeds still gets awards, so take low numbers as the judge being unsure.