Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Foundation Models frameworkで画像分析

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

Foundation Models frameworkで画像分析

WWDC26 Recap - Japan-\(region).swift
https://luma.com/x230s9i1

Avatar for リョウ

リョウ

July 18, 2026

More Decks by リョウ

Other Decks in Programming

Transcript

  1. Foundation Models frameworkͷը૾ೖྗ let session = LanguageModelSession() let response =

    try await session.respond { "͜ͷը૾ʹ͍ࣸͬͯΔं྆ʹ๨Ε෺͕ͳ͍͔ڭ͑ͯɻ" Attachment(image) } let content = response.content ͜ͷं྆ͷલΧΰʹ͸ࠇ͍ϦϡοΫ͕ೖ͍ͬͯ·͢ɻ
  2. Guided Generation @Generable struct ForgottenItemPresence { @Guide(description: "ं྆ʹ๨Ε෺͕͍ࣸͬͯΔ͔") let hasForgottenItem:

    Bool } let session = LanguageModelSession() let response = try await session.respond( generating: ForgottenItemPresence.self ) { "͜ͷը૾ʹ͍ࣸͬͯΔं྆ʹ๨Ε෺͕ͳ͍͔ڭ͑ͯɻ" Attachment(image) } let hasForgottenItem = response.content.hasForgottenItem true
  3. ධՁ var dataset: ArrayLoader<ModelSample<Bool>> { ArrayLoader(samples: [ ModelSample( prompt: Prompt

    { "͜ͷը૾ʹ͍ࣸͬͯΔं྆ʹ๨Ε෺͕ͳ͍͔ڭ͑ͯɻ" Attachment(imageURL: withLuggageURL) }, expected: true ), ModelSample( prompt: Prompt { "͜ͷը૾ʹ͍ࣸͬͯΔं྆ʹ๨Ε෺͕ͳ͍͔ڭ͑ͯɻ" Attachment(imageURL: withoutLuggageURL) }, expected: false ), ]) }