Tuesday, August 15, 2023

New Accelerometer Data, and more NN 'mind'

I've finally rigidly connected my accelerometer to my e-bike, and recording the g-force in x, y, z, and total.  The signal to noise has improved greater than a factor of two.  Here's a recording before the new connection, and then after the new connection.  You can clearly see that the signal is stronger on the bottom plot


This produces spectrograms that are much more complex.  Here's a spectrogram of the x data before the new connection:



... and then after the new connection:


I have no idea what all of those peaks are, and why they wander around so much.  I can still see the 6 Hz line (which is the tire rotation), which in this case looks pretty steady -- so those wiggly lines probably aren't correlated with speed.  Some lines go up while at the same time others go down, so I have no idea what I'm seeing.  Obviously vibrations of some sort, but I'm not sure where they're coming from, and most likely they're coming from multiple sources.

Here's the same two data sets, but looking at the y-axis data (this one surprised me a little):





I'll be collecting the acclerometer data with this configuration for the forseeable future.  The S/N is great and the spectra are baffling!

In other news, I'm starting to convince myself that grabbing 65536 points from every 128 values is the correct way to go since that the structure of the python arrays and the output model (via layer.save_model()).  There are still strange patterns, but some of those are probably residuals from the convolutions and pooling in previous layers.  Anyhow, maybe this is pretty convincing:






so, maybe this is correct.  Gotta convince myself somehow.  I'll look at the weights from the other models I have and see what they can show me.  For now, these are weights created from synthetic image training (ahem, I think).

Here's what I said on my discord server:

"An attempted visualization of one set of weights of one 'dense' layer of my fully trained multi-layer convolutional neural network.  The white borders are not part of the model: they represent the structure of the input data to this layer (in this case, 64 32x32 'images').  The weights shown here are applied to the input data (via a simple dot product), which results in a single data value as an output.  This output (along with all other outputs in this layer) is then used as input for the next layer in the network."


Monday, August 14, 2023

Looking at the 'mind' of a Neural Network

This is an ongoing project, but since I've got a nicely trained convolutional neural network sitting around, I'm trying to figure out what's going on under the hood.  No one seems to know, so I figure that's a pretty good spot for me.

First trick is to gain access to the weights stored in a trained CNN.  Once I have these, I can 'display' them in various forms to see if I can pick out any discernible patterns that might lead me to a breakthrough.  The format of the input weight file took a little while to figure out, and I'm pretty sure I'm reading it in correctly.  The output 'image' might be where I'm currently going wrong.

What bothers me about what I'm currently seeing is that there are patterns that probably shouldn't be there.  Here's a good example:




I'm pretty sure the similarities in columns is indicative of a read/write problem.  I'll figure it out, but ugh.

Sunday, August 13, 2023

Audio recording of e-bike ride

Here's a spectrogram of some of the audio of my ride on my e-bike today:



That wiggly line bothers me.  I can hear it in the recording, and it's definitely the electric motor making that sound.  The other thing is that I think either I've got the gain on the recorder too low (it's set to '20' for this data set), or having the recorder in my backpack is muffling (attenuating) the sound so much that the signal isn't very strong.  When I listen to the recording, it sounds like it's peaking, although the data doesn't indicate that.

Here's about the first four minutes of my outbound journey:


Also some accelerometer data with the recording device connected to the bike (as opposed to in my backback as it has been).  This is a short trip -- about 2.5 miles out, and 2.5 miles in.  You can clearly see the three times I hit the brakes near the beginning and end, and in the middle when I turned around.  Round trip is 789.5 seconds.


is this any better than what I already had?  Not sure yet.  I'm thinking that the device attached to the bike would have better S/N than the device flopping around in a backback.  But this is definitely different than what i've seen before.  The 6Hz line is still there, but there are other things at lower frequencies, and some interesting high freq stuff....

Also, Perseids:




USL012, and USL011.

Thursday, August 10, 2023

Random Thoughts #1

 

cool graphic -- a nice reminder about what exactly pH (and other pX) is.

... and in other news, I am now correctly (as far as I can tell) 'viewing' the weights of a trained convolutional neural network model:



Thursday, August 3, 2023

Bike accelerometer data

Instead of coming up with a way to 'correctly' attach my accelerometer onto my electric bike (which has only delayed this project), today I just set the thing recording and threw it in my backpack.

The accelerometer on my phone collects data at about 203Hz, so the highest frequency it can deal with is about 100Hz.

Technical problems failed to record my outbound ride, but my inbound ride was recorded.  Here's the data:



... and here's the spectrogram (using a 256 sampling window in a 4096 pad):




spectral range (left to right) goes from 0 to about 100 Hz.  Temporal range is about 900 seconds, doing from top to bottom.

That bright white wiggly line is about 6 Hz.  This corresponds to the rotational frequency of the tires if traveling about 28 mph -- which I was!  The line is wiggly because I'm contantly slowing down and speeding up.

Check out the harmonics!

Pretty decent S/N -- I think I can work with this...

Here's a plot of the average spectrogram, which is just the sum of each row from the image above.  The peak is about 5.84 Hz, which with 26 inch wheels works out to an average speed of 27.1 mph.  I can't account for those other smaller peaks to the left at about 4 Hz and 1.6 Hz.