How to access different feature maps created by conv2d layers in tensorflowjs?

15 Views Asked by At

I'm trying to get various feature maps created by the convolutional layers using tensorflowjs. Below is my attempt to obtain different feature maps but they're all the same when plotted. There might be something wrong in the way they're sliced? It'd probably be better if I could slice the tensors directly?

'''

// Apply first 3 conv2d layers to image tensor
var output1 = conv2d_0.apply(image_tensor);
var output2 = conv2d_1.apply(output1);
var output3 = conv2d_2.apply(output2);

// Turn tensor into array with shape = (1,78,78,128)
var array = nj.array(output3.arraySync());

// Slice array, resulting array of shape (1,78,78,1)
var sliced = array.slice(null,null,null,[2,null,3]);
var sliced2 = array.slice(null,null,null,[22,null,23]);
var sliced3 = array.slice(null,null,null,[12,null,13]);
var sliced4 = array.slice(null,null,null,[2,null,3]);

'''

0

There are 0 best solutions below