Monthly Archives: October 2014

A big chunk of my master's career has been dedicated to finding good perceptual hash functions. What separates 'good' from 'bad' functions is not difficult -- low false-positive rate, low false-negative rate. That much is easy to benchmark. Really, though, what we want to optimize for near-identical image matching is the narrow range of boundary cases where images are similar, but not exactly identical. That's a much more subjective area where a binary right/wrong isn't as helpful as 'how wrong'. This is particularly relevant in our case, as we need to be able to sort images based on how similar they are to an input image.

To better visualize the performance of our hash function we perform the following test. A small set of 1500 images are loaded. Each image is permuted in one of five ways; the identity (no change), rotation, pixel noise, scaling, and cropping. Each of these is hashes and appended to a list of all hashes, then a matrix is formed with inter-hash differences. (This is referred to as a 'similarity matrix', usually.) The result of the current method can be seen below:

NN Hash Distance Table

On the diagonal (where x=y) you'll see the series of black squares. This is to be expected since the difference between something and itself is zero. An ideal equation would have blocks of 5x5 black pixels with the remaining area white or nearly white, suggesting a very high distance between an image and its dissimilar neighbors. You can note in the hash above that it's quite liberal -- assigning a smaller distance between differing images. Contrast it with the pHash grid below.

pHash Distance Table

pHash is much more selective overall, and more effective as a metric (if significantly slower). It says to me that there's still a lot of work to be done on our hash function before it's production ready.

One step closer to the HTC U Wot M8.

A few months ago I clumsily dropped my Samsung Galaxy Nexus with a USB cable attached. The device was fine up until I ran over it with my rolling chair. It still works more or less normally, but the USB connection is tenuous and requires a very delicate touch. This is frustrating in development and makes using it as a GPS impossible. (The cable won't stay in on its own.) For environmental and guilt reasons, I generally avoid buying new phones. I picked up an HTC One M7 off Amazon for around $200.

This is not the best choice I've ever made.

I spent a long while researching the hardware and comparing the battery life (concern #1) and other, less important hardware details. When finally pressed to decide between the HTC M7, Samsung Galaxy S4, and the Xperia Z2, I went with the cheaper of three evils. The device's hardware is outstanding and the build quality is top notch. I have some minor discontentment with the inset of the top and side buttons, but these trifles in the larger scope. What upsets me most about this device (though it could be great) is the software component.

Caveat: I have had very little time to really experiment with the device. These are first impressions, but they will color the lasting impressions I will have of the device. I will do my best to avoid confirmation bias, but I am not convinced that I can fully overlook my initial feelings on the matter.

Some things that bother me:

  • Bloatware: Verizon has installed six applications, including the NFL app, which cannot be uninstalled.
  • Blinkfeed uses an entire screen and can't be removed. (No, the two different approaches to removing it do not work.)
  • Blinkfeed, after I finally decided to give it a shot, does not appear to have a way to add custom RSS feeds. (The approaches I found online do not appear to work.)
  • Holding down the power button, by default, puts the device to sleep. To allow shutdown, you have to go into the settings menu and disable 'Enable Sleep'.
  • Facebook cannot be uninstalled.
  • I need to request an unlock code to unlock my bootloader from HTC. I applied to be a developer, was accepted, and then pulled my code from fastboot, but this was rejected. I shouldn't have to request an unlock in the first place. I paid for the device, let me do with it what I please.
  • Unlock screen requires me to drag a lock before entering my PIN. It would be nice to just enter my PIN.

There are critics of the critics who say that the detractors are opposed only because the interface is different. I don't agree with this sentiment. Surely, it's wrong to hate something ONLY because it looks different, but I think the criticism of the HTC Sense UI is valid because it behaves in a way that's different from standard, established UI paradigms with no apparent benefit. Part of making good UI is using components in a uniform or intuitive way. Have you ever used a door with a vertical bar where you had to push? I bet as soon as you grabbed that bar, the first thing you did was pull. Bad UI? Yes. It's because when we grab something we're accustomed to pulling it. Have you seen a flat plate on a door near the pivot? I bet you'd push it. The sense UI takes the established tropes of the Android user interface and twists them ever so slightly. If you're going to deviate from the established path, you better have a REALLY good reason for doing so. Imagine if a Windows application switched the minimize/maximize/close icons from the top right to the top left without reason. Also, every modal dialog has 'Cancel' and 'Okay' switched. "That's how we're doing it now!" You might be a little upset. I see no advantage (not to say one doesn't exist) from decisions like, "No more multitask button. Now you double-tap home."

Blinkfeed is a waste, frankly. I know a number of people love the pretty array of blocks folding through their screen, but this is useless to me. The prescribed solution is, and I'm not making this up, ignore it. Really. There is NO option to remove it. That being the case, I decided to give it a whirl. I wanted to add a news feed from SMBC-Comics. I know they have an RSS feed. Blinkfeed doesn't seem to support adding RSS feeds. Let me say that again, the NEWS FEED APPLICATION DOES NOT SUPPORT NEWS FEEDS. You are stuck using their preselected news items or, alternatively, getting a live fountain of eschewal direct from Facebook. (I'm told that it's possible to use an ADB command to add a news feed. I'll try this later, but it shouldn't be necessary to use an ADB command to get that done.)

I'll continue to use sense for the rest of the week. When I finally snap and can't take it any more, I'm going to install Cyanogenmod. It's the only remaining option I can see.

Overall, I'm disappointed and a little irritable at the experience. Had I purchased this phone from a retail store, I'd return it through the window with a note attached.

In the midst of working on CageFace, two design questions arose.

The program requires that facial images of Nicholas Cage be embedded so that they can later be superimposed. This could be performed manually, with each asset being loaded and processed at startup to determine it's attributes, or they could be precalculated. The former offers an advantage in two forms: it cancels out API differences between platforms, and it is easier when developing because all that's needed is to dump images of Nicholas Cage into the start folder. The second offers an advantage in startup time. Perhaps a first-time popup is in order.

The second question is what to do after the users click the 'take picture' button, labelled, 'NOT THE BEES'. If the original image is stored, that increases the memory overhead of the application significantly, and means the image has to get copied every time the 'NICHOLAS CAGE' button is pressed to superimpose faces (thus adding to processing time). It is possible to condense the two buttons into one which will take the picture AND do the processing for NICHOLAS CAGE, at a cost of not allowing faces to be re-CAGE'd.

No clear solutions yet.