我正在尝试在 MPSNNGraph 上输入两个图像。
但是,即使我在“withSourceImages”上输入了一个类似 [input1, input2] 的数组,我也只能输入“input1”作为输入图像。理想情况下,当创建如下图时,我想将“inputImage1”设为“input1”,将“inputImage2”设为“input2”。
实际上,当我像这样运行它并查看“concat”的结果时,我能够看到连接的是“input1”,而不是“input2”。
该图如下所示:
let inputImage1 = MPSNNImageNode(handle: nil)
let inputImage2 = MPSNNImageNode(handle: nil)
let scale = MPSNNBilinearScaleNode(source: inputImage1,
outputSize: MTLSize(width:256,
height: 256,
depth: 3))
let scale2 = MPSNNBilinearScaleNode(source: inputImage1,
outputSize: MTLSize(width:64,
height: 64,
depth: 3))
...
let concat = MPSNNConcatenationNode(sources: [conv3.resultImage, scale2.resultImage])
...
if let graph = MPSNNGraph(device: commandQueue.device,
resultImage: tanh.resultImage,
resultImageIsNeeded: true){
self.graph = graph
}
和编码图的一部分看起来像:
let input1 = MPSImage(texture: texture, ...)
let input2 = MPSImage(texture: texture2, ...)
graph.executeAsync(withSourceImages: [input1, input2]) { outputImage, error in
...
}
如何输入第二个输入并且图形接收它?
你能给我一些建议吗?