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

PyGRT: Python bindings for GRT via SWIG #151

merged 15 commits into from Jun 5, 2019


Copy link

@royshil royshil commented Jul 11, 2018

This implements a Python API for GRT.

Enables writing Python code like this:

    print("Loading dataset...")
    training_data = GRT.ClassificationData()
    print("Data Loaded")
    # Print out some stats about the training data
    print("Splitting data into training/test split...")
    test_data = training_data.split(80)
    # Create a new Gesture Recognition Pipeline
    pipeline = GRT.GestureRecognitionPipeline()
    # Add a KNN classifier to the pipeline with a K value of 10
    knn = GRT.KNN(10)

    print("Training model...")

I started with the examples to get a good API coverage.

The Travis build fails because the MLPRegressor unit test fail, i.e. the problem is not with this code, but GRT itself.

@royshil royshil changed the title PyGRT: initial commit. pygrt build pipeline. barebones examples PyGRT: Python bindings for GRT via SWIG Jul 19, 2018
Copy link

Hey there Roy,

I was trying to use your PyGRT, but got stuck trying to build up everything properly. I kindly wanted to ask whether you could help me out. After I build the binaries with CMake into the tmp folder (just like described in the README from Nick ... I'm on Windows), I then open the ALL_BUILD.vcxproj (in that tmp folder) in Visual Studio and build/compile ALL_BUILD.

This doesn't build correctly, but it does build the python package. In the python package I can also find the, but not the When I create a new project in that build/tmp/python directory it works out to import the GRT but if I compile the I'll get the following error:

"C:\Program Files\Python37\python.exe" "D:/szameitat/Documents/Programming Projects/8_Python/GRT/tmp/try2/grt-roy.pygrt/build/tmp/python/"
Traceback (most recent call last):
File "D:\szameitat\Documents\Programming Projects\8_Python\GRT\tmp\try2\grt-roy.pygrt\build\tmp\python\", line 14, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Python37\lib\", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named '_GRT'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:/szameitat/Documents/Programming Projects/8_Python/GRT/tmp/try2/grt-roy.pygrt/build/tmp/python/", line 1, in
import GRT
File "D:\szameitat\Documents\Programming Projects\8_Python\GRT\tmp\try2\grt-roy.pygrt\build\tmp\python\", line 17, in
_GRT = swig_import_helper()
File "D:\szameitat\Documents\Programming Projects\8_Python\GRT\tmp\try2\grt-roy.pygrt\build\tmp\python\", line 16, in swig_import_helper
return importlib.import_module('GRT')
File "C:\Program Files\Python37\lib\importlib_init
.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_GRT'

Process finished with exit code 1

Also the Error List from Visual Studio after trying to build "ALL_BUILD":

I'd be glad if you or anyone else could help!

Copy link
Contributor Author

royshil commented May 29, 2019

I won't be able to help with a Windows build. One thing I'd expect is that there will not be a output file rather a GRT.dll (using MSVS). Anyway I'd start with fixing the build of the library itself, and see that it completes without errors. The Python package is almost just garnish.

Copy link

This is great, thanks for the contribution. Apologies that this took so long to merge.

@nickgillian nickgillian merged commit ffa7690 into nickgillian:master Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants