How to extract foreground region feature vectors

2007_000129 2007_000129
I have obtained the feature map of the original through resnet101, and I have converted the segmentation result to an array of 01(The foreground pixel is 1 and the background pixel is 0).
And then I dot the 01 array with the feature map to see if I can get the foreground feature vectors?