Closed crvogt closed 5 years ago
No, you cant use numpy methods in a Lambda layer.
This makes sense, I assume it would disconnect the graph. Would the solution be to create two separate models? I guess it depends on if I can use numpy methods on an input. Ideally, I'd be able to take the output from one model, run some operation on it not native to keras, and set that as the input to the next model, and both models would be trained.
That would break the backprop. Soultion would be to rewrite the function using Keras/TF Ops.
Yes, coming from matconvnet I'd been hoping there was a way around the backprop issue. But now that you mention it, quick search yields tf.contrib.image.dense_image_warp which should do what I want. Thanks for taking the time :)
I'm using a network composed of two separate CNNs; the first outputs a depth map. Before the second, I have a lambda layer that takes the depth map and a regular 3 channel image as input and warps it, returning the warped image. The warping function uses RectBivariateSpline.
My trouble lies in trying to pass channels to RectBivariateSpline, I'm getting the sense that the operation is illegal, ie, RectBivariateSpline won't accept a tensor. So either I'm doing the lambda layer wrong, or I need to split the model into two submodels? Some direction would be very appreciated.