问题一:
原来的代码运行没有问题,后来自己写了一个数据增强的策略加入之后,在训练过程中会出现这个问题。
看github说改num_workers=0,1,4,8都试过,都会报错emmm…
ERROR: Unexpected segmentation fault encountered in worker.
Traceback (most recent call last):
File "train.py", line 104, in <module>
loss.backward()
File "/home/hyy/anaconda3/envs/cztorch/lib/python3.6/site-packages/torch/tensor.py", line 195, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/hyy/anaconda3/envs/cztorch/lib/python3.6/site-packages/torch/autograd/__init__.py", line 99, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/hyy/anaconda3/envs/cztorch/lib/python3.6/site-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
_error_if_any_worker_fails()
RuntimeError: DataLoader worker (pid 24969) is killed by signal: Segmentation fault.
现在一直出现这个问题:把cv2.seamlessClone()中需要的参数都打印出来了,看不出有什么问题。不明白为什么会报错啊…
roi.shape: (4, 10, 3)
mask.shape: (4, 10, 3)
center: (316, 266)
image.shape: (856, 856, 3)
cv2.error: Caught error in DataLoader worker process 2.
Original Traceback (most recent call last):
File "/home/hyy/anaconda3/envs/cztorch/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
data = fetcher.fetch(index)
File "/home/hyy/anaconda3/envs/cztorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/hyy/anaconda3/envs/cztorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/hyy/cz/PyTorch-YOLOv3-master/utils/datasets_new.py", line 111, in __getitem__
img, boxes = copy_small_object(img, boxes)
File "/home/hyy/cz/PyTorch-YOLOv3-master/utils/datasets_new.py", line 192, in copy_small_object
final_images = cv2.seamlessClone(roi, images, mask, center, cv2.NORMAL_CLONE)
cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/core/src/matrix_wrap.cpp:1639: error: (-215:Assertion failed) !fixedSize() in function 'release'
版权声明:本文为qq_41092190原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。