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

ValueError: Buffer dtype mismatch, expected 'int_t' but got 'long long' #12

Open
zubair-ahmed-ai opened this issue Sep 23, 2020 · 18 comments
Labels

Comments

@zubair-ahmed-ai
Copy link

In the line xx1 = np.maximum(x1[i], x1[order[1:]]) below it throws this error in FaceBoxes\utils\nms\py_cpu_nms.py

def py_cpu_nms(dets, thresh):
    """Pure Python NMS baseline."""
    x1 = dets[:, 0]
    y1 = dets[:, 1]
    x2 = dets[:, 2]
    y2 = dets[:, 3]
    scores = dets[:, 4]

    areas = (x2 - x1 + 1) * (y2 - y1 + 1)
    order = scores.argsort()[::-1]

    keep = []
    while order.size > 0:
        i = order[0]
        keep.append(i)
        xx1 = np.maximum(x1[i], x1[order[1:]])
        yy1 = np.maximum(y1[i], y1[order[1:]])
        xx2 = np.minimum(x2[i], x2[order[1:]])
        yy2 = np.minimum(y2[i], y2[order[1:]])

        w = np.maximum(0.0, xx2 - xx1 + 1)
        h = np.maximum(0.0, yy2 - yy1 + 1)
        inter = w * h
        ovr = inter / (areas[i] + areas[order[1:]] - inter)

        inds = np.where(ovr <= thresh)[0]
        order = order[inds + 1]

    return keep

@cleardusk
Copy link
Owner

It seems that you do not use the cython version of NMS?

@zubair-ahmed-ai
Copy link
Author

zubair-ahmed-ai commented Sep 23, 2020

I got compilation error so I uncommented this line and commented the next one

I am on Windows 10 FWIW

@zubair-ahmed-ai
Copy link
Author

I changed to the following in FaceBoxes/utils/nms/cpu_nms.pyx after lots of tries and it seems to be working (in progress)

def cpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh):
    cdef np.ndarray[np.float32_t, ndim=1] x1 = dets[:, 0]
    cdef np.ndarray[np.float32_t, ndim=1] y1 = dets[:, 1]
    cdef np.ndarray[np.float32_t, ndim=1] x2 = dets[:, 2]
    cdef np.ndarray[np.float32_t, ndim=1] y2 = dets[:, 3]
    cdef np.ndarray[np.float32_t, ndim=1] scores = dets[:, 4]

    cdef np.ndarray[np.float32_t, ndim=1] areas = (x2 - x1 + 1) * (y2 - y1 + 1)
    cdef np.ndarray[np.int64_t, ndim=1] order = scores.argsort()[::-1]

    cdef int ndets = dets.shape[0]
    cdef np.ndarray[np.int64_t, ndim=1] suppressed = \
            np.zeros((ndets), dtype=np.int64)

@cleardusk
Copy link
Owner

I have found a similar issue: eragonruan/text-detection-ctpn#380. BTW, good luck : )

@zubair-ahmed-ai
Copy link
Author

I also had to do below in two places in demo_video.py

if len(boxes) == 0:
  continue

@zubair-ahmed-ai
Copy link
Author

I have found a similar issue: eragonruan/text-detection-ctpn#380. BTW, good luck : )

I got the idea from that post myself, my above fix worked.

@cleardusk
Copy link
Owner

If this fix works across platforms, welcome for your PR : )

@JacksonL1
Copy link

if you got "cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'" error
modify 47 line of build.py to extra_compile_args=['std=c99'],

@cleardusk cleardusk reopened this Nov 20, 2020
@cleardusk cleardusk pinned this issue Nov 20, 2020
@GuoQuanhao
Copy link

if you got "cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'" error
modify 47 line of build.py to extra_compile_args=['std=c99'],

cl: 命令行 warning D9024 :无法识别的源文件类型“std=c99”,假定为对象文件
cl: 命令行 warning D9027 :源文件“std=c99”被忽略

@ghost
Copy link

ghost commented Dec 31, 2020

do you know how to generate the 3D render picture with color?
thanks.
@cleardusk
@JacksonL1

@JacksonL1
Copy link

@chenbolinstudent
the first version of 3DDFA has implement code.
I think you can refer to that code

@ghost
Copy link

ghost commented Dec 31, 2020

@JacksonL1
I want to get such 3D render picture with color. can the code do it ?
103268599-b0ab6a00-49ee-11eb-90e7-686e276a5586

@ghost
Copy link

ghost commented Dec 31, 2020

@JacksonL1
transfer .obj to png

@JacksonL1
Copy link

@chenbolinstudent face3d this project will help you.

@ghost
Copy link

ghost commented Jan 4, 2021

it only transfer .mat to png ?
not transfer .obj to png?

@ghost
Copy link

ghost commented Jan 5, 2021

@JacksonL1
@cleardusk
I can not transfer .obj to png.
can you do it ?

Repository owner deleted a comment from yangjian1218 Dec 21, 2021
@jylovec
Copy link

jylovec commented Feb 16, 2023

@JacksonL1 @cleardusk I can not transfer .obj to png. can you do it ?

use trimesh module.

@dongfeicui
Copy link

dongfeicui commented May 11, 2023

On windows10, please uncomment extra_compile_args={'gcc': ["-Wno-cpp", "-Wno-unused-function"]}, in FaceBoxes/utils/build.py line 46

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

No branches or pull requests

6 participants