Hierarchical-Localization
Hierarchical-Localization copied to clipboard
cv2 resize hangs
With large images, cv2.resize() is called. https://github.com/cvg/Hierarchical-Localization/blob/99676f7a98db0b3e69dc42122de2f972f966f210/hloc/extract_features.py#L100
However this hangs the pytorch dataloader due to a threading issue (see https://stackoverflow.com/questions/54013846/pytorch-dataloader-stucked-if-using-opencv-resize-method).
Sorry for the delay. I can't reproduce the bug; what environment are you using? I'm reluctant to change a global state that might impact other libraries relying on hloc. Would this work instead?
loader = torch.utils.data.DataLoader(
loader, num_workers=1,
worker_init_fn=lambda _: cv2.setNumThreads(0))