Exemplo n.º 1
0
    def compute_gallery_embeddings(self):
        ''' Computes embedding vectors for the gallery images. '''

        images = []

        for full_path in tqdm(self.impaths, desc='Reading gallery images.'):
            image = cv2.imread(str(full_path))
            if image is None:
                log.error("Cannot process image, full_path =", str(full_path))
                continue
            image = crop_resize(image, self.input_size)
            images.append(image)

        embeddings = np.vstack([
            self.model.predict(image)
            for image in tqdm(images,
                              desc='Computing embeddings of gallery images.')
        ])

        return embeddings
Exemplo n.º 2
0
    def compute_embedding(self, image):
        ''' Takes input image and computes embedding vector. '''

        image = crop_resize(image, self.input_size)
        embedding = self.model.predict(image)
        return embedding