in supporting-blog-content/building-multimodal-rag-with-elasticsearch-gotham/src/embedding_generator.py [0:0]
def process_depth(self, depth_paths, device="cpu"):
"""Custom processing for depth maps"""
try:
# Check file existence
for path in depth_paths:
if not os.path.exists(path):
raise FileNotFoundError(f"Depth map file not found: {path}")
# Load and transform
depth_images = [Image.open(path).convert("L") for path in depth_paths]
transform = transforms.Compose(
[
transforms.Resize((224, 224)),
transforms.ToTensor(),
]
)
return torch.stack([transform(img) for img in depth_images]).to(device)
except Exception as e:
logger.error(f"🚨 - Error processing depth map: {str(e)}")
raise