BertaBescos / DynaSLAM

DynaSLAM is a SLAM system robust in dynamic environments for monocular, stereo and RGB-D setups
https://bertabescos.github.io/DynaSLAM/
Other
792 stars 199 forks source link

Assertion `this->net != NULL' (again..!) #48

Open lesurp opened 4 years ago

lesurp commented 4 years ago

After encountering many issues running DynaSLAM on my machine (tensorlfow/cuda/protobuf versions...), I tried running it with Docker

Here's the backtrace when I compile in Debug

nImages: 1021
Loading Mask R-CNN. This could take a while...
Importing Mask R-CNN Settings...
    py_path: ./src/python/
    module_name: MaskRCNN
    class_name: Mask
    get_dyn_seg: GetDynSeg
[New Thread 0x7fffd288f700 (LWP 1037)]
[New Thread 0x7fffd208e700 (LWP 1038)]
[New Thread 0x7fffcd88d700 (LWP 1039)]
[New Thread 0x7fffcd08c700 (LWP 1040)]
[New Thread 0x7fffc888b700 (LWP 1041)]
[New Thread 0x7fffc808a700 (LWP 1042)]
[New Thread 0x7fffc5889700 (LWP 1043)]
[New Thread 0x7fffbcf42700 (LWP 1044)]
[New Thread 0x7fffbc741700 (LWP 1045)]
[New Thread 0x7fffb9f40700 (LWP 1046)]
[New Thread 0x7fffb573f700 (LWP 1047)]
[New Thread 0x7fffb2f3e700 (LWP 1048)]
[New Thread 0x7fffb073d700 (LWP 1049)]
[New Thread 0x7fffaff3c700 (LWP 1050)]
[Thread 0x7fffaff3c700 (LWP 1050) exited]
[Thread 0x7fffb073d700 (LWP 1049) exited]
[Thread 0x7fffb2f3e700 (LWP 1048) exited]
[Thread 0x7fffb573f700 (LWP 1047) exited]
[Thread 0x7fffb9f40700 (LWP 1046) exited]
[Thread 0x7fffbc741700 (LWP 1045) exited]
[Thread 0x7fffbcf42700 (LWP 1044) exited]
[Thread 0x7fffc5889700 (LWP 1043) exited]
[Thread 0x7fffc808a700 (LWP 1042) exited]
[Thread 0x7fffc888b700 (LWP 1041) exited]
[Thread 0x7fffcd08c700 (LWP 1040) exited]
[Thread 0x7fffcd88d700 (LWP 1039) exited]
[Thread 0x7fffd208e700 (LWP 1038) exited]
[Thread 0x7fffd288f700 (LWP 1037) exited]
/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:40: UserWarning: h5py is running against HDF5 1.10.0 when it was built against 1.10.4, this may cause problems
  '{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple)
Using TensorFlow backend.
Initializing Mask RCNN network...
./src/python
[New Thread 0x7fffc5889700 (LWP 1054)]
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py:4070: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

WARNING:tensorflow:From /DynaSLAM/src/python/model.py:366: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
WARNING:tensorflow:From /DynaSLAM/src/python/model.py:390: calling crop_and_resize_v1 (from tensorflow.python.ops.image_ops_impl) with box_ind is deprecated and will be removed in a future version.
Instructions for updating:
box_ind is deprecated, use box_indices instead
WARNING:tensorflow:From /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, there are two
    options available in V2.
    - tf.py_function 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_function`s can use accelerators such as GPUs as well as
    being differentiable using a gradient tape.
    - tf.numpy_function maintains the semantics of the deprecated tf.py_func
    (it is not differentiable, and manipulates numpy arrays). It drops the
    stateful argument making all functions stateful.

rgbd_tum: /DynaSLAM/src/MaskNet.cc:43: DynaSLAM::SegmentDynObject::SegmentDynObject(): Assertion `this->net != NULL' failed.

Thread 1 "rgbd_tum" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51  ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) ny
Undefined command: "ny".  Try "help".
(gdb) bt
#0  0x00007ffff59eae97 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff59ec801 in __GI_abort () at abort.c:79
#2  0x00007ffff59dc39a in __assert_fail_base (fmt=0x7ffff5b637d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7ffff7bb4b72 "this->net != NULL", file=file@entry=0x7ffff7bb4a7e "/DynaSLAM/src/MaskNet.cc", line=line@entry=43, function=function@entry=0x7ffff7bb51a0 <DynaSLAM::SegmentDynObject::SegmentDynObject()::__PRETTY_FUNCTION__> "DynaSLAM::SegmentDynObject::SegmentDynObject()") at assert.c:92
#3  0x00007ffff59dc412 in __GI___assert_fail (assertion=assertion@entry=0x7ffff7bb4b72 "this->net != NULL", file=file@entry=0x7ffff7bb4a7e "/DynaSLAM/src/MaskNet.cc", line=line@entry=43, function=function@entry=0x7ffff7bb51a0 <DynaSLAM::SegmentDynObject::SegmentDynObject()::__PRETTY_FUNCTION__> "DynaSLAM::SegmentDynObject::SegmentDynObject()") at assert.c:101
#4  0x00007ffff7b877a7 in DynaSLAM::SegmentDynObject::SegmentDynObject() (this=0x555555cccd80) at /DynaSLAM/src/MaskNet.cc:43
#5  0x00005555555635da in main(int, char**) (argc=6, argv=0x7fffffffe438) at /DynaSLAM/Examples/RGB-D/rgbd_tum.cc:62

When I run in RelWithDebInfo, here's the backtrace (don't get why it's different, probably doesn't matter):

/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:40: UserWarning: h5py is running against HDF5 1.10.0 when it was built against 1.10.4, this may cause problems
  '{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple)
Using TensorFlow backend.
Initializing Mask RCNN network...
./src/python
[New Thread 0x7fffa766a700 (LWP 115)]
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py:4070: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

WARNING:tensorflow:From /DynaSLAM/src/python/model.py:315: The name tf.log is deprecated. Please use tf.math.log instead.

WARNING:tensorflow:From /DynaSLAM/src/python/model.py:366: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
WARNING:tensorflow:From /DynaSLAM/src/python/model.py:390: calling crop_and_resize_v1 (from tensorflow.python.ops.image_ops_impl) with box_ind is deprecated and will be removed in a future version.
Instructions for updating:
box_ind is deprecated, use box_indices instead
WARNING:tensorflow:From /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, there are two
    options available in V2.
    - tf.py_function 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_function`s can use accelerators such as GPUs as well as
    being differentiable using a gradient tape.
    - tf.numpy_function maintains the semantics of the deprecated tf.py_func
    (it is not differentiable, and manipulates numpy arrays). It drops the
    stateful argument making all functions stateful.

Creating net instance...
Loading net parameters...

Thread 1 "rgbd_tum" received signal SIGSEGV, Segmentation fault.
0x00007ffff7b9a05b in DynaSLAM::NDArrayConverter::toMat (this=0x555555d15920, o=0x0) at /DynaSLAM/src/Conversion.cc:225
225    if( !PyArray_Check(o) )
(gdb) bt
#0  0x00007ffff7b9a05b in DynaSLAM::NDArrayConverter::toMat(_object const*) (this=0x555555d15920, o=0x0) at /DynaSLAM/src/Conversion.cc:225
#1  0x00007ffff7b9b2b2 in DynaSLAM::SegmentDynObject::GetSegmentation(cv::Mat&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (this=this@entry=0x555555ccbd80, image=..., dir="no_save", name="no_file") at /DynaSLAM/src/MaskNet.cc:63
#2  0x00007ffff7b9c751 in DynaSLAM::SegmentDynObject::SegmentDynObject() (this=0x555555ccbd80) at /DynaSLAM/src/MaskNet.cc:47
#3  0x00005555555636b4 in main(int, char**) (argc=6, argv=0x7fffffffe438) at /DynaSLAM/Examples/RGB-D/rgbd_tum.cc:62

The only thing that looks wrong is the h5py / hdf5 warning, but I have no idea if that could be the problem...

src/python/Check.py fails because of deprecated APIs

I updated models.py to use the new APIs, and the output seems fine:

root@9ad5cf137e22:/DynaSLAM# python src/python/Check.py Using TensorFlow backend.
Initializing Mask RCNN network...
./src/python
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py:4070: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

WARNING:tensorflow:From /DynaSLAM/src/python/model.py:366: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
WARNING:tensorflow:From /DynaSLAM/src/python/model.py:390: calling crop_and_resize_v1 (from tensorflow.python.ops.image_ops_impl) with box_ind is deprecated and will be removed in a future version.
Instructions for updating:
box_ind is deprecated, use box_indices instead
WARNING:tensorflow:From /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, there are two
    options available in V2.
    - tf.py_function 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_function`s can use accelerators such as GPUs as well as
    being differentiable using a gradient tape.
    - tf.numpy_function maintains the semantics of the deprecated tf.py_func
    (it is not differentiable, and manipulates numpy arrays). It drops the
    stateful argument making all functions stateful.

2020-03-19 18:06:27.355507: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-03-19 18:06:27.360083: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1
2020-03-19 18:06:27.424248: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-03-19 18:06:27.424896: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5640caf5cab0 executing computations on platform CUDA. Devices:
2020-03-19 18:06:27.424920: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): GeForce GTX 1050 Ti, Compute Capability 6.1
2020-03-19 18:06:27.426470: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3696330000 Hz
2020-03-19 18:06:27.426780: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5640cbc2b980 executing computations on platform Host. Devices:
2020-03-19 18:06:27.426811: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
2020-03-19 18:06:27.426955: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-03-19 18:06:27.427406: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: 
name: GeForce GTX 1050 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.392
pciBusID: 0000:01:00.0
2020-03-19 18:06:27.427613: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0
2020-03-19 18:06:27.428651: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcublas.so.10.0
2020-03-19 18:06:27.429485: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcufft.so.10.0
2020-03-19 18:06:27.429705: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcurand.so.10.0
2020-03-19 18:06:27.430804: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusolver.so.10.0
2020-03-19 18:06:27.431657: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusparse.so.10.0
2020-03-19 18:06:27.434450: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7
2020-03-19 18:06:27.434631: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-03-19 18:06:27.435172: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-03-19 18:06:27.435636: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0
2020-03-19 18:06:27.435707: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0
2020-03-19 18:06:27.436585: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-03-19 18:06:27.436600: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      0 
2020-03-19 18:06:27.436610: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0:   N 
2020-03-19 18:06:27.436711: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-03-19 18:06:27.437166: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1005] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-03-19 18:06:27.437596: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2965 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
Initialated Mask RCNN network...
WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py:422: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.

2020-03-19 18:06:31.597647: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set.  If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU.  To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
2020-03-19 18:06:31.668133: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcublas.so.10.0
2020-03-19 18:06:31.816810: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7
Mask R-CNN is correctly working

You can find the Dockerfile as well as the API updates on my fork

I saw issues #24, but my Check.py works fine

11 as well, but I run everything from the root directory:

./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM3.yaml /data/tum/rgbd_dataset_freiburg3_walking_halfsphere /data/tum/rgbd_dataset_freiburg3_walking_halfsphere/associations.txt no_save

I'm seeing comments about opencv versions (my Dockerfile uses opencv3), I will update this issue whenever I find a solution...

PushyamiKaveti commented 4 years ago

did you get DynaSLAM to run finally?

liubamboo commented 3 years ago

Firstly I run DynaSLAM ok in the teminal, and then I run in the ide(CLion), it shows the bug: mono_tum: /home/n609/project/DynaSLAM/src/MaskNet.cc:39: DynaSLAM::SegmentDynObject::SegmentDynObject(): Assertion `this->py_module != NULL' failed.

Finally I change the working directory to DynaSLAM and now it can work. image