Wednesday, August 25, 2010

OCR for business cards' photos

I've been curious to try and do the character recognition on the photos of a few of the business cards that I made during the IETF (since otherwise the business cards turn into dust in my jeans' pockets - it was a much better option to make photos).

I've tried gocr, tesseract and the demo version of abbyyocr. The results were pretty much the same as I could find on the web otherwise: gocr was mediocre, tesseract was somehow promising (it could +/- reliably read name and surname - that were written in bold) - and the abbyyocr was actually half-bearable.

To the defence of the software, I must say that the images were far from being a typical OCR-food: shaded, distorted perspective - and the letters were a bit too small.

The interesting effect that I observed though, that when scaling the images *down* from the original to some ~80% the recognition quality increased in all the packages - with the abbyyocr getting to the point of being usable.

The time it took abbyyocr to do the recognition was notably longer. But, if I have to do OCR, among all three I will probably pick that one.

Thursday, August 19, 2010

We will, we will rack you

DISCLAIMER: in case you would not notice. It's a fiction piece - therefore any analogies to the real world are coincidental, hyperbolic and should not be interpreted outside the boundaries of this text or its continuation. Failure to do otherwise may cause the falling bowls of petunias. Thank you for taking care of our environment.


Your Caring Administration.



A swarm of tiny flying insects were hammering at Jack's door. They were so many that their sound resembled a heavy rain. And their synthesized sales chorus was resembling the machine at the dentist's.

".. - We will organize your data for as little as the rights to 2% of it yearly for the first 10 years after your death - .. ".

Damn. It hurts to be the last messed up guy in the area. These were automatic sales agents, tuned to find out the piles of unstructured non-indexed data, and to try to seduce the owners of that data to give it to the army of the all-mighty processing machines of Wiggle.

Wiggle, with their slogan "Your information wants to be free - don't be rude to it!", has expanded quite a lot in the past decade - from a small group of fanatic hackers obsessed with an idea to a large publicly traded corporation. Despite for its size it retained the passion and the hunger for the data that it had for the early days. Their operating principle was simple: you let them arrange your data for you and make it easily fetchable for you, in return you give them the full rights to a share of your information after your death.

For everyone it was as good as free - especially since the majority of the shareholders were in their early twenties - no matter how educated you are, at this age the death itself is a faint ghost, let alone whatever happens after the death - the full-brightness social interactions do not leave any other meaning to life other than "this!". And the letters you write - who cares what happens to them after your death. You won't be there. But it's great to be able to pull just the one you need from out the pile with the elegance of a card magician from the neighboring street.

First it was a neat parlor trick to impress the others, then it became an ubiquitous necessity of everyone's lives. The skills that were needed before were not anymore - this means you can free up that part of the brain for something else, yay! And everyone jumped on the bandwagon. Almost.

Jack was among those who did not. He preferred to keep his cards close to the chest. Not that he had much to hide - only the usual set of human screwups, but he felt naked otherwise. And that was something he hated, hated so much that he hung on to this habit even after it caused a few rather painful breakups - when people come to expect something as a natural property, the lack of it makes you "strange". Even if you think this property is something unnatural (and even if it is) - you are the one who is the gray swan - because you are "deviating from the norm".

Nonetheless, Jack knew where it was coming - that was why he was one of the early purchasers of the shares of Wiggle. And when the first deaths happened, the co-actors of the events that better be left private started to queue up to the offices of Wiggle in order to buy out the information they did not want to be free, literally off the deathbed of their best friends. As disgusting as it may seem - it did not involve selling drugs or trafficking the humans, nor killing the tuna, so it was good enough for Jack - who could happily retire and was now living in a house by the seaside of the El Hierro island.




... to be continued ...

Monday, August 16, 2010

A gift (2/2)

This is a (somewhat unexpected) continuation of the first part. A bit rough, would need further editing.



Heat in the head. Not the one you feel when you are ill, it's different. The heat you feel when you think hard about something. Like in the university,
when they give you a puzzle you haven't solved before, there's a time limit,
and the clock is ticking, and if you don't get it done - you fail the exam. Wait, what's this ticking sound ? Ah, indeed, there's a clock. He opened his eyes. And it shows just after five. He was about to think whether he slept at all when he realized something was strange. Something subtle. The bed, the bedroom it was in - all looked boringly usual. Finally it clicked.

Thin Mint cookie. On the headboard shelf, near the clock. Was that it ? No, something else. What was it ? Ah. His body. Missing. How ? Ah, obviously, that smiling old man and his "mind uploading". They must have kicked him subconscious and syringed a fair doze of cough medicine. But this would not explain this constant buzz in his head - even though his conscious brain was evidently idle, the subconscious obviously was not. But it must be just an effect of DXM. And in any case, the old mofo has ripped him off of 50 bucks - it's only one copy of him, that is visibly - no, mentally - present.

"Or two".

Now that was not him. And it was. The phrase felt like talking with himself yet it was not the controlled dialog - it was an interrupt that carried a wave of the annoyance that was suppressed.

"Idiot. You should not have asked for two copies. Now you get the suffering you deserve!"

- Why ?
- "Do I have to explain to you the perils of the non-standard setup ? Of course not - because it's me who is going to suffer!"
- Suffer from what ?
- "From doing all the work, goddamit! If you did not yet admit that this bloke was not joking, you better do it now! We are indeed now in the 'uploaded' state."
- And how does it work ? I venture it has to do with 6.443J which I missed almost entirely.. Brain alone would require an enormous amount of computational power to simulate - let alone the bed...
- "Probably it does. Because, being your copy, I can't fully comprehend it either.
If not your twaggering, I might have not ended up being such a dweeb."
- Hey, if we are two perfect copies, it's equally your fault same as mine. So, stop offending me, okay ?
- "Fine, you have a point. In any case - I came to consciousness a bit before you had, and searched a bit on this topic. I think this might have to do with the P-NP."
- Transistors ?
- "Idiot. Complexity."
- What would it have to do with the complexity ?
- "There was a supposed proof of it a few months ago. Which was proven incorrect, however it started a lot of talk around the subject. One of the reviewers observed that the problem of solving the 'P!=NP' is an NP problem in itself. The other reviewer observed that both the time and space are computational complexity resources. And the neuroscientists were exploring the hypothesis of quantum brain dynamics. This guy added 2+2 and went a bit further."
- I still can not make sense out of it...
- "That's because your brain is busy simulating me and the entirety of my world - that's where the feeling of 'puzzle' comes from. My and the entire world I am in is your puzzle you are trying to solve. Much like you and your world around you are now inside someone else's brain. Who is in turn inside someone else's brain, and so on. Much like you have with the russian dolls. Except they do not change in size - the time becomes slower so the space 'expands'. That's why it will never be anything later than just after five on this clock."
- But it ticks same as before!
- "That's your brain offering itself a stitch, so it did not go sideways like waves on the water. The sound of tick is local to your consciousness, while the picture of the clock in this case depicts the 'global' time. Don't ask me why."
- Great - so we have uploaded mind which has enough computing power to simulate another uploaded mind, which in turn simulates another one. What's the catch for the uploaded mind ?
- "There's none. Since there are more and more people coming in to the old man, the time has to slow down faster for those "outer" minds. So, their conscious part, with the speed of their thinking, never makes it to being overloaded by the computation required to 'simulate' the inner mind."
- Complicated.
- "It's exactly the same principle as the pension funds. You allocate them your money that you earn so they can invest it into the publicly traded companies, which then pay you this money as wages, which you invest into the pension funds. Your neighbor needs money, so he gets to borrow it from the pension funds, which then sell the debts to other pension funds for more money. The whole system works - if it didn't, you'd not be paying into your pension fund, right ?"
- If your description is correct to any extent and we both are not a split-mind after a hallucinogen overdose, we're past the point of needing to talk about the pension funds.
- "No, we are not. Since it's not just the mind, but the whole world that is emulated - there are pension funds in each of the nested 'russian dolls'".
- And do they all work the same everywhere ?
- "No, of course they do not. The complexity of solving the problem of pensions relates to NP same as NP relates to P."
- This guy is ambitious.
- "And very practical. Remember that you - me - we - paid hundred bucks. And you saw a couple of people coming in over a course a few minutes. So, he appears to have solved the problem of functioning pension funds."
- Does this mean he proved P=NP ?
- "Not at all. He cheated, somewhat. Really you do not care about the "NP" part as soon as you can enumerate all the alternatives fast enough. That's what he did for the best himself and the mankind - a computing device of an ever increasing capacity. It's like a blackhole but instead of sucking in the matter it sucks in the computational power, and overall becomes yet stronger. Or so is my theory - I am still not clear how he would suck out the excess of power that is left after all the work required to simulate the inner worlds."
- And how comes that we are able to talk just like that - if your theory is right then it should not be possible for me to be aware of each other, much like I am not aware of the existence of the "outer" person.
- "We are copies of the single brain. Again, this fact and the supposed quantum properties of the brain, even simulated, have to do with it. It's kind of I say 'bitter lemon' and it makes you feel the taste of it - even though you do not have a head now, much less the mouth and tongue. Don't bug me - I told you already, it's just guesses - you missed too many classes for me to be able to tell it any better".
- It's all good. I'm just killing the time - if your theory is correct, we're going to be the Lewis Carrol live - we are only missing Alice.

Alice Wong was happy - she was about to get married. She did not worry about the ceremony itself - her worry was her wedding ring. The future husband's father himself was supposed to bring it in. The wedding was starting at five sharp, and it was already four fifty seven - but the father was still not showing up.

Finally, she saw him getting through the crowd, to her future husband and giving the box to him. There was something unusual in his look. Maybe that he, oddly enough, had a moon-shaped cookie hooked to his suit - just in place where there'd be a rose. What an odd idea. But the old chap was a strange one. Noone knew how old he was, nor what he was doing. He did not seem to be very rich. But whenever his son started to talk about his plans after the marriage, the father always just hid himself under a friendly but a distant smile and mumbled something about the pension problem.

The ceremony began. The time seemed to fly right past by - even if the mechanical clock on the wall was ticking seemingly with the same speed as before... Here comes the moment... "Do you agree to be my wife ?" - "yes I do" - and he opens the box with the ring....

A gasp rolls over the the room, and dies into a complete silence. The stunning perfection of the crystal in the ring. She catches the reflection of the sun ray. It has the sophistication of hundreds of thousands of man-years of experience. The time stops. She sees an unbelievably fast caleidoscope of images, somewhere in the middle her mind captures the bed with the mechanical clock on it and a mint cookie - same as her now-husband's father had been wearing in his suit. And the clock shows exactly the same time.

It's just after five.

A gift (1/2)

It's been a grim week, each day filled with the non-stop replays of an early Monday morning. Shaldon looked out the window - the outside was not much better. The sky resembled a skin of a newly-born rat, but even the usually noticeable rats in the basement of the building turned quiet, fearing the storm outside.

How ironic, he thought - there's a village with the same name as mine. And they sell the tickets to stay there for a weekend. If I could sell the tickets to stay inside my mind for a weekend, would anyone bother ? But only during the summer time. All the other time of the year he'd want to be left alone. In the pursuit of that, he went as far as not having a permanent job. The seasonal jobs paid enough to save up and hide for the winter, sleeping a lot more than one would consider healthy, and crawling out only to get a couple of sandwiches in a automatic drive-in.

But now, with this weather, it's time for a nap. He decided. The old-fashioned mechanic clock was the only thing on the headboard shelf, ticking quietly but relentlessly. The heads were open like a beak of some exotic bird, opened to an extreme - it was just after five. He felt sufficiently dizzy, so the only thing he took off were the shoes. It will be just a short nap, after all. The storm should be gone soon.

The air of downtown Singapore was hot and heavy. He liked this feeling - you can almost take it in your hands and shape the little funny figures out of it - much like the clowns do by twisting the long and thin balloons - but without. He made himself an imaginary dog to fly by his side and started to walk towards the shopping mall - figures or not, it was seriously hot, an airco would have been a relief. No, not the rain. He had enough of it. Besides, it would destroy his newly made silent and unseen friend. Instead he took a bus and rode a few stops. Now's the time to get off.

Approaching the entrance of the mall, he saw a girl of some nine years of age, standing near the entrance. She had a backpack, and was holding a plate of Thin Mints in her hands. In any other time of the year he'd wonder what she is doing in Singapore - but today he was not inclined to. He pulled a five dollar note out of the pocket, and bought a box. He did not wait for the change she was trying to give. Nor he wondered why he'd buy them in the first place. He wanted to get a breath of fresh air.

The mall indeed had an airco, but it was one of those filled with myriads of the small outlets that sell the counterfeit electronics, sometimes per pack, sometimes by weight, almost like cookies. It was a great place to be in - the building internally was multi-storied and circular, every little business trying to grab a bigger share of attention by winning the competition for the strangest signage. He felt like he was a visitor in a beehive - and all this activity around him was filling him with the sense of activity. He'd even walk faster - without any reason to hurry at all.

A small and boring outlet caught his attention. The sign said "mind uploading". What the hell, he thought - it's obviously impossible. But the old man with the face he could not read by all means did not think so. The old man's smile was friendly, but at a distance. Several people came in, passed the money to him, and disappeared behind the back door. No one came out. Time to try out those cookies. He took a bite - which turned the cookie into a moon-like shape, when the old man looked at him and said: "It's only 50 dollars, sir. Full refund if not satisfied".

Walk away ? This is much stranger than his imaginary dog, still hanging around, or the scout selling the cookies. No way. He automatically put the cookie into his back pocket, and reached for the wallet. Only a hundred. "Make me two copies" - he muttered. "Sorry sir, no animals allowed and you can not take this cookie box inside" - politely, but firmly answered the old man. Well. If this works out it will be much better than both combined - so Shaldon put the box upright on the ground near the wall, and walked towards the back door with no signs of hesitation.

The old-fashioned mechanic clock was the only thing on the headboard shelf of an empty bed, ticking quietly but relentlessly. The heads were open like a beak of some exotic bird, opened in an attempt to catch something. And indeed - the exotic bird was not alone. It was trying to catch a moon-shaped piece of cookie that was just beside it, flat on the shelf. Someone must have started eating it and forgotten it down here - or they were teasing the exotic bird out of their sheer evilness - we do not know.

But we can say with full certainty that it was just after five.


Somewhat unexpectedly, continued here. Warning(spoiler): blatant violations of laws of life and universe and everything is ahead.