Computer Vision News - April 2022

16 Computer Vision Tool square = 4 ix = 1 for _ in range(square): for _ in range(square): # specify subplot and turn of axis ax = pyplot.subplot(square, square, ix) ax.set_xticks([]) ax.set_yticks([]) # plot filter channel in grayscale pyplot.imshow(feature_maps[0, :, :, ix-1], cmap='gray') ix += 1 # show the figure pyplot.show() Check one of the Convolutional Layers # load the model again model = VGGFace(model='resnet50') # redefine model to output right after the fifth hidden layer model = Model(inputs=model.inputs, outputs=model.layers[6].output) model.summary() # load the image with the required shape img = extract_face # convert the image to an array img = img_to_array(img) # expand dimensions so that it represents a single 'sample' img = expand_dims(img, axis=0) # prepare the image (e.g. scale pixel values for the vgg) img = preprocess_input(img) # get feature map for first hidden layer feature_maps = model.predict(img) # plot all 4 maps in an 4x4 squares square = 4 ix = 1 for _ in range(square): for _ in range(square): # specify subplot and turn of axis ax = pyplot.subplot(square, square, ix) ax.set_xticks([]) ax.set_yticks([]) # plot filter channel in grayscale pyplot.imshow(feature_maps[0, :, :, ix-1], cmap='gray') ix += 1 # show the figure pyplot.show() Wrapping up I hope that you enjoyed another month of coding! Let’s keep as always connected and don’t forget to explore each month’s articles from the amazing colleagues, learn from the news and understand the scientists behind the brilliant publications and projects by reading our interviews.

RkJQdWJsaXNoZXIy NTc3NzU=