Hello. I shamefully return after years. I don't remember precisely why I stopped the blog posts, but I do remember it was a lot of second-guessing and procrastination and eventual death.
But I do not stay dead. I come back after every setback (after two years).
30-second recap of part 1 before we move on to part 2, since it's been so long. We discovered that:
Is there any way to make this better?
But I do not stay dead. I come back after every setback (after two years).
30-second recap of part 1 before we move on to part 2, since it's been so long. We discovered that:
1) Cooking takes time.
2) Glass bottles break.
3) There is an underground syndicate in this godforsaken university whose members are intent on stealing my orange juice. Therefore, to protect said orange juice, I must devise a barcode scanner. To do this, I need to learn (and bug other people) about how bar code scanning works.
Great! Now that we're all caught up, let's think about barcode scanning from the perspective of pattern detection.
When we scan a barcode, we shine a focused beam of light on it, and we detect how much of this light is reflected back from the barcode to distinguish between white lines and black lines in the barcode. The act of detecting how much light is being received is called photodetection.
This is all fine and dandy until your barcode is marginally lopsided. Then, suddenly, your system can't detect it at all. Or if it's a tad too far away, or a tad too close.
So, how do we reliably detect a pattern without instructing our scanner on how to handle each and every single possible orientation of our barcode? The answer lies... in the toilet.
No, really.
No, really.
Pattern detection: A Case Study
Remember from our 30-second recap above that cooking cost me a lot of time in my third semester of university? Therefore, the semester that I started this blog (my fifth-- more than halfway through), I opted for a meal plan, my logic being that I'd get back some leisure and study time that I'd otherwise spend cooking.
And thus comes the million dollar question: did I indeed have more leisure time in my day?
Hmm. Well.
For the sake of not laying out all my cards, let's just say that the answer depends on whether you count time spent on (and over) the toilet as "leisure time".
The good thing about this is that high-tech university toilets, in particular, gave me a perfect springboard into contemplating the photodetection algorithms that I'd need to build up my food safe. Let me elaborate.
Modern toilets try to be as touchless as possible to avoid spreading germs. Wash your hands without touching the faucet. Dry your hands without touching anything. Flush without pressing a lever or a button.
And that last statement is where the true question of detection comes in. Because sure, it's generally predictable enough to detect whether a person is washing their hands or intends to wash their hands, but how do you begin to detect whether a person is about to flush, whether you are flushing in response to a ghost and racking up your organization's water bill, or whether you are about to shoot toilet water up an unwitting patron's ass because they aren't done yet?
You might think, "oh, just install a pressure sensor below the toilet seat so you can tell when someone gets up", but all the men and hovering women out there know better... a lot of operations over the toilet are no-contact with the toilet seat.
The solution that my university seems to have come up with is... photodetection!
And it works... when I get up, the toilet flushes automatically.
But it also works...if you lean forward in your seat. If you lean backwards in your seat. If you decide to shake out your hands a bit 'cause you're feeling a little stiff.
Now, I know it's a man's world and that men believe that women love loud cars, so it's understandable to assume that women enjoy unexpected bursts of terror from loud, rudely interruptive, and unpleasant noises.
I can confirm that at least one of us does not enjoy this, and so the onus falls on me to wonder:
Is there any way to make this better?
First, the physical setup: the photodetector is on the wall, and is designated by a blinking light. When you place your hand over the blinking light, the photodetector detects a shadow. When you move your hand away, the photodetector detects light.
Let's start with a very basic approach. We want to detect when there is a person sitting on the toilet. This casts a shadow on the wall. When there's no shadow on the wall, we flush.
# 1 consideration: We specifically want the transition between shadow and no shadow. If we just set up a simple rule of "flush when there's no shadow", the entire Grand River's supply would be exhausted within 1 hour of nobody sitting on the toilet.
# 1 consideration: We specifically want the transition between shadow and no shadow. If we just set up a simple rule of "flush when there's no shadow", the entire Grand River's supply would be exhausted within 1 hour of nobody sitting on the toilet.
# 2 consideration: We want the transition from shadow to light to trigger the flush. If we set up a rule of "flush whenever there's a change", we're in for a very nasty surprise every time we sit down.
Great! Now we have a working system. Except...
... what if a short person sits down, casts a shadow on the wall, and then decides to begin scrolling TikTok? All is going well, they're taking their phone out of their pocket, they then lean forward and...
... their shadow slides off the blinking detector. And they slide off the seat in shock and terror.
OK. So now we need to figure out a way to deal with this. Move the blinking light lower along the wall is one, but then we need to find out exactly how much lower before someone who stands or hovers gets missed.
How do we fix this now?
Well, we could go a step further and keep time. We could set a rule: 5 minutes after a shadow disappears, we flush, no matter what. However, this is a disservice to the person who walks in immediately after a rapid firer has left. And God forbid they somehow choose to sit down after seeing this, only to be immediately bombarded with a Blast from the Past.
How do we fix this now?
Well, we could go a step further and keep time. We could set a rule: 5 minutes after a shadow disappears, we flush, no matter what. However, this is a disservice to the person who walks in immediately after a rapid firer has left. And God forbid they somehow choose to sit down after seeing this, only to be immediately bombarded with a Blast from the Past.
Now I know what you're thinking; there's no way to solve this! We don't have enough information! There are only two states: shadow and light.
OK. Let's level it up then. Let's say we can not only differentiate between shadow and light, but we get a grayscale value that tells us how far away we are from either shadow or light. For example, a distant shadow has a grayscale value of 100, while a paper up against the blinking light has a grayscale value of 0, and a light shining right on the blinking light has a value of 255.
OK. Let's level it up then. Let's say we can not only differentiate between shadow and light, but we get a grayscale value that tells us how far away we are from either shadow or light. For example, a distant shadow has a grayscale value of 100, while a paper up against the blinking light has a grayscale value of 0, and a light shining right on the blinking light has a value of 255.
At what grayscale value do we choose to flush? And what grayscale values should have preceded this one within the past few seconds for us to come to that decision?
We now have two elements to keep track of: time and grayscale value. And, unlike the case of "shadow" vs "no shadow", both of these elements can take on a range of values other than just "yes" or "no".
In the next blog post, we'll look at how multi-dimensional classification can solve this problem: something that humans do with relative ease, and the various ways we try to get computers to do them, from simple math to AI.
Comments
Post a Comment