boris-kz / CogAlg

This project is a Computer Vision implementation of general hierarchical pattern discovery principles introduced in README
http://www.cognitivealgorithm.info
MIT License
91 stars 41 forks source link

Implemented the C++ version native wrapper for from_p #34

Closed MayukhSobo closed 4 years ago

MayukhSobo commented 4 years ago

Implemented the faster version of from_P_ in C++11 and integrated it with a C++/Python wrapper. We achieved performance improvement of several folds.

boris-kz commented 4 years ago

Thanks a lot Mayukh! Khanh will go over your code soon, he is currently busy.

MayukhSobo commented 4 years ago

The C++ code is present in the first PR

boris-kz commented 4 years ago

Thanks, I realized that a minute later 😀

On Mon, Jan 27, 2020, 11:56 AM Mayukh Sarkar notifications@github.com wrote:

The C++ code is present in the first PR

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/boris-kz/CogAlg/pull/34?email_source=notifications&email_token=AFABOGMDAF47L4344LLV4H3Q74G2TA5CNFSM4KL7ZOPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKAHNWQ#issuecomment-578844378, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFABOGPEFX4DV4TG3XCNY2TQ74G2TANCNFSM4KL7ZOPA .

kwcckw commented 4 years ago

didn't realize we can just call the c++ library in python in this way. f_p.i, f_p.h, f_p.cpp are used for the formP function right? and the header file was used to import the library in python environment. I also can see there's a numpy.i, is this in used as well? I guess the complicated part is the integration, to convert the variable so that it is parse-able between c++ and python?

boris-kz commented 4 years ago

I think we should keep this version separate for now. Mayukh, could you post it in your repo instead, I may copy-paste it latter?

On Mon, Jan 27, 2020 at 8:41 PM Kok Wei notifications@github.com wrote:

didn't realize we can just call the c++ library in python in this way. f_p.i, f_p.h, f_p.cpp are used for the formP function right? and the header file was used to import the library in python environment. I also can see there's a numpy.i, is this in used as well? I guess the complicated part is the integration, to convert the variable so that it is parse-able between c++ and python?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/boris-kz/CogAlg/pull/34?email_source=notifications&email_token=AFABOGP5EJMDOOGGLN3PLVTQ76EK7A5CNFSM4KL7ZOPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKBXBPY#issuecomment-579039423, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFABOGOX3CELNC4QM3X37XTQ76EK7ANCNFSM4KL7ZOPA .

ninjakx commented 4 years ago

@kwcckw: numpy.i is the file which we have taken from numpy Github repo . This is used for handing N-D arrays since we are passing 2D arrays from python and using it on cpp code. So it's helping us to interface that. Yes, f_p.i, f_p.h, f_p.cpp are used for the formP function.

I guess the complicated part is the integration, to convert the variable so that it is parse-able between c++ and python?

Yes.

kwcckw commented 4 years ago

I tried and facing issue to install the SWIG. I'm using window and following the guide in your readme:

Is the workflow supported in window? Since in window we do not have usr but C:/Users instead

img
MayukhSobo commented 4 years ago

@khanh93vn I am sorry that you are having issues using shared_ptr but let me assure you that shared_ptr is available from C++11. Only some features of shared_ptr like element_type or weak_type are C++17 feature. https://en.cppreference.com/w/cpp/memory/shared_ptr also confirms that it is a c++11 feature. Please check your compiler settings.

coalg

You can see that I am able to compile the code with c++11 only.

Here is my g++ info

g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE

MayukhSobo commented 4 years ago

@kwcckw Please follow the following page to install swig on Windows machine.

http://www.swig.org/Doc1.3/Windows.html

PS: We never build the code on windows. But there is a support for windows and swig.

khanh93vn commented 4 years ago

Thank you, I'll try again with different settings