• Graeme Devine

GIGO

There’s one golden rule in computer science. GIGO.


Garbage in. Garbage Out.


The phrase originated sometime in the 50s, but it’s real origins can be traced all the way back to Charles Babbage himself.


"On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.”


And that brings us to the video below.




The cube represents pose, believe me, you want the cube representing pose and not the camera. If it was the camera we’d be looking at a blur of pixels.


Now, obviously something isn’t right. The thing that stuck out at me for a while, wrongly, was that the cube mostly stays in place and flips out on occasion. That turned out to have nothing to do with the bug. That was just in the way I was updating the rotation values of the cube.


You may recall I’ve been busy taking the accelerometer data of the mobile device, encoding it, sending it encrypted over WebRTC to the server, and then into Unreal, and then into the machine learning system where it becomes a packet.


That packet should be something like “1,0,0,0,1,0,0,0,1” (that’s a straight up identity matrix, if you hold your phone flat really really still, you’ll still never get that close to it). Instead it was more like “NAN, NAN, 0, -143535345, NAN, 1e3232 etc”. NAN means in floating number speak “Not A Number”.


Turns out, I had completed the journey of the accelerometer packet just fine, it got all the way to the “make a packet for the machine learning system” stage where it (ha, it, I mean me) decides to just use some temporary memory that goes away as soon as the job is submitted to the machine learning system (the machine learning system takes jobs, satisfying all the inputs in an order that lets it sort out the result once it hits the final output value).


No matter how you multiply, try to fix, scale, leap, filter or massage garbage data you will never achieve the result you want.


This actually reminds me of a funny story about Brazil and Iceland.


One day at Apple I was called into a meeting. “Graeme, we’ve got a problem. The accelerometer uses a magnetometer that is sensitive to its position on the planet. Users near the North and South Pole and in some regions of China don’t have good compass data or IMU data because of this. Eventually the sensor gets enough data to fix itself but it takes too long so we want to do it at the factory.”


I was all “uh huh”


They then proceeded to show me that they had a 14”x14” place on the factory floor that could spend 30 seconds working this out. The current time it took was minutes. Which was unacceptable. The current machine was also not 14”x14”.


So we worked on it. I didn’t have anything to do with the machine but I worked on the test software. Eventually we got it down to about 20 seconds, it chooses one of several defaults based on data we had already collected depending on how that phones IMU responded to a spin, and that was that.


Oh boy, and that reminds me of the Jenga demo Steve Jobs gave on stage. My team wrote that, but… there’s a story there for a beer.


See, GIGO. Golden rule of computer science. And blogs.


Graeme.