Project-MONAI / Project-MONAI/MONAI
VideoDataset Deadlock and error
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.7k
- Forks
- 1.6k
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 20
Description
Describe the bug
OpenCV VideoCapture object deadlocks the data loader or throws different errors when multiple workers try to access the same video file. The current logic implemented in the dataset is workable for Linux env but not Windows. The self.multiprocessing attribute doesn't prevent num_worker > 0 from being handled either.
To Reproduce
dataset = VideoFileDataset(video_source = "video.mp4", multiprocessing = True)
dataloader = torch.utils.data.Dataloader(dataset, batch_size = 2, num_worker = 2)
for batch in dataloader:
print(hello)
Expected behaviour
Dataloader will deadlock when trying to create the same cv2.VideoCapture object on same video (behaviour could be different in different video files)
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
Windows
Pyhton > 3.9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with VideoFileDataset and its cv2.VideoCapture handling, then run the provided torch.utils.data.Dataloader reproduction on Windows with num_worker=2. Compare behavior when multiple workers access video.mp4; done means the reported deadlock and inconsistent errors are eliminated while dataset loading still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- opencv, python
- Domain
- data, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100