Closed MSutt closed 7 years ago
Hi,
Please try option 2 in Module.c. I am not sure why large images will cause a segmentation fault. Do you have an idea?
// convert (copy) PyArrayObject(float32) to float []
// option 1
float data[w*h*c];
int k;
for (k = 0; k < w*h*c; k++) {
data[k] = *((float*) PyArray_GETPTR1(array, k));
}
// option 2
// float *data;
// data = (float*) PyArray_GETPTR1(array, 0);
Well thanks, it's working now.
I thought this was coming from the PyArg_ParseTuple
call, obviously I was wrong.
Hi, When I try to use the
pyyolo.detect
function with my own yolo trained model, it generate a segmentation fault.I copied the
example.py
to make my own with those changes :then when i run it i have this error :
I found that was coming from the line
ret_val = cv2.imwrite(filename,img)
which was removing my image so i removed it since i don't have any webcam.Then after getting my image back, i run again and i have the segmentation fault error :
The predictions from the
----- test original C using a file
version is ok.Here is some tests i have made to find why this is happening :
Running
python example.py
works fine with this output :I dont have any webcam so 2 first printing are False. But running
example.py
with thecv2,imwrite
instruction works for the dog.jpgRunning the tiny yolo on my image without the
cv2.imwrite
(with it, i still have the remove) raise the segmentation fault exception :Running my model on dog.jpg image works :
After searching i found out that the segmentation fault comes from the data parsing in line 46 of
module.c
in the instructionif (!PyArg_ParseTuple(args, "iiiOff", &w, &h, &c, &array, &thresh, &hier_thresh))
I cant undestand why the parsing raise a segmentation fault error on my image. My images are RGB with sizes (1920,1440,3) or (1440,1920,3) or (1920,1920,3) Can you help ?