yolo5模型跑数据时提示opencv内存溢出的问题应该怎么解决?
Traceback (most recent call last): File "train.py", line 649, in <module>
main(opt)
File "train.py", line 545, in main
train(opt.hyp, opt, device, callbacks)
File "train.py", line 306, in train
for i, (imgs, targets, paths, _) in pbar: # batch -------------------------------------------------------------
File "C:\Anaconda3\envs\yolo\lib\site-packages\tqdm\std.py", line 1195, in __iter__
for obj in iterable:
File "F:\yolo5\yolov5-6.1\utils\datasets.py", line 141, in __iter__
yield next(self.iterator)
File "C:\Anaconda3\envs\yolo\lib\site-packages\torch\utils\data\dataloader.py", line 521, in __next__
data = self._next_data()
File "C:\Anaconda3\envs\yolo\lib\site-packages\torch\utils\data\dataloader.py", line 1203, in _next_data
return self._process_data(data)
File "C:\Anaconda3\envs\yolo\lib\site-packages\torch\utils\data\dataloader.py", line 1229, in _process_data
data.reraise()
File "C:\Anaconda3\envs\yolo\lib\site-packages\torch\_utils.py", line 434, in reraise
raise exception
cv2.error: Caught error in DataLoader worker process 4.
Original Traceback (most recent call last):
File "C:\Anaconda3\envs\yolo\lib\site-packages\torch\utils\data\_utils\worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "C:\Anaconda3\envs\yolo\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Anaconda3\envs\yolo\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "F:\yolo5\yolov5-6.1\utils\datasets.py", line 561, in __getitem__
img, labels = self.load_mosaic(index)
File "F:\yolo5\yolov5-6.1\utils\datasets.py", line 657, in load_mosaic
img, _, (h, w) = self.load_image(index)
File "F:\yolo5\yolov5-6.1\utils\datasets.py", line 636, in load_image
im = cv2.imread(f) # BGR
cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\core\src\alloc.cpp:73: error: (-4:Insufficient memory) Failed to allocate 36000000 bytes in function 'cv::OutOfMemoryError'
看网上说这是因为opencv 使用的32位的原因,改成64位的就可以了。yolo5中的opencv-python 怎么改成64的呢?
以上是 yolo5模型跑数据时提示opencv内存溢出的问题应该怎么解决? 的全部内容, 来源链接: utcz.com/p/938332.html