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

Core ML でiOSアプリはどう変わるのか

Core ML でiOSアプリはどう変わるのか

第二回 合同勉強会 in 福岡での発表資料です

Takaaki Tanaka

August 28, 2017
Tweet

More Decks by Takaaki Tanaka

Other Decks in Technology

Transcript

  1. • ాத ޹໌ (Takaaki Tanaka) • Ϋϥεϝιουגࣜձࣾ • @kongmingtrap •

    Swift / Objective-C / Scala / JavaScript … • GyazSquare / GitHub
  2. VNCoreMLRequest guard let coreMLModel = try? VNCoreMLModel(for: Inceptionv3().model) else {

    fatalError("faild create VMCoreMLModel") } guard let ciImage = CIImage(image: image) else { fatalError("faild convert CIImage") } let request = VNCoreMLRequest(model: coreMLModel) { request, error in guard let results = request.results as? [VNClassificationObservation] else { fatalError("Error faild results") } if let classification = results.first { self.identifierLabel.text = classification.identifier self.confidenceLabel.text = "\(classification.confidence)" } else { print("error") } } let handler = VNImageRequestHandler(ciImage: ciImage, options: [:]) guard (try? handler.perform([request])) != nil else { fatalError("faild handler.perform”) }
  3. VNCoreMLRequest guard let coreMLModel = try? VNCoreMLModel(for: Inceptionv3().model) else {

    fatalError("faild create VMCoreMLModel") } guard let ciImage = CIImage(image: image) else { fatalError("faild convert CIImage") } let request = VNCoreMLRequest(model: coreMLModel) { request, error in guard let results = request.results as? [VNClassificationObservation] else { fatalError("Error faild results") } if let classification = results.first { self.identifierLabel.text = classification.identifier self.confidenceLabel.text = "\(classification.confidence)" } else { print("error") } } let handler = VNImageRequestHandler(ciImage: ciImage, options: [:]) guard (try? handler.perform([request])) != nil else { fatalError("faild handler.perform”) } $PSF.-.PEFMΛࢦఆ
  4. VNCoreMLRequest guard let coreMLModel = try? VNCoreMLModel(for: Inceptionv3().model) else {

    fatalError("faild create VMCoreMLModel") } guard let ciImage = CIImage(image: image) else { fatalError("faild convert CIImage") } let request = VNCoreMLRequest(model: coreMLModel) { request, error in guard let results = request.results as? [VNClassificationObservation] else { fatalError("Error faild results") } if let classification = results.first { self.identifierLabel.text = classification.identifier self.confidenceLabel.text = "\(classification.confidence)" } else { print("error") } } let handler = VNImageRequestHandler(ciImage: ciImage, options: [:]) guard (try? handler.perform([request])) != nil else { fatalError("faild handler.perform”) } $**NBHFΛऔಘ
  5. VNCoreMLRequest guard let coreMLModel = try? VNCoreMLModel(for: Inceptionv3().model) else {

    fatalError("faild create VMCoreMLModel") } guard let ciImage = CIImage(image: image) else { fatalError("faild convert CIImage") } let request = VNCoreMLRequest(model: coreMLModel) { request, error in guard let results = request.results as? [VNClassificationObservation] else { fatalError("Error faild results") } if let classification = results.first { self.identifierLabel.text = classification.identifier self.confidenceLabel.text = "\(classification.confidence)" } else { print("error") } } let handler = VNImageRequestHandler(ciImage: ciImage, options: [:]) guard (try? handler.perform([request])) != nil else { fatalError("faild handler.perform”) } 7/$PSF.-3FRVFTUΛ࡞੒
  6. VNCoreMLRequest guard let coreMLModel = try? VNCoreMLModel(for: Inceptionv3().model) else {

    fatalError("faild create VMCoreMLModel") } guard let ciImage = CIImage(image: image) else { fatalError("faild convert CIImage") } let request = VNCoreMLRequest(model: coreMLModel) { request, error in guard let results = request.results as? [VNClassificationObservation] else { fatalError("Error faild results") } if let classification = results.first { self.identifierLabel.text = classification.identifier self.confidenceLabel.text = "\(classification.confidence)" } else { print("error") } } let handler = VNImageRequestHandler(ciImage: ciImage, options: [:]) guard (try? handler.perform([request])) != nil else { fatalError("faild handler.perform”) } ݁Ռ͕ϋϯυϥʔͰฦͬͯ͘ΔͨΊ ॲཧ͍ͨ͠಺༰Λهड़
  7. VNCoreMLRequest guard let coreMLModel = try? VNCoreMLModel(for: Inceptionv3().model) else {

    fatalError("faild create VMCoreMLModel") } guard let ciImage = CIImage(image: image) else { fatalError("faild convert CIImage") } let request = VNCoreMLRequest(model: coreMLModel) { request, error in guard let results = request.results as? [VNClassificationObservation] else { fatalError("Error faild results") } if let classification = results.first { self.identifierLabel.text = classification.identifier self.confidenceLabel.text = "\(classification.confidence)" } else { print("error") } } let handler = VNImageRequestHandler(ciImage: ciImage, options: [:]) guard (try? handler.perform([request])) != nil else { fatalError("faild handler.perform”) } ը૾ղੳϋϯυϥʔΛ࡞੒͠ QFSGPSN͢Δ
  8. 

  9. mlmodel Core ML Λར༻͢Δʹ͋ͨͬͯɺ۩ମతʹ͸ɺ Keras ΍ Caffe ͷΑ͏ͳػցֶशϑϨʔϜ ϫʔΫ͕ग़ྗͨ͠Ϟσϧ͔Β .mlmodel

    ͱ͍͏ ϑΝΠϧΛ࡞੒͠ɺ͜ΕΛ Xcode ʹΠϯϙʔ τ͠·͢ɻ ҎԼͰ͸ɺ.mlmodel ϑΝΠϧͷ࡞ ੒ํ๏Λݟ͍͖ͯ·͢ɻ
  10. ँࣙ • KerasͰ͸͡ΊΔDeepLearning • http://dev.classmethod.jp/machine-learning/introduction-keras- deeplearning/ • Keras + iOS11

    CoreML + Vision Framework ʹΑΔɺ΋΋Ϋϩإࣝ ผΞϓϦͷ։ൃ • http://qiita.com/kenmaz/items/d416b191f79f60e07752 • 20170818_Xamarinجຊ + MSͷAIαʔϏεʮCustom Vision Serviceʯʹ͍ͭͯ • https://www.slideshare.net/chomado/20170818xamarin-msaicustom- vision-service