Hi, I made a CNN model for edge detection task. It worked fine and I can see good results through the Feature maps. the problem is I’m using 4 filters in each convolutional layer, so the output is going to be an image with 4 channels but I need the image to be saved as a 3 channels to work with it later, here an example of the code I used:
#Feed image to model: output = model(my_img) #input size (1, 3, 224, 224) #convert output tensor to numpy fimg = output.detach().cpu().numpy() #get rid of the single batch dimension fimg = fimg.squeeze(0) #swap axes to (13, 13, 4) fimg = fimg.transpose(1, 2, 0)
it’s gonna be saved as (13,13,4) but I need it as (13, 13, 3). If anyone could help it would be appreciated.