Imran's personal blog

April 21, 2016

codec2 sparse map

Filed under: Uncategorized — ipeerbhai @ 12:33 am

I’ve been playing with Codec2 and sparse maps.

Sparse maps are an idea I saw from an AI firm ( numenta? )  about how to visualize and filter vector arrays.  The basic idea is that you take a vector ( can be a binary vector, but could be a vector of ints ), assign some color value to some numbers, and spread the vector over a 2d map.  From this map, you can find some number of clusters, and those clusters are essentially concepts.  You build masks of these concepts to see if an output contains the concept.  They use it in natural language search.

I took an open source codec called codec2 and build a sparse map of 71 frames of me saying, “ah” and “sh”, and put that into a 640×480 picture from the codec’s 51-bit frames.

So, a frame is a vertical line in the picture.  bit 0 is the top, bit 51 is the bottom of the line.  Each 9×9 block represents either a 1 or a 0.  Red colored 9×9 blocks are 1, Green 9×9 pixel blocks are 0.  Frame 0 is the leftmost vertical line, and frame 71 is the rightmost.  There are no spaces between the colored blocks, so it looks continuous, but is really discrete blocks.  I did this in C#, so there will be byte order flipping issues which I haven’t corrected for ( essentially, BitArray.Copyto(byte[]) will copy in little-endian order which I then bitshift back into order, even though the bit array is in concatenated bit order — something I’ll fix later, but this error is consistent, so the generated color map is also consistent ).

The results are staggering.  Here’s the picture of “ah”


Here’s the picture of “sh”


These maps look interesting — I think a filter masks might be able to detect either:

  1. my voice.
  2. the phones being spoken.

Of course, this could be a dead end.  I haven’t seen if I can generate masks from this yet — but it looks super interesting, so I thought I’d share.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

%d bloggers like this: