Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation Fault #41

Open
gulcancan opened this issue Sep 27, 2018 · 2 comments
Open

Segmentation Fault #41

gulcancan opened this issue Sep 27, 2018 · 2 comments

Comments

@gulcancan
Copy link

gulcancan commented Sep 27, 2018

Hi,

Thank you for your effort in this project!

We are trying to use this repo to run a Tensorflow image segmentation model on Elixir. Please see the code below.

{:ok, graph} = Tensorflex.read_graph("./frozen_inference_graph.pb")

{:ok, input_tensor} = Tensorflex.load_image_as_tensor("example.jpg")

out_dims = Tensorflex.create_matrix(1,3,[[513,431,1]])

{:ok, output_tensor} = Tensorflex.float32_tensor_alloc(out_dims)

results = Tensorflex.run_session(graph, input_tensor, output_tensor, "ImageTensor", "SemanticPredictions")

Unfortunately, we get a segmentation fault error. Please see the stack trace in gdb below.

(gdb) bt #0 0x00007fe846a53701 in TF_NumDims () from /usr/local/lib/libtensorflow.so #1 0x00007fe8c6e3ad14 in run_session (env=0x7fe8c7cfbd80, argc=<optimized out>, argv=<optimized out>) at c_src/Tensorflex.c:696 #2 0x000055e2cd8fc042 in process_main () at x86_64-unknown-linux-gnu/opt/smp/beam_cold.h:119 #3 0x000055e2cd8eddbd in sched_thread_func (vesdp=0x7fe8cd2e3900) at beam/erl_process.c:8332 #4 0x000055e2cdb2fbcd in thr_wrapper (vtwd=0x7ffc34ad3050) at pthread/ethread.c:118 #5 0x00007fe9100f26db in start_thread (arg=0x7fe8c7cfc700) at pthread_create.c:463 #6 0x00007fe90fc1388f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

After digging up the issue, we came up with the conclusion that it originates from the allocation of "output_tensor" variable. Could you please help us on the issue? If you would like to populate the error, you can use any pretrained image segmentation model from the tensorflow deeplab model zoo page.
Looking forward to your reply.
Thank you.

@anshuman23
Copy link
Owner

Thank you for bringing up the issue! I will try to solve it ASAP. :)
Unfortunately I am completely swamped with some deadlines at the moment so I will only be able to take a look at this after 2-3 days. I apologize for any inconvenience caused and I appreciate your patience.

Thanks! :)

@synalysis
Copy link

I noticed that there is some error handling missing that tells you what is wrong. If, for example, your "ImageTensor" or "SemanticPredictions" are not contained in the graph you loaded the run_session call crashes. So either you try starting with some example that works and move to your graph or you use some C debugger that lets you examine what's happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants