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 when invoking GetDynSeg #78

Open
y9luiz opened this issue Jan 6, 2022 · 15 comments
Open

Segmentation Fault when invoking GetDynSeg #78

y9luiz opened this issue Jan 6, 2022 · 15 comments

Comments

@y9luiz
Copy link

y9luiz commented Jan 6, 2022

Hello, I'm trying to run this project and for the mask-rcnn approach I'm facing some troubles ...

A unexpected segmentation fault occurs when I try to run with the Mask-RCNN enabled and after a few debugging I found this:

the problem occurs when I call GetDynSeg at line 62 of the file src/MaskNet.cc

PyObject* py_mask_image = PyObject_CallMethod(this->net, const_cast<char*>(this->get_dyn_seg.c_str()),"(O)",py_image);

this line jumps to the python script src/python/MaskRCNN.py, more specificly to function

def GetDynSeg(self, image,image2=None)

the function expect that the second argument (image) must be a numpy array like any other python OpenCV image, but

when the code try to get the content from the image it will produce a segmentation fault

My conclusion was that numpy array is not been correctly serialized at NDArrayConverter::toNDArray() function

@y9luiz
Copy link
Author

y9luiz commented Jan 6, 2022

the test script src/python/Check.py is working nicely, so I believe that problem is from CPP side

@y9luiz
Copy link
Author

y9luiz commented Jan 6, 2022

OS info: Ubuntu 20.04 x86_64
OpenCV Version: 3.4.7
Numpy Version: 1.21.5
g++ Version: 7.5.0

@y9luiz
Copy link
Author

y9luiz commented Jan 7, 2022

I solve this problem downgrading to opencv 2.4

@alexs7
Copy link

alexs7 commented Jan 16, 2022

@y9luiz hello, have you got DynaSLAM working now ? can I ask what we should pass for the "PATH_TO_MASKS" ?

@y9luiz
Copy link
Author

y9luiz commented Jan 16, 2022

@y9luiz hello, have you got DynaSLAM working now ? can I ask what we should pass for the "PATH_TO_MASKS" ?

Yeah @alexs7 , now it's working, the parameter PATH_TO_MASKS is the folder that u want to store the masks generated by the algorithm

@alexs7
Copy link

alexs7 commented Jan 16, 2022

I run this:

./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM3.yaml ../datasets/TUM/rgbd_dataset_freiburg3_walking_rpy/ Examples/RGB-D/associations/fr3_walking_rpy.txt Examples/RGB-D/masks_temp Examples/RGB-D/masks_temp_output

and I get this:

Creating net instance...
Loading net parameters...
[ WARN:0@5.561] imread_('no_save/no_file'): can't open/read file: check file path/integrity
[1] 17264 bus error (core dumped) ./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM3.yaml

Did you have this error ?

@y9luiz
Copy link
Author

y9luiz commented Jan 16, 2022

I run this:

./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM3.yaml ../datasets/TUM/rgbd_dataset_freiburg3_walking_rpy/ Examples/RGB-D/associations/fr3_walking_rpy.txt Examples/RGB-D/masks_temp Examples/RGB-D/masks_temp_output

and I get this:

Creating net instance...
Loading net parameters...
[ WARN:0@5.561] imread_('no_save/no_file'): can't open/read file: check file path/integrity
[1] 17264 bus error (core dumped) ./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM3.yaml

Did you have this error ?

I have no ideia about your error.

Are you alredy tried to execute the script
src/python/Check.py ?

this script should test your python enviroment and check if is well configured

@alexs7
Copy link

alexs7 commented Jan 18, 2022

@y9luiz sorry for the late reply. here is what I get when I run that script:

python2.7 src/python/Check.py
/home/alex/.local/lib/python2.7/site-packages/pycocotools/coco.py:49: UserWarning:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called before pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

The backend was originally set to 'TkAgg' by the following code:
File "src/python/Check.py", line 8, in
import matplotlib.pyplot as plt
File "/home/alex/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 71, in
from matplotlib.backends import pylab_setup
File "/home/alex/.local/lib/python2.7/site-packages/matplotlib/backends/init.py", line 17, in
line for line in traceback.format_stack()

import matplotlib; matplotlib.use('Agg')
Using TensorFlow backend.
Initializing Mask RCNN netwFork...
./src/python
WARNING:tensorflow:From /home/alex/.local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From /home/alex/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py:3144: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob.
WARNING:tensorflow:From /home/alex/DynaSLAM/src/python/model.py:746: py_func (from tensorflow.python.ops.script_ops) is deprecated and will be removed in a future version.
Instructions for updating:
tf.py_func is deprecated in TF V2. Instead, use
tf.py_function, which takes a python function which manipulates tf eager
tensors instead of numpy arrays. It's easy to convert a tf eager tensor to
an ndarray (just call tensor.numpy()) but having access to eager tensors
means tf.py_functions can use accelerators such as GPUs as well as
being differentiable using a gradient tape.

2022-01-18 13:25:28.892448: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2022-01-18 13:25:28.912843: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3199980000 Hz
2022-01-18 13:25:28.913257: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x56177eebd2e0 executing computations on platform Host. Devices:
2022-01-18 13:25:28.913277: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): ,
Initialated Mask RCNN network...
Mask R-CNN is correctly working

@alexs7
Copy link

alexs7 commented Jan 18, 2022

@y9luiz except some warnings this shouls be OK right ? What do you get ?

@y9luiz
Copy link
Author

y9luiz commented Jan 19, 2022

@alexs7 the python environment its okay, did you are using the opencv 2.4? how I said in this topic, my issues stopped after downgrade the opencv version

@alexs7
Copy link

alexs7 commented Jan 20, 2022

@y9luiz yes fixed it by downgrading to opencv 2.4

did you get the inpainting code working?

@y9luiz
Copy link
Author

y9luiz commented Jan 20, 2022

@alexs7 no I never try to use the impainting functionality

@alexs7
Copy link

alexs7 commented Jan 24, 2022

@y9luiz I got my own fork here with updated details on how to build: https://github.com/alexs7/DynaSLAM

@y9luiz
Copy link
Author

y9luiz commented Jan 24, 2022

Nice job @alexs7!

@upperfish
Copy link

Hello, I'm trying to run this project and for the mask-rcnn approach I'm facing some troubles ...

A unexpected segmentation fault occurs when I try to run with the Mask-RCNN enabled and after a few debugging I found this:

the problem occurs when I call GetDynSeg at line 62 of the file src/MaskNet.cc

PyObject* py_mask_image = PyObject_CallMethod(this->net, const_cast<char*>(this->get_dyn_seg.c_str()),"(O)",py_image);

this line jumps to the python script src/python/MaskRCNN.py, more specificly to function

def GetDynSeg(self, image,image2=None)

the function expect that the second argument (image) must be a numpy array like any other python OpenCV image, but

when the code try to get the content from the image it will produce a segmentation fault

My conclusion was that numpy array is not been correctly serialized at NDArrayConverter::toNDArray() function

do you slove? i have same problem? please help god!

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