Speaker independent voice command recognition I am looking for a software, a library or an algorithm that can be trained to recognize about a dozen speaker independent voice commands. The commands will be very distinct phrases of 4-5 words each. They can be chosen to sound very different from each other. Additionally, the commands will be in more than two different languages. The user will be guided to say only the exact phrases and talk slowly, loud and clear in front of the microphone.

I am currently looking for an algorithm that can compare speech spectrograms and give me a matching percentage, but no luck so far. Any ideas?

If it helps, the code can be written for the specific phrases only, and, in worst case, the phrases can be reduced to 3 or 4.
Software

There are many many speech recognition toolkits and software packages, which should be able to do what you want.  See, e.g., https://en.wikipedia.org/wiki/List_of_speech_recognition_software for a partial list.

For instance, if you're looking for open source software, you could try Sphinx, Simon, or any number of other software packages.  They can be trained in various ways, and probably can be used for what you want.  There are also many proprietary speech recognition tools, which might meet your needs as well.

Algorithms

The algorithms used by speech recognition systems are pretty standard.  You split the audio into frames, use the MFCC transform to compute Mel features, then use Dynamic Time Warping or a HMM with Gaussian mixture model to recognize the spoken phrases.  I would anticipate this standard pipeline would likely work for your requirement, if you train it appropriately.

(I'm not sure why you want to start from a spectrogram rather than from the audio clip itself.)