src/tcmalloc.cc:284] Attempt to free invalid pointer 0x7ff4821267d0 caffe VideoCapture Mac
2017-12-13 12:16
543 查看
Mac同时调用cap = cv2.VideoCapture(0)和caffe出现src/tcmalloc.cc:284] Attempt to free invalid pointer 0x7ff4821267d0的问题解决
import cv2 def test(): cap = cv2.VideoCapture(0) ret,frame = cap.read() print ret cap.release() import caffe
出现错误:
src/tcmalloc.cc:284] Attempt to free invalid pointer 0x7ff4821267d0
而ubuntu下运行良好无错误。
解决办法:
将import caffe放在顶部导入
import caffe import cv2 def test(): cap = cv2.VideoCapture(0) ret,frame = cap.read() print ret cap.release()
成功
解决过程记录:
import threading as th def test(): cap = cv2.VideoCapture(0) ret, frame = cap.read() print ret #cap.release() def test2(): import caffe t1 = th.Thread(target = test) t2 = th.Thread(target = test2) t1.start() t1.join() t2.start() t2.join()
运行错误,输出
src/tcmalloc.cc: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 = cap.read() print ret #cap.release() 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一张。
相关文章推荐
- 使用pytorch出现src/tcmalloc.cc:277] Attempt to free invalid pointer 0x7f4685efcd40 Aborted (core dumpe)
- "malloc: * error for object 0x17415d0c0: Invalid pointer dequeued from free list * set a breakpoint in malloc_error_break to debug";
- caffe runtest出错:Error in `python': free(): invalid pointer
- malloc: *** error for object 0x6080000bd200: Invalid pointer dequeued from free list *** set a breakpoint in malloc_error_break to debug
- malloc: *** error for object 0x6080000bd200: Invalid pointer dequeued from free list *** set a breakpoint in malloc_error_break to debug
- 【Error】Error in `python': free(): invalid pointer: 0x00007f9b9de705e0
- VINS_Mono,OpenCV Error: Bad argument (Invalid pointer to file storage) in cvGetFileNodeByName问题终于解决了
- Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Str
- java.lang.NullPointerException: Attempt to invoke virtual method 'void com.hhl.library.FlowTagLayout
- golang错误link reading body gob: attempt to decode into a non-pointer
- 关于malloc/free问题---出现*** glibc detected *** free(): invalid pointer的解决方法
- How to capture video frames from the camera as images using AV Foundation
- 调试: 解决跨进程时使用CString报错的问题, [Invalid Address specified to RtlFreeHeap]
- net 中捕获摄像头视频的方式及对比(How to Capture Camera Video via .Net)
- .net中捕获摄像头视频的方式及对比(How to Capture Camera Video via .Net)
- java.lang.NullPointerException: Attempt to invoke virtual method
- java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.
- repair mac login failure due to invalid home directory
- error: warning: Stopped in a context claiming to capture an Objective-C object pointer,
- java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()'