CoreML-Models.

August 12, 2020 · View on GitHub

Models you can use them on iOS.

Image Classifier

Google Drive LinkSizeOriginal Project
Efficientnetb022.7 MBTensorFlowHub

GAN

Google Drive LinkSizeOriginal Project
UGATIT_selfie2anime1.12GBtaki0112/UGATIT
AnimeGANv2_Hayao 8.7MBTachibanaYoshino/AnimeGANv2
AnimeGANv2_Paprika 8.7MBTachibanaYoshino/AnimeGANv2
スクリーンショット 2020-05-19 11 09 03

How to use in a xcode project.


import Vision
lazy var coreMLRequest:VNCoreMLRequest = {
   let model = try! VNCoreMLModel(for: modelname().model)
   let request = VNCoreMLRequest(model: model, completionHandler: self.coreMLCompletionHandler)
   return request
   }()

let handler = VNImageRequestHandler(ciImage: ciimage,options: [:])
   DispatchQueue.global(qos: .userInitiated).async {
   try? handler.perform([coreMLRequest])
}

For visualizing multiArray as image, Mr. Hollance’s “CoreML Helpers” are very convenient. CoreML Helpers

Converting from MultiArray to Image with CoreML Helpers.

func coreMLCompletionHandler(request:VNRequest?、error:Error?){
   let = coreMLRequest.results?.first as!VNCoreMLFeatureValueObservation
   let multiArray = result.featureValue.multiArrayValue
   let cgimage = multiArray?.cgImage(min:-1、max:1、channel:nil)

Apps made by Core ML models. AnimateU