tucan9389 / TFLiteSwift-Vision

Apache License 2.0
38 stars 1 forks source link

Support multiple image input (for style transfer task) #28

Closed tucan9389 closed 2 years ago

tucan9389 commented 3 years ago

candidate

with Data array ✅

// preprocessing
let imageData1 = try interpreter.preprocess(with: image1)
let imageData2 = try interpreter.preprocess(with: image2)
let imageDataArray: [Data] = [imageData1, imageData2]

// inference
let outputs = try interpreter.inference(with: imageDataArray)

with image array

let images: [UIImage]
// let images: [CGImage]
// let images: [CVPixelBuffer]
// let images: [Any]
let outputs = try interpreter.inference(with: images)

with dictionary

let indexToImages: [Int: Any]
let outputs = try interpreter.inference(with: indexToImages)

with and label in method's argument

let outputs = try interpreter.inference(with: inputImage, and: styleImage)
let outputs = try interpreter.inference(with: inputImage, and: styleImageData)