MPSNNGraph に 2 つの画像を入力しようとしています。
しかし、「withSourceImages」に[input1,input2]のような配列を入力しても、入力画像として「input1」しか入力できません。理想的には、以下のようなグラフを作成する場合、「inputImage1」を「input1」、「inputImage2」を「input2」としたいと思います。
実際にこのように実行して「concat」の結果を見てみると、「input2」ではなく「input1」が連結されていることがわかりました。
グラフは次のようになります。
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
...
}
2 番目の入力を入力して、グラフがそれを受け取るにはどうすればよいですか?
アドバイスをいただけますか?