def folder(self, folder, limit):
"""
:param folder: Name of the folder containing images
:type folder: str
:param limit: Number of images to be read from given folder
:type limit: int
:return: List of descriptors of the given images
:rtype: np.array
"""
files = glob.glob(folder + "/*.jpg")[:limit]
with ProcessPoolExecutor() as executor:
futures = executor.map(self.image_file, files)
futures = tqdm.tqdm(futures, total=len(files), desc='Calculating descriptors')
descriptors = [f for f in futures]
# descriptors = [self.image_file(file) for file in files]
descriptors = list(filter(lambda x: x is not None, descriptors))
return np.concatenate(descriptors)
评论列表
文章目录