diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2151e3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +__pycache__ +*.so +lib/coco/PythonAPI/build/ +lib/coco/PythonAPI/pycocotools/_mask.c +lib/multicut_cython/build/ +lib/multicut_cython/multicut.cpp +lib/nms_cython/build/ +lib/nms_cython/nms_grid.cpp +models/mpii/mpii-single-resnet-101.* +models/coco/coco-resnet-101.* +models/coco/pairwise* diff --git a/README.md b/README.md index afe49a7..41aecbe 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,15 @@ In _Conference on Computer Vision and Pattern Recognition (CVPR)_, 2017** For more information visit http://pose.mpi-inf.mpg.de Python 3 is required to run this code. -First of all, you should install TensorFlow as described in the -[official documentation](https://www.tensorflow.org/install/). -We recommended to use `virtualenv`. +On Linux, you may need to install the `python3-dev` and `python3-tk` packages. -You will also need to install the following Python packages: +We recommended using `virtualenv` to create an isolated Python environment. + +You will also need to install the Python packages listed in `requirements.txt`, +including TensorFlow: ``` -$ pip3 install scipy scikit-image matplotlib pyyaml easydict cython munkres +$ pip install -r requirements.txt ``` When running training or prediction scripts, please make sure to set the environment variable @@ -82,4 +83,3 @@ Please cite ArtTrack and DeeperCut in your publications if it helps your researc url = {http://arxiv.org/abs/1605.03170}, author = {Eldar Insafutdinov and Leonid Pishchulin and Bjoern Andres and Mykhaylo Andriluka and Bernt Schiele} } - diff --git a/lib/multicut_cython/multicut.pyx b/lib/multicut_cython/multicut.pyx index 44560d4..3b2e7cd 100644 --- a/lib/multicut_cython/multicut.pyx +++ b/lib/multicut_cython/multicut.pyx @@ -24,7 +24,7 @@ def solve_nl_lmp(np.ndarray[np.float64_t, ndim=2, mode="c"] unary_array, is_sparse_graph, solver_type, do_suppression, logit_in_solver): - cdef np.ndarray[np.uint64_t, ndim=2, mode="c"] result = np.zeros([unary_array.shape[0], 2], dtype=np.uint64) + cdef np.ndarray[np.ulonglong_t, ndim=2, mode="c"] result = np.zeros([unary_array.shape[0], 2], dtype=np.ulonglong) solve_nl_lmp_cpp(&unary_array[0, 0], unary_array.shape[0], unary_array.shape[1], &pwidx_array[0, 0], pwidx_array.shape[0], pwidx_array.shape[1], diff --git a/lib/multicut_cython/solve_nl_lmp.hxx b/lib/multicut_cython/solve_nl_lmp.hxx index 4113d89..3a5bee3 100644 --- a/lib/multicut_cython/solve_nl_lmp.hxx +++ b/lib/multicut_cython/solve_nl_lmp.hxx @@ -5,19 +5,21 @@ #include +#include + #include #include using namespace std; -template +template andres::View get_view2d(T *gridData, int grid_height, int grid_width) { std::array shape; shape[0] = grid_height; shape[1] = grid_width; - andres::View view(shape.begin(), shape.end(), gridData, andres::FirstMajorOrder); + andres::View view(shape.begin(), shape.end(), gridData, andres::FirstMajorOrder); return view; } @@ -26,7 +28,7 @@ void solve_nl_lmp_cpp(double *unValues, int un_H, int un_W, uint16_t* pwIndices, int pwi_H, int pwi_W, double* pwValues, int pwv_H, int pwv_W, bool is_sparse_graph, bool solver_type, bool do_suppression, bool do_logit_transform, - uint64_t *result) + unsigned long long* result) { andres::View pwind_view = get_view2d(pwIndices, pwi_H, pwi_W); andres::View un_view = get_view2d(unValues, un_H, un_W); @@ -58,12 +60,12 @@ void solve_nl_lmp_cpp(double *unValues, int un_H, int un_W, else { //unLab = solve_lmp_complete_graph(un_view, pwind_view, pw_view, do_suppression); - unLab = solve_nl_lmp_complete_graph(un_view, pwind_view, pw_view, method, do_logit_transform, do_suppression); + unLab = solve_nl_lmp_complete_graph(un_view, pwind_view, pw_view, method, do_logit_transform, do_suppression); } } assert(unLab.size() > 0); - andres::View result_view = get_view2d(result, un_H, 2); + andres::View result_view = get_view2d(result, un_H, 2); for(int k = 0; k < un_H; ++k) { result_view(k, 0) = unLab(k, 0); diff --git a/lib/nms_cython/include/nms_scoremap.hxx b/lib/nms_cython/include/nms_scoremap.hxx index f0bdb67..1ce528e 100755 --- a/lib/nms_cython/include/nms_scoremap.hxx +++ b/lib/nms_cython/include/nms_scoremap.hxx @@ -4,6 +4,8 @@ // #include +#include + #include #include @@ -25,11 +27,11 @@ std::vector nms_grid_cpp(const float *unProbValues, size_t height, size_t w // cout << "width: " << width << endl; const size_t num_locs = height * width; - // MA: is this row or column major? + // MA: is this row or column major? std::array shape; shape[0] = grid_height; shape[1] = grid_width; - andres::View grid(shape.begin(), shape.end(), gridData); + andres::View grid(shape.begin(), shape.end(), gridData); std::vector indices(height*width); for(int i = 0; i < num_locs; ++i) @@ -100,7 +102,7 @@ std::vector nms_grid_cpp_test(float *unProbValues, size_t height, size_t wi std::array shape; shape[0] = height; shape[1] = width; - andres::View grid(shape.begin(), shape.end(), unProbValues); + andres::View grid(shape.begin(), shape.end(), unProbValues); std::cout << "Hello fuck! " << height << " " << width << std::endl; std::vector result; @@ -108,4 +110,4 @@ std::vector nms_grid_cpp_test(float *unProbValues, size_t height, size_t wi result.push_back(3); result.push_back(1); return result; -} \ No newline at end of file +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8943662 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,9 @@ +cython +easydict +matplotlib +munkres +numpy +pyyaml +scikit-image +scipy +tensorflow