memo / ofxMSATensorFlow

C++ openframeworks addon and examples integrating Google's TensorFlow numerical computation and machine learning library
Apache License 2.0
456 stars 87 forks source link

SegmentationFault on pix2pix-webcam #30

Closed genekogan closed 7 years ago

genekogan commented 7 years ago

hey memo!

any idea what might be causing this runtime segmentation fault in example-pix2pix-webcam? just to review my steps first:

0) i'm on a new ubuntu 16.04 with CUDA et al verified working. 1) i downloaded the correct version of libtensorflow_cc.so and placed it inside the libs/tensorflow/lib/linux64/ folder, and then hardcoded ADDON_LDFLAGS += /home/gene/of_v0.9.8_linux64_release/addons/ofxMSATensorFlow/libs/tensorflow/lib/linux64/libtensorflow_cc.so in the addon_config (was having trouble with relative paths for some reason, this fixed that). 2) i generated a model (called sotu3) using the steps you said, including the necessary changes to pix2pix-tensorflow and then freezing and exporting the graph. 3) i'm just making from the terminal, no IDE installed just yet. running make Debug works fine, but then when i attempt to run it, make RunDebug everything appears to open okay, but the ofApp window never opens and it crashes on a segmentation fault (output is below).

i suspect the shared library is loaded fine, because otherwise it would crash while loading the model, i think? it appears to be crashing on proc_pixels.setColor(x, y, colors[color_index]);

gene@gene:~/of_v0.9.8_linux64_release/addons/ofxMSATensorFlow/example-pix2pix-webcam$ make RunDebug
HOST_OS=Linux
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl gl glu glew gtk+-3.0 
[verbose]   sotu3
[verbose] listed 1 files in "models/"
[verbose] loading model models/sotu3
[verbose] msa::tf::SimpleModel: SimpleModel  model_path: models/sotu3/graph_frz.pb
2017-07-20 22:58:26.995468: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2017-07-20 22:58:26.995762: I tensorflow/core/common_runtime/gpu/gpu_device.cc:887] Found device 0 with properties: 
name: GeForce GTX 1060
major: 6 minor: 1 memoryClockRate (GHz) 1.6705
pciBusID 0000:01:00.0
Total memory: 5.93GiB
Free memory: 5.30GiB
2017-07-20 22:58:26.995776: I tensorflow/core/common_runtime/gpu/gpu_device.cc:908] DMA: 0 
2017-07-20 22:58:26.995780: I tensorflow/core/common_runtime/gpu/gpu_device.cc:918] 0:   Y 
2017-07-20 22:58:26.995789: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1060, pci bus id: 0000:01:00.0)
[verbose] allocating fbo and images 0x1ebb788
[verbose] ofFbo: GL frame buffer object supported
[verbose] ofFbo: checkGLSupport(): maxColorAttachments: 8, maxDrawBuffers: 8, maxSamples: 32
[verbose] ofFbo: FRAMEBUFFER_COMPLETE - OK
[verbose] ofFbo: GL frame buffer object supported
[verbose] ofFbo: checkGLSupport(): maxColorAttachments: 8, maxDrawBuffers: 8, maxSamples: 32
[verbose] ofFbo: FRAMEBUFFER_COMPLETE - OK
[verbose] loading test image
[verbose] loading color palette
[ error ] Palette info not found
[verbose] loading default brush info
[ error ] Default brush info not found
[verbose] ofGstUtils: gstreamer inited
[notice ] ofGstVideoGrabber: Probing devices with udev...
[notice ] ofGstVideoGrabber: Found device 1bcf:2c6b, getting capabilities...
[notice ] ofGstVideoGrabber: detected v4l2 device: HD WebCam
[notice ] ofGstVideoGrabber: driver: uvcvideo, version: 264209
[notice ] ofGstVideoGrabber: Capabilities: 0x84200001
[verbose] Device: HD WebCam (/dev/video0)

[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY21280x720 videoformat: 4 framerates: 
[verbose] 10/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2960x540 videoformat: 4 framerates: 
[verbose] 15/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2848x480 videoformat: 4 framerates: 
[verbose] 15/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2640x480 videoformat: 4 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2640x360 videoformat: 4 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2424x240 videoformat: 4 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2320x240 videoformat: 4 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YUY2320x180 videoformat: 4 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 1280x720 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): higher framerate replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 960x540 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): higher framerate replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 848x480 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): higher framerate replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 640x480 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 640x360 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 424x240 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 320x240 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): image/jpeg 320x180 videoformat: 0 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw I4201280x720 videoformat: 2 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): non compressed format with same framerate, replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw I420960x540 videoformat: 2 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): non compressed format with same framerate, replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw I420848x480 videoformat: 2 framerates: 
[verbose] 15/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw I420640x480 videoformat: 2 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw I420640x360 videoformat: 2 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw I420424x240 videoformat: 2 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw I420320x240 videoformat: 2 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw I420320x180 videoformat: 2 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YV121280x720 videoformat: 3 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YV12960x540 videoformat: 3 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YV12848x480 videoformat: 3 framerates: 
[verbose] 15/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YV12640x480 videoformat: 3 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YV12640x360 videoformat: 3 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YV12424x240 videoformat: 3 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YV12320x240 videoformat: 3 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw YV12320x180 videoformat: 3 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw BGR1280x720 videoformat: 16 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw BGR960x540 videoformat: 16 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw BGR848x480 videoformat: 16 framerates: 
[verbose] 15/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw BGR640x480 videoformat: 16 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw BGR640x360 videoformat: 16 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw BGR424x240 videoformat: 16 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw BGR320x240 videoformat: 16 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw BGR320x180 videoformat: 16 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw RGB1280x720 videoformat: 15 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): I420 format with same framerate as other format, replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw RGB960x540 videoformat: 15 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): I420 format with same framerate as other format, replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw RGB848x480 videoformat: 15 framerates: 
[verbose] 15/1 
[verbose] ofGstVideoGrabber: add_video_format(): already added, skipping
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw RGB640x480 videoformat: 15 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): YUY2 format with same framerate as other format, replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw RGB640x360 videoformat: 15 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): YUY2 format with same framerate as other format, replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw RGB424x240 videoformat: 15 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): YUY2 format with same framerate as other format, replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw RGB320x240 videoformat: 15 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): YUY2 format with same framerate as other format, replacing existing format
[verbose] ofGstVideoGrabber: add_video_format(): video/x-raw RGB320x180 videoformat: 15 framerates: 
[verbose] 30/1 
[verbose] ofGstVideoGrabber: add_video_format(): YUY2 format with same framerate as other format, replacing existing format
[notice ] ofGstVideoGrabber: initGrabber(): selected device: HD WebCam
[notice ] ofGstVideoGrabber: initGrabber(): selected format: 640x480 video/x-raw RGB framerate: 30/1
[notice ] ofGstUtils: setPipelineWithSink(): gstreamer pipeline: v4l2src name=video_source device=/dev/video0 ! video/x-raw,format=RGB,width=640,height=480,framerate=30/1    ! appsink name=ofappsink enable-last-sample=0 caps="video/x-raw, format=RGB, width=640, height=480"
[verbose] ofGstUtils: startPipeline(): attaching callbacks
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src
[verbose] Pipeline is live and does not need PREROLL waiting PLAY
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from src
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pipeline1
[verbose] ofGstUtils: gstHandleMessage(): unhandled message from pipeline1
[notice ] ofxCvColorImage: setFromPixels(): allocating to match dimensions: 0 0
[notice ] ofxCvGrayscaleImage: operator=: allocating to match dimensions: 480 480
Segmentation fault (core dumped)
/home/gene/of_v0.9.8_linux64_release//libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:183: recipe for target 'RunDebug' failed
make: *** [RunDebug] Error 139
genekogan commented 7 years ago

ok nevermind, i found the problem... i didn't have the color palette loaded, because i'm not using the example model you wrote the code for. false alarm. everything works great!

memo commented 7 years ago

super! (i was writing about that cos I could see the [errors], but you found it anyways :)