Hierarchical-Localization icon indicating copy to clipboard operation
Hierarchical-Localization copied to clipboard

cv2 resize hangs

Open zmurez opened this issue 4 years ago • 1 comments

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).

zmurez avatar Aug 20 '20 06:08 zmurez

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))

sarlinpe avatar Dec 04 '20 10:12 sarlinpe