In the context of caption generation, feature vectors are obtained from images using a convolutional neural network (CNN). The CNN extracts features from the image, such as edges, shapes, and textures, and represents them as a numerical vector. This vector is then used as input to the GRU, which generates a sequence of words that form the caption.