OpenCV mergevec issues - python

I'm running windows 7, and i'm trying to get some haar training done to make a haar classifier. I've got to the point were i need to merge a folder full of .vec files. I've been working on this for the better part of a day. I've tried following coding robin's tutorial but i get an error of:
g++.exe": pkg-config: No such file or directory
g++.exe": opencv -I.: No such file or directory
g++.exe": installation problem, cannot exec `cpp': No such file or directory
is this "installation problem" a problem with my g++ install? I'm still not sure.
those files (or directories) aren't in my opencv folder so i'm not really sure what to do about that. I vaguely remember reading that those were for if you were installing it with linux or something so i tried a different method.
I couldn't get Naotoshi Seo's to work because i can't download the mergevec.exe file anywhere. I always get a "your computer or network may be sending automated queries. To protect our users, we can't process your request right now." I've done virus scans i've tried downloading from different computers and networks nothing works. since the previous method of compiling the mergevec.cpp file didn't work for me either, I then looked for yet another method where i found this tutorial[3] for using python. So I installed python 2.7.9 and ran this in command prompt
"C:\Users\Austin\Desktop\Recog_Project>python mergevec.py -v samples -o weed_samples.vec"
and i got this as a result
Traceback (most recent call last):
File "mergevec.py", line 170, in <module>
merge_vec_files(vec_directory, output_filename)
File "mergevec.py", line 133, in merge_vec_files
val = struct.unpack('<iihh', content[:12])
struct.error: unpack requires a string argument of length 12"
I don't know what to do anymore to try and get this to work.
I've tried installing Ubuntu on a virtual machine, but i can't even figure out how to change the resolution from 640:480. Ran these commands in terminal and restarted and got nothing.
sudo apt-get install virtualbox-guest-dkms
virtualbox-guest-utils virtualbox-guest-x11
I also did something with some drivers but I can't remember what it was. basically this is my last hope. I'm out of ideas. I'll of course keep looking and for answers and will post any progress i make. Any help at all would be greatly appreciated as my job is on the line. I could skype screen share if it would be helpful too.
Thanks in advance.
3: github.com/wulfebw/mergevec guess i need more rep to post additional links.

Someone answered this within a few hours on the opencv Q&A. If you have any OpenCV questions i highly recommend you go there first as it is much more likely that someone will answer your question on their page. Here's the answer i received.
You do not need to merge vec files for object classifier training using the cascade of weak classifiers approach. I keep wonder why the hell people merge vec files, and always the answer is because they want to create artificial data vectors. Avoid this at all costs if you want you models to do something with sense.
Skip the complete haar training interface and move on to the traincascade interface, which is better supported, more bugfree and better supported.
Start with the traincascade and createsamples information in the Description.

Related

xkbcommon: ERROR: failed to add default include path

Whenever I start a python script that tries to access the keyboard, for example, with OpenCV's waitKey() method, I get the following error:
Qt: Failed to create XKB context!
Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, add ':' as separator to provide several search paths and/or make sure that XKB configuration data directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ .
This error started to appear when I installed the keyboard library (or pynput, I am not quite sure) and persisted after I uninstalled them. I do not have QT installed.
Also, neither OpenCV's waitKey nor the two installed libraries can detect any key events (I suspect this is connected), which was already the case before I got the error though.
I am running on Ubuntu 18.04.
How can I go about this problem?
I think this recent issue was resolved here:
https://github.com/conda-forge/qt-feedstock/issues/104
I think the solution is
export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb
but I'm not an expert... somebody back me up here please.

Trouble setting up 'Bachbot': Python gives no such command-error while installed correctly?

I am trying to set up Bachbot (https://github.com/feynmanliang/bachbot) on my Windows 10 system in Python 3.5.1, Anaconda 4.0.0. Though doing several attempts, I keep failing at getting this to work. I downloaded the source code from github (didn't use Docker) and got to work.
First thing that's good to know is that I changed all print statements and added parantheses. Furthermore I changed every import of cPickle to
import _pickle as cPickle
since I'm using a newer version of Python. By doing this, I cleared all compile errors, but now I'm stuck at the first few steps of getting the program to work. When calling
bachbot chorales prepare_poly
I get an error
Usage: bachbot-script.py [OPTIONS] COMMAND [ARGS]
Error: no such command "chorales"
I figured the chorales script is part of the music21-module, which I installed on my computer using pip.
As far as I know I followed the installation steps more or less correctly (see github Getting Started and Workflow):
run activate script
run pip install --editable .
2.5 (installed the missing module music21)
run bachbot chorales prepare_poly
I suspect it has something to do with the entry point but I can't put a finger on what's wrong. I tried several re-installs but that does not seem to do the trick.
I would be grateful if someone could help me with this. Thanks in advance!
My apologies, I was rushing to get the thesis in on time so the documentation is not the best!
The commands for building the polyphonic dataset and training the model are:
bachbot datasets prepare
bachbot datasets concatenate_corpus scratch/BWV-*.utf
bachbot make_h5
bachbot train
To use the model trained for $ITER iterations to generate samples with a sampling temperature of $TMP:
bachbot sample ~/bachbot/scratch/checkpoints/*/checkpoint_<ITER>.t7 -t <TEMP>
bachbot decode sampled_stream ~/bachbot/scratch/sampled_$TMP.utf
The first and last section of a recent presentation I made summarizes this workflow.
By the way, I would recommend using the Docker image described in the presentation I linked. While the CLI is in Python, the actual LSTM has additional dependencies (e.g. Lua, Torch, CUDA if you plan on using a GPU).

"SignatureError: Failed to verify signature" - Okta, pySAML2

For three days, I have been pulling my hair out trying to wrap my head around Okta & SAML.
On my local machine (OSX Mavericks), I am able to successfully follow the steps listed here: http://developer.okta.com/docs/guides/pysaml2
Things work.
But moving everything over to our production server, which is a CentOS box, running nearly identical code, I am faced with this "SignatureError: Failed to verify signature" error.
Traceback (most recent call last):
auth_response = saml_client.parse_authn_request_response(SAMLResponse, entity.BINDING_HTTP_POST)
File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/client_base.py\", line 599, in parse_authn_request_response binding, **kwargs)
response = response.loads(xmlstr, False, origxml=origxml)
File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/response.py\", line 510, in loads self._loads(xmldata, decode, origxml)
File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/response.py\", line 335, in _loads **args)
File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/sigver.py\", line 1756, in correctly_signed_response
class_name(response), origdoc)
File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/sigver.py\", line 1571, in _check_signature
raise SignatureError(\"Failed to verify signature\")
SignatureError: Failed to verify signature
I have scoured the internet looking for a way to troubleshoot this error. I am new to SAML and Okta.
My assumption is that this has something to do with xmlsec1 acting differently on our production machine. But the versions are identical. There are many dependencies so I'm not sure where the problem might be.
Has anyone ran into this error? Any thoughts on what I might be able to try?
I know this is a little late, but in case someone else runs into this:
pysaml2 provides a lot of logging using python's built in logging, I defined a handler for saml2.sigver and that gave a lot of info. In those logs I found this:
Error: unable to load xmlsec-openssl library. Make sure that you have
this it installed, check shared libraries path (LD_LIBRARY_PATH)
envornment variable or use "--crypto" option to specify different
crypto engine.
Turns out I needed to install xmlsec1-openssl.
Hope this helps someone in the future.
Dealing with xmlsec1 can be extremely frustrating!
The main thing that I suggest doing is enabling debugging in PySAML2, and/or setting the PYSAML2_KEEP_XMLSEC_TMP environment variable, and/or manually enable this code path in sigver.py - the general idea is to get a look at xmlsec1 command that PySAML2 is calling and have PySAML2 leave the temporary files around so that you can test the commands yourself.
As I recall, most of the issues that I've run into in the past involved PySAML2 not finding the xmlsec1 binary. The get_xmlsec_binary() function in sigver.py is responsible for finding the xmlsec1 binary. I suggest that you take a look at the code in get_xmlsec_binary() and make sure that it is looking in the right places on your system.
Depending on the operational system you will also need to install additional libraries.
In my case, I got the issue on a CentOS server, so I needed to install more 2 dependencies in addition to xmlsec1:
yum install libffi-devel xmlsec1 xmlsec1-openssl
This solved my problem.
You should also have a look on Okta's documentation. They have a guide on how to use PySAML2 to add support for Okta (via SAML) to applications written in Python.
https://developer.okta.com/code/python/pysaml2/

Trying to include pypoker, poker-eval package in Python

Ok, so I finally got poker-eval and pypoker to install correctly. If I go to the pypoker folder in cygwin, and type python test.py, it runs the program fine. However, if I copy the test.py file over to a netbeans project main file, I get the error ImportError: No module named _pokereval_2_7. The problem is, I am using wxpython, and it won't let me execute my program from cygwin. I am using NetBeans, so my entire project is developed there. If I try to include pypoker-eval, I get this error.
> Traceback (most recent call last):
> File
> "C:\Users\JeremyLaptop\Documents\NetBeansProjects\testing\src\testing.py",
> line 36, in <module>
> from pokereval import PokerEval File
> "C:\Users\JeremyLaptop\Desktop\pypoker-eval-137.0\pokereval.py",
> line 29, in <module>
> _pokereval = __import__('_pokereval_' + sys.version[0] + '_' + sys.version[2])
> ImportError: No module named _pokereval_2_7.
I have been trying to figure out how to get this to work for hours, hopefully one of you guys can help.
FYI: Windows 7, pypoker and pokereval folders are on my desktop. Projects are saved in C:/users/myname/my documents/netbeansprojects.
A quick look at the source code makes it seem that Python 2.7 is not supported by that library. Try using Python 2.6 instead.
An example of a ready made Texas Hold'em 7- and 5-card evaluator can be found here with documentation and further explained here. It goes by the name of "SpecialKEval". All feedback welcome at the e-mail address found therein.
You can typically (~97% of the time) get away with just 6 additions and a couple of bit shifts. The algo uses a generated look up table which occupies about 9MB of RAM and is generated in a near-instant. Cheap. All of this is done inside of 32-bits, and "inlining" the 7-card evaluator is good for evaluating about 50m randomly generated hands per second on my laptop.
This might be a useful alternative to you in your project.
I had a similar problem. It did not install by default into the default location for my python installation. If something similar is going on for you, then it is probably just not in your PYTONPATH. You can get around that by providing one (or adjusting the path in netbeans, not 100% sure how to do this, but it should be a standard operation) or copying the contents of the site package into your project.

Why python.exe stopped working?

I try to use OpenCV for Python. I have just two lines of the code:
import cv
capture = cv.CreateFileCapture('test.avi')
If I run this code from the command line, Windows creates a window with the following message:
python.exe stopped working
A problem caused the program to stop working correctly.
Windows will close the program and notify you if a solution is available.
What can be the a reason of that?
I would like to add some details. Not sure if they are relevant. In the examples that I found people use cvCreateFileCapture instead of cv.CreateFileCapture. But in this case my program generate a NameError (cvCreateFileCapture is not found).
In general I was able to do a simple stuff with the OpenCV (so, it is installed and it works). For example I was able to change format of an image:
import cv
im = cv.LoadImageM("test.jpg")
print type(im)
cv.SaveImage("test.png", im)
ADDED
"In OpenCV2.2\samples\python" I found many *.py samples. I run some of them and they work fine (I see some animation and so on). The I tried to find a file that contains "CreateFileCapture". I found only one such file (minidemo.py) and I run it. As a result I got the same problem as described above.
Python on opencv has changed, see here make sure you have the latest opencv install - you might also need numpy

Categories

Resources