digitalbrain79 / pyyolo

Simple python wrapper for YOLO.
126 stars 65 forks source link

python3 #10

Open stvogel opened 7 years ago

stvogel commented 7 years ago

I think pyyolo is currently build for python2. As I wanted to use it with python3, I had to make a few changes.

I'm not really used to git-pull-request I simply paste my changes here. Maybe it helps someone. I just added this in module.c (instead of initpyyolo):

static struct PyModuleDef cModPyYolo =
{
        PyModuleDef_HEAD_INIT,
        "pyyolo",
        "",
        -1,
        PyyoloMethods
};
PyMODINIT_FUNC PyInit_pyyolo(void)
{
        return PyModule_Create(&cModPyYolo);
}
digitalbrain79 commented 7 years ago

Your changes can build in python3 but not python2. Also python3 cannot import cv2 in example.py. Do you have any good idea?

Thanks,

stvogel commented 7 years ago

You are right. That was a python3-only solution

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef cModPyYolo =
{
        PyModuleDef_HEAD_INIT,
        "pyyolo",
        "",
        -1,
        PyyoloMethods
};
PyMODINIT_FUNC PyInit_pyyolo(void)
{
        return PyModule_Create(&cModPyYolo);
}

#else
PyMODINIT_FUNC initpyyolo(void)
{
...
}
#endif

This works for me (only tested on python3, though). And by the way, when I build without CUDNN the libraries: 'cuda', 'cudart', 'cublas', 'curand', 'cudnn' must be removed in setup.py

digitalbrain79 commented 7 years ago

I modified module.c. But I'm not familiar with the setup.py script. Could you add CUDA option in setup.py?

Thanks,