2
は、私が使用可能な任意のオーバーロード
と一致しないエラー引数ラベル '(画像を:)' 取得していますネイティブリアクト
私はこのチュートリアルに従っhereし、リンゴのドキュメンテーションですが、フレームワークとReact Nativeのイメージを橋渡ししようとすると、このエラーが発生しました。 SwiftとReac Nativeの間のブリッジが働いていますが、coreMLを使用しようとしたときにエラーが発生しました
私はそれが新しい迅速な構文とは関係していると思いますが、
import Foundation import CoreML @objc(Printer) class Printer: NSObject { @objc func imageRec(_ image:CGImage) -> CVPixelBuffer? { let model = Inceptionv3(); UIGraphicsBeginImageContextWithOptions(CGSize(width: 299, height: 299), true, 1.0) //image.draw(in: CGRect(x: 0, y: 0, width: 299, height: 299)) let newImage = UIGraphicsGetImageFromCurrentImageContext()! UIGraphicsEndImageContext() let attrs = [kCVPixelBufferCGImageCompatibilityKey: kCFBooleanTrue, kCVPixelBufferCGBitmapContextCompatibilityKey: kCFBooleanTrue] as CFDictionary var pixelBuffer : CVPixelBuffer? let status = CVPixelBufferCreate(kCFAllocatorDefault, Int(newImage.size.width), Int(newImage.size.height), kCVPixelFormatType_32ARGB, attrs, &pixelBuffer) guard (status == kCVReturnSuccess) else { return nil } CVPixelBufferLockBaseAddress(pixelBuffer!, CVPixelBufferLockFlags(rawValue: 0)) let pixelData = CVPixelBufferGetBaseAddress(pixelBuffer!) let rgbColorSpace = CGColorSpaceCreateDeviceRGB() let context = CGContext(data: pixelData, width: Int(newImage.size.width), height: Int(newImage.size.height), bitsPerComponent: 8, bytesPerRow: CVPixelBufferGetBytesPerRow(pixelBuffer!), space: rgbColorSpace, bitmapInfo: CGImageAlphaInfo.noneSkipFirst.rawValue) context?.translateBy(x: 0, y: newImage.size.height) context?.scaleBy(x: 1.0, y: -1.0) UIGraphicsPushContext(context!) newImage.draw(in: CGRect(x: 0, y: 0, width: newImage.size.width, height: newImage.size.height)) UIGraphicsPopContext() CVPixelBufferUnlockBaseAddress(pixelBuffer!, CVPixelBufferLockFlags(rawValue: 0)) guard let prediction = try? model.prediction(image: newImage) else { } } }
R_D_Spend、Administration、およびMarketing_Spendは何か混乱していますか?私はこれをやろうとしましたが、init行だけで同じエラーが発生します。 – codegeek511
R_D_Spend、Administration、Marketing_Spendは私のMLモデルのパラメータです。あなたのMLModelをXcodeで開きます。あなたの代わりにそれを使用しなければならないあなたのmlモデルの入出力パラメータを表示します。 – user3378829
Hmmmパラメータは 'image'です。 – codegeek511