Comments (29)
Hi! I met an error when running the code. I have tried this both with cpu and gpu.
Initialated Mask RCNN network... Creating net instance... Loading net parameters... Bus error (core dumped)
I run the Check.py successfully and can run the code without [PATH TO MASK] [PATH TO OUTPUT] parameters. Could anyone help me? Thanks!!!
Hello there! Is your problem solved? I also encountered the same problem.
from dynaslam.
@fanguohao @kxhit Hello! I also encountered the same problem. My configuration is GTX 1080. The version of my opencv is 3.4.1
from dynaslam.
@BertaBescos I am sorry to bother you. Do you have any suggestions on this problem?
from dynaslam.
I have fixed this problem. Just change your opencv version to 2.4.11
from dynaslam.
@BertaBescos I can run the code with openCV2 but not OpenCV3. I find the program not fluent either with MaskRCNN or not. Waiting for your reply. Thanks!
from dynaslam.
I could not reproduce the problem. I would suggest to do as @jsdd25 proposes and change OpenCV version to 2.4.11. We will write you back if we find out what the problem is.
from dynaslam.
I also have this problem. I find the C++ can't call the MaskRCNN.py.
DynaSLAM::SegmentDynObject::SegmentDynObject(): Assertion `this->py_module != NULL' failed.
I don't know how to solve it. Can you help me?
from dynaslam.
Are you using OpenCV 2.4.11? If not, I would recommend you to use it.
We will try to fix this issue for newer versions within the next weeks.
from dynaslam.
Are you using OpenCV 2.4.11? If not, I would recommend you to use it.
We will try to fix this issue for newer versions within the next weeks.
Thanks for your answer,I had changed my OpenCV from 2.4.13 to 2.4.11 ,but it is useless, I am looking forward to your newer versions
from dynaslam.
Then the problem must be something else. It should work without problems on OpenCV 2.4.11.
Are you running it from the DynaSLAM directory path?
from dynaslam.
Then the problem must be something else. It should work without problems on OpenCV 2.4.11.
Are you running it from the DynaSLAM directory path?
I run it from DynaSLAM directory path like the ORB_SLAM2,it succeeded. when I added the parameter [PATH_TO_MASK] [PATH_TO_OUTPUT] to call the MaskRCNN, the problem has happened.
from dynaslam.
Then the problem must be something else. It should work without problems on OpenCV 2.4.11.
Are you running it from the DynaSLAM directory path?
I found the python version is the key problem. Mask_RCNN requires the Python3.4 + TensorFlow1.3 + Keras2.0.8,but your DynaSLAM is python2.7. I will try this way to build the DynaSLAM.
from dynaslam.
Any luck with this error? I have the same problem
from dynaslam.
I have meet the trouble for several days.But ,i can't solver it .my system is Ubuntu16.04+cuda8.0+cudnn6+opencv 2.4.11+orbslam2 environment.Can anyone help me ?
from dynaslam.
I got it working finally. The issue on my side was opencv 3.3. It works with opencv 2.4.10. When I debugged I found that the problem is in Conversion.cc inside the method toNDArray(const cv::Mat& m). The method has two sections for two opencv versions (2 and 3) in case of opencv 3 the PyObject returned from Mat seems to be the problem when it gets passed to GetDynSeg() of MaskRCNN.py. I am trying to fix it now.
from dynaslam.
You are too good!Can you tell me about your configuration environment in detail ?and have you run check.py?I have trouble again yesterday, maybe I have to configure the environment for this code again.
from dynaslam.
@PushyamiKaveti Can you help me ?
from dynaslam.
@BertaBescos Can you help me? When I give [PATH TO MASK] [PATH TO OUTPUT] ,It is "core dumped".
from dynaslam.
@PushyamiKaveti @BertaBescos My environment is :Ubuntu16.04 +cuda8.0+cudnn6+opencv2.4.11+python2.7+orbslam2.
from dynaslam.
I have solved this problem, thank you for your help.@PushyamiKaveti @BertaBescos
from dynaslam.
I have solved this problem, thank you for your help.@PushyamiKaveti @BertaBescos
I meet the same problem, can you help me?
My error is Bus error too, my python is 2.7, opencv version is 2.4.11,and Ican run Check.py successfully.
@qxdaaaaa
from dynaslam.
I meet the same problem, can you help me?
My error is Bus error too, my python is 2.7, opencv version is 2.4.11 and 3.4.1,tensorflow-gpu1.4.0 and I can run Check.py successfully.
@qxdaaaaa @kxhit @fanguohao
from dynaslam.
from dynaslam.
Thanks,@qxdaaaaa. I just test the masknet .cc find that the function cv::Mat SegmentDynObject::GetSegmentation(cv::Mat &image,std::string dir, std::string name){ .... PyObject* py_mask_image = PyObject_CallMethod(this->net, const_cast<char*>(this->get_dyn_seg.c_str()),"(O)",py_image); ......}
doesn't working, how to solve this problem?
from dynaslam.
I meet the same problem, can you help me? My error is Bus error too, my python is 2.7, opencv version is 2.4.11 and 3.4.1,tensorflow-gpu1.4.0 and I can run Check.py successfully.
I‘d like to ask if cuda10.0 + tensorflow1.13.1 is ok? I think I have correctly installed with python2 but I can't pass check when I use terminal to run 'python check.py'. I think I need you help.....
from dynaslam.
I have solved this problem, thank you for your help.@PushyamiKaveti @BertaBescos
How did you solve the problem? @PushyamiKaveti @qxdaaaaa
My system is Python 2.7, OpenCV 3.3.0 , tensorflow-gpu=1.13.1, CUDA 10.0 and I can run Check.py successfully.
from dynaslam.
I have solved this problem, thank you for your help.@PushyamiKaveti @BertaBescos
How did you solve the problem? @PushyamiKaveti @qxdaaaaa
My system is Python 2.7, OpenCV 3.3.0 , tensorflow-gpu=1.13.1, CUDA 10.0 and I can run Check.py successfully.
Have you run successfully in cuda10?
from dynaslam.
I got it working finally. The issue on my side was opencv 3.3. It works with opencv 2.4.10. When I debugged I found that the problem is in Conversion.cc inside the method toNDArray(const cv::Mat& m). The method has two sections for two opencv versions (2 and 3) in case of opencv 3 the PyObject returned from Mat seems to be the problem when it gets passed to GetDynSeg() of MaskRCNN.py. I am trying to fix it now.
Yes,it is the problem,the Conversion.cc failed with opencv3.And I have fixed it, here is my Conversion.cc:
#include "Conversion.h"
#include
namespace DynaSLAM
{
static void init()
{
import_array();
}
static PyObject* failmsgp(const char *fmt, ...)
{
char str[1000];
va_list ap;
va_start(ap, fmt);
vsnprintf(str, sizeof(str), fmt, ap);
va_end(ap);
PyErr_SetString(PyExc_TypeError, str);
return 0;
}
using namespace cv;
//=================== ERROR HANDLING =========================================================
static int failmsg(const char *fmt, ...) {
char str[1000];
va_list ap;
va_start(ap, fmt);
vsnprintf(str, sizeof(str), fmt, ap);
va_end(ap);
PyErr_SetString(PyExc_TypeError, str);
return 0;
}
//=================== THREADING ==============================================================
class PyAllowThreads {
public:
PyAllowThreads() :
_state(PyEval_SaveThread()) {
}
~PyAllowThreads() {
PyEval_RestoreThread(_state);
}
private:
PyThreadState* _state;
};
class PyEnsureGIL {
public:
PyEnsureGIL() :
_state(PyGILState_Ensure()) {
}
~PyEnsureGIL() {
PyGILState_Release(_state);
}
private:
PyGILState_STATE _state;
};
enum {
ARG_NONE = 0, ARG_MAT = 1, ARG_SCALAR = 2
};
class NumpyAllocator:
public MatAllocator {
public:
NumpyAllocator() {
stdAllocator = Mat::getStdAllocator();
}
~NumpyAllocator() {
}
UMatData* allocate(PyObject* o, int dims, const int* sizes, int type,
size_t* step) const {
UMatData* u = new UMatData(this);
u->data = u->origdata = (uchar*) PyArray_DATA((PyArrayObject*) o);
npy_intp* _strides = PyArray_STRIDES((PyArrayObject*) o);
for (int i = 0; i < dims - 1; i++)
step[i] = (size_t) _strides[i];
step[dims - 1] = CV_ELEM_SIZE(type);
u->size = sizes[0] * step[0];
u->userdata = o;
return u;
}
UMatData* allocate(int dims0, const int* sizes, int type, void* data,
size_t* step, int flags, UMatUsageFlags usageFlags) const {
if (data != 0) {
CV_Error(Error::StsAssert, "The data should normally be NULL!");
// probably this is safe to do in such extreme case
return stdAllocator->allocate(dims0, sizes, type, data, step, flags,
usageFlags);
}
PyEnsureGIL gil;
int depth = CV_MAT_DEPTH(type);
int cn = CV_MAT_CN(type);
const int f = (int) (sizeof(size_t) / 8);
int typenum =
depth == CV_8U ? NPY_UBYTE :
depth == CV_8S ? NPY_BYTE :
depth == CV_16U ? NPY_USHORT :
depth == CV_16S ? NPY_SHORT :
depth == CV_32S ? NPY_INT :
depth == CV_32F ? NPY_FLOAT :
depth == CV_64F ?
NPY_DOUBLE :
f * NPY_ULONGLONG + (f ^ 1) * NPY_UINT;
int i, dims = dims0;
cv::AutoBuffer<npy_intp> _sizes(dims + 1);
for (i = 0; i < dims; i++)
_sizes[i] = sizes[i];
if (cn > 1)
_sizes[dims++] = cn;
PyObject* o = PyArray_SimpleNew(dims, _sizes, typenum);
if (!o)
CV_Error_(Error::StsError,
("The numpy array of typenum=%d, ndims=%d can not be created", typenum, dims));
return allocate(o, dims0, sizes, type, step);
}
bool allocate(UMatData* u, int accessFlags,
UMatUsageFlags usageFlags) const {
return stdAllocator->allocate(u, accessFlags, usageFlags);
}
void deallocate(UMatData* u) const {
if (u) {
PyEnsureGIL gil;
PyObject* o = (PyObject*) u->userdata;
Py_XDECREF(o);
delete u;
}
}
const MatAllocator* stdAllocator;
};
NumpyAllocator g_numpyAllocator;
NDArrayConverter::NDArrayConverter() { init(); }
void NDArrayConverter::init()
{
import_array();
}
cv::Mat NDArrayConverter::toMat(const PyObject o)
{
cv::Mat m;
bool allowND = true;
if (!PyArray_Check(o)) {
failmsg("argument is not a numpy array");
if (!m.data)
m.allocator = &g_numpyAllocator;
} else {
PyArrayObject oarr = (PyArrayObject*) o;
bool needcopy = false, needcast = false;
int typenum = PyArray_TYPE(oarr), new_typenum = typenum;
int type = typenum == NPY_UBYTE ? CV_8U : typenum == NPY_BYTE ? CV_8S :
typenum == NPY_USHORT ? CV_16U :
typenum == NPY_SHORT ? CV_16S :
typenum == NPY_INT ? CV_32S :
typenum == NPY_INT32 ? CV_32S :
typenum == NPY_FLOAT ? CV_32F :
typenum == NPY_DOUBLE ? CV_64F : -1;
if (type < 0) {
if (typenum == NPY_INT64 || typenum == NPY_UINT64
|| type == NPY_LONG) {
needcopy = needcast = true;
new_typenum = NPY_INT;
type = CV_32S;
} else {
failmsg("Argument data type is not supported");
m.allocator = &g_numpyAllocator;
return m;
}
}
#ifndef CV_MAX_DIM
const int CV_MAX_DIM = 32;
#endif
int ndims = PyArray_NDIM(oarr);
if (ndims >= CV_MAX_DIM) {
failmsg("Dimensionality of argument is too high");
if (!m.data)
m.allocator = &g_numpyAllocator;
return m;
}
int size[CV_MAX_DIM + 1];
size_t step[CV_MAX_DIM + 1];
size_t elemsize = CV_ELEM_SIZE1(type);
const npy_intp* _sizes = PyArray_DIMS(oarr);
const npy_intp* _strides = PyArray_STRIDES(oarr);
bool ismultichannel = ndims == 3 && _sizes[2] <= CV_CN_MAX;
for (int i = ndims - 1; i >= 0 && !needcopy; i--) {
// these checks handle cases of
// a) multi-dimensional (ndims > 2) arrays, as well as simpler 1- and 2-dimensional cases
// b) transposed arrays, where _strides[] elements go in non-descending order
// c) flipped arrays, where some of _strides[] elements are negative
if ((i == ndims - 1 && (size_t) _strides[i] != elemsize)
|| (i < ndims - 1 && _strides[i] < _strides[i + 1]))
needcopy = true;
}
if (ismultichannel && _strides[1] != (npy_intp) elemsize * _sizes[2])
needcopy = true;
if (needcopy) {
if (needcast) {
o = PyArray_Cast(oarr, new_typenum);
oarr = (PyArrayObject*) o;
} else {
oarr = PyArray_GETCONTIGUOUS(oarr);
o = (PyObject*) oarr;
}
_strides = PyArray_STRIDES(oarr);
}
for (int i = 0; i < ndims; i++) {
size[i] = (int) _sizes[i];
step[i] = (size_t) _strides[i];
}
// handle degenerate case
if (ndims == 0) {
size[ndims] = 1;
step[ndims] = elemsize;
ndims++;
}
if (ismultichannel) {
ndims--;
type |= CV_MAKETYPE(0, size[2]);
}
if (ndims > 2 && !allowND) {
failmsg("%s has more than 2 dimensions");
} else {
m = Mat(ndims, size, type, PyArray_DATA(oarr), step);
m.u = g_numpyAllocator.allocate((PyObject*)o, ndims, size, type, step);
m.addref();
if (!needcopy) {
Py_INCREF(o);
}
}
m.allocator = &g_numpyAllocator;
}
return m;
}
PyObject* NDArrayConverter::toNDArray(const cv::Mat& m)
{
if (!m.data)
Py_RETURN_NONE;
Mat temp,
p = (Mat) &m;
if (!p->u || p->allocator != &g_numpyAllocator) {
temp.allocator = &g_numpyAllocator;
ERRWRAP2(m.copyTo(temp));
p = &temp;
}
std::cout<u->refcount<<std::endl;
std::cout<u->userdata<<std::endl;
PyObject* o = (PyObject*) p->u->userdata;
Py_INCREF(o);
return o;
}
}
from dynaslam.
@hanxiumeng
your code doesn't work either, leads to the same error
could you share the modified conversion.cc file? did you get it to work with opencv 3?
from dynaslam.
Related Issues (20)
- The problem of OpenCV3. HOT 2
- How to get the evaluation result for KITTI odometry 16-21 in DyanSLAM2?
- my version: numpy=1.16.6 tensorflow=1.12.3 python=2.7 how to slove the follow problem? HOT 1
- 运行数据集 HOT 2
- make error HOT 1
- why opencv3 can compile success ,but opencv 2.4.13 compile fail HOT 1
- problem on Check.py (ValueError: Exception encountered when calling layer "mrcnn_bbox" (type Reshape).)
- All masks pics output is pure black HOT 1
- Why doesn't working the KITTI odometry dataset in some data?
- Loading Mask R-CNN. This could take a while... Importing Mask R-CNN Settings... 段错误 (核心已转储)
- Light Tracking not working because Tracking is not initialized...
- DynaSLAM2
- Dynaslam2
- Arxiv review version said The project code will be released upon acceptance. [The RAL published version deleted this sentence] HOT 2
- How to reduce memory usage
- When can open source the code of dyanslam II?
- Python.h error
- Libffi Error - RGB-B build not generated
- python 版本
- Can dynaslam take the static map as input?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dynaslam.