INNER CODE UNIT · Python

__hash__

BrokenSource/DepthFlow · depthflow/estimators/__init__.py:20

    def __hash__(self) -> int:
        """Deterministic hash for current settings"""
        ...

    def estimate(self, image: np.ndarray) -> np.ndarray:
        hasher = xxhash.xxh3_64()
        hasher.update(self.__hash__().to_bytes(8))
        hasher.update(image.tobytes())
        key: int = hasher.intdigest()

        # Grab only rgb channels
        if (image.shape[-1] == 4):
            image = image[..., :3]

        # Avoid expensive methods when cached
        if (depth := DEPTHMAPS.get(key)) is None:
            self.load_model()
            depth = self._estimate(image)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…