进程实例化神经网络类报错:self = reduction.pickle.load(from_parent) EOFError: Ran out of input

1 篇文章 0 订阅
1 篇文章 0 订阅

在一个进程中实例化并调用接口处理图像时报错如下:

THCudaCheck FAIL file=C:\w\1\s\windows\pytorch\torch/csrc/generic/StorageSharing.cpp line=245 error=71 : operation not supported
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "G:\venvs\py364\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "G:\venvs\py364\lib\multiprocessing\spawn.py", line 115, in _main
    self = reduction.pickle.load(from_parent)
EOFError: Ran out of input

提供接口的类:

class DetectPerson(object):
    def __init__(self):

        self.det_model = Darknet(current_dir + "/data/yolov3.cfg")
        self.det_model.load_weights(current_dir + '/data/yolov3.weights')
        self.det_model.net_info['height'] = opt.inp_dim
        self.det_inp_dim = int(self.det_model.net_info['height'])
        assert self.det_inp_dim % 32 == 0
        assert self.det_inp_dim > 32
        self.det_model.cuda()
        self.det_model.eval()
   ......
   def detect_person(self, frame):
        """
        将传入的原始图像经过神经网络算出图像中的人并标记返回
        :param frame: 原始图像
        :return: 标记人体的图
        """
         ......
         return frame

调用的进程代码:

class VideoDetect(Process):
    def __init__(self, queue_list):
        super(VideoDetect, self).__init__()
        self.queue_list = queue_list
        **self.detect_person = DetectPerson()**  # 此处实例化报错如上
    ......
    # 运行进程
    def run(self):
		**self.detect_person = DetectPerson()**  # 此处实例化可以正常运行
        while True:
            cam_id, frame = self.queue_list.get()
       		frame = self.detect_person.detect_person(frame)
    ......

先解决然后在这记录下这个问题,有空还需再研究下,有了解原因的小伙伴还望不吝赐教哈哈

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 16
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值