:284] Attempt to free invalid pointer 0x7ff4821267d0 caffe VideoCapture Mac

阅读: 评论:0

:284] Attempt to free invalid pointer 0x7ff4821267d0 caffe VideoCapture Mac

:284] Attempt to free invalid pointer 0x7ff4821267d0 caffe VideoCapture Mac

Mac同时调用cap = cv2.VideoCapture(0)和caffe出现src/tcmalloc:284] Attempt to free invalid pointer 0x7ff4821267d0的问题解决

import cv2
def test():cap = cv2.VideoCapture(0)ret,frame = ad()lease()
import caffe

出现错误:

src/tcmalloc:284] Attempt to free invalid pointer 0x7ff4821267d0
而ubuntu下运行良好无错误。

解决办法:

  • import caffe放在顶部导入
import caffe
import cv2
def test():cap = cv2.VideoCapture(0)ret,frame = ad()lease()

成功


解决过程记录:

import threading as th
def test():cap = cv2.VideoCapture(0)ret, frame = ad()print lease()
def test2():import caffe
t1 = th.Thread(target = test)
t2 = th.Thread(target = test2)
t1.start()
t1.join()
t2.start()
t2.join()

运行错误,输出

src/tcmalloc:284] Attempt to free invalid pointer 0x7f9847fdd240 
[Finished in 1.8s with exit code -6]
[shell_cmd: python -u "/Users/eclipsycn/Documents/caffe/ssd-face/testCapture.py"]
[dir: /Users/eclipsycn/Documents/caffe/ssd-face]
[path: /usr/local/opt/qt/bin:/Users/eclipsycn/anaconda2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public]

调换t1与t2顺序,

import threading as th
def test():cap = cv2.VideoCapture(0)ret, frame = ad()print lease()
def test2():import caffe
t1 = th.Thread(target = test)
t2 = th.Thread(target = test2)
t2.start()
t2.join()
t1.start()
t1.join()

成功
单独调用ssd-caffe-face,crop人脸过程没问题,说明不是caffe问题,而单独使用identi也可以运行,identi加VideoCapture也可以运行,尝试注释掉plt,其实没效果。
可能由于调用摄像头后与caffe的cpu冲突?
在中途测试时还出现
no module named LabelMap

怀疑是caffe导入混乱

说明只是调用顺序问题,而怎样引起的这种冲突不明确。

mac调用摄像头 如果只有mac自带摄像头,则VideoCapture(0),如果接usb摄像头,usb摄像头序号为0,而自带摄像头序号为1.
mbp2017,i5 3.1Ghz,SSD-FACE的face detection接vgg16的face identification模型,19张运行39s,大约2s一张。

本文发布于:2024-02-01 09:35:51,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170675135135699.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

下一篇:centos7配网卡
标签:Attempt   free   src   tcmalloc   cc
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23