Skip to content

Conversation

zmurez
Copy link
Contributor

@zmurez zmurez commented Aug 20, 2020

With large images, cv2.resize() is called.

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

@sarlinpe
Copy link
Member

sarlinpe commented Dec 4, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants