INNER CODE UNIT · Python
_store_image_features
yurijmikhalevich/rclip · rclip/main.py:203
def _store_image_features(
self, paths: List[str], metas: List[ImageMeta], hashes: List[str], images: List[npt.NDArray[np.float32]]
) -> None:
try:
features = self._model.compute_preprocessed_image_features(images, for_indexing=True)
except Exception as ex:
print("error computing features:", ex, file=sys.stderr)
return
for path, meta, file_hash, vector in cast(Iterable[PathMetaVector], zip(paths, metas, hashes, features)):
self._db.upsert_image(
db.NewImage(
filepath=path, modified_at=meta["modified_at"], size=meta["size"], vector=vector.tobytes(), hash=file_hash
),
commit=False,
)
def _does_processed_image_exist_for_raw(self, raw_path: str) -> bool:
"""Check if there is a processed image alongside the raw one; doesn't support mixed-case extensions,