Painting All The Things

A post shared by Ian Pointer (@carsondial) on

A new year, and the beginning of a new era where I spend half my time in Durham, and the other half in Cincinnati. Hopefully, this should only last as long as it takes to get Driver ready for sale and all my things moved up north, but at least this week it means I only faced temperatures of -12ºC instead of -20ºC.

As part of fixing the house up, Tammy came down for the New Year and painted the bathroom and the utility room. While I did roll some paint across walls, I just took orders from the person that knew what they were doing. And you can’t argue with results - the main bathroom actually looks like a finished room…which is something it has lacked since 2013. So, hurrah!

Next week Chicago for a day(!), and the first real trip to my new home. Expect fun photos of a new washing machine in your exciting future!

Class Activation Mapping In PyTorch

Have you ever wondered just how a neural network model like ResNet decides on its decision to determine that an image is a cat or a flower in the field? Class Activation Mappings (CAM) can provide some insight into this process by overlaying a heatmap over the original image to show us where our model thought most strongly that this cat was indeed a cat.

Firstly, we’re going to need a picture of a cat. And thankfully, here’s one I took earlier of a rather suspicious cat that is wondering why the strange man is back in his house again.

%matplotlib inline

from PIL import Image
from matplotlib.pyplot import imshow
from torchvision import models, transforms
from torch.autograd import Variable
from torch.nn import functional as F
from torch import topk
import numpy as np
import skimage.transform
image ="casper2.jpg")


Doesn’t he look worried? Next, we’re going to set up some torchvision transforms to scale the image to the 224x224 required for ResNet and also to normalize it to the ImageNet mean/std.

# Imagenet mean/std

normalize = transforms.Normalize(
   mean=[0.485, 0.456, 0.406],
   std=[0.229, 0.224, 0.225]

# Preprocessing - scale to 224x224 for model, convert to tensor, 
# and normalize to -1..1 with mean/std for ImageNet

preprocess = transforms.Compose([

display_transform = transforms.Compose([
tensor = preprocess(image)
prediction_var = Variable((tensor.unsqueeze(0)).cuda(), requires_grad=True)

Having converted our image into a PyTorch variable, we need a model to generate a prediction. Let’s use ResNet18, put it in evaluation mode, and stick it on the GPU using the CUDA libraries.

model = models.resnet18(pretrained=True)

This next bit of code is swiped from Jeremy Howard’s course. It basically allows you to easily attach a hook to any model (or any part of a model - here we’re going to grab the final convnet layer in ResNet18) which will save the activation features as an instance variable.

class SaveFeatures():
    def __init__(self, m): self.hook = m.register_forward_hook(self.hook_fn)
    def hook_fn(self, module, input, output): self.features = ((output.cpu()).data).numpy()
    def remove(self): self.hook.remove()
final_layer = model._modules.get('layer4')

activated_features = SaveFeatures(final_layer)

Having set that up, we run the image through our model and get the prediction. We then run that through a softmax layer to turn that prediction into a series of probabilities for each of the 1000 classes in ImageNet.

prediction = model(prediction_var)
pred_probabilities = F.softmax(prediction).data.squeeze()

Using topk(), we can see that our model is 78% confident that this picture is class 283. Looking that up in the ImageNet classes, that gives us…’persian cat’. I would say that’s not a bad guess!

 [torch.cuda.FloatTensor of size 1 (GPU 0)], 
 [torch.cuda.LongTensor of size 1 (GPU 0)])

Having made the guess, let’s see where the neural network was focussing its attention. The getCAM() method here takes the activated features of the convnet, the weights of the fully-connected layer (on the side of the average pooling), and the class index we want to investigate (283/‘persian cat’ in our case). We index into the fully-connected layer to get the weights for that class and calculate the dot product with our features from the image.

(this code is based on the paper that introduced CAM)

def getCAM(feature_conv, weight_fc, class_idx):
    _, nc, h, w = feature_conv.shape
    cam = weight_fc[class_idx].dot(feature_conv.reshape((nc, h*w)))
    cam = cam.reshape(h, w)
    cam = cam - np.min(cam)
    cam_img = cam / np.max(cam)
    return [cam_img]

weight_softmax_params = list(model._modules.get('fc').parameters())
weight_softmax = np.squeeze(weight_softmax_params[0].cpu().data.numpy())
class_idx = topk(pred_probabilities,1)[1].int()
overlay = getCAM(activated_features.features, weight_softmax, class_idx )

Now we can see our heatmap and overlay it onto Casper. It doesn’t make him look any happier, but we can see exactly where the model made its mind up about him.

imshow(overlay[0], alpha=0.5, cmap='jet')


imshow(skimage.transform.resize(overlay[0], tensor.shape[1:3]), alpha=0.5, cmap='jet');


But wait, there’s a bit more - we can also look at the model’s second choice for Casper.

class_idx = topk(pred_probabilities,2)[1].int()
[torch.cuda.IntTensor of size 2 (GPU 0)]
overlay = getCAM(activated_features.features, weight_softmax, 332 )

imshow(skimage.transform.resize(overlay[0], tensor.shape[1:3]), alpha=0.5, cmap='jet');


Although the heatmap is similar, the network is focussing a touch more on his fluffy coat to suggest he might be class 332 - an Angora rabbit. And well, he is a Turkish Angora cat after all…

England Made Me — Christmas Eve Edition

The Snowman

The View From The Kitchen Floor

There’s always a brief moment when the shots ring out when you wonder ‘is that really gunfire, or is it just firecrackers?’ This time, that moment of hesitation was shattered by the second round of fire. So I spent a good five minutes on the kitchen floor, on the basis that it’s the one room in the house that’s equally distant from both roads, meaning that any bullets would have to travel through several walls before they got to me. The joys of living in a country with insane gun laws.

Anyway, back home in the UK for ten days! Tomorrow there will be an exciting adventure in Tesco (where I will, at 38 years old, race a proper, free-axis trolley around the shop like a crazy person), Star Wars later in the week, all building up to FESTIVE FESTIVE FESTIVE at the weekend! Providing my sister doesn’t kill me beforehand…

A Christmas Countdown

Because nobody demanded it - a rundown of the best Christmas songs of all time! Your mileage may vary. But you know I’m right, deep down in your cold frosted hearts.

  1. Last Christmas — Wham

    Look, it just missed out, okay?

  2. Fairytale of New York — The Pogues & Kirsty MacColl

    If you asked me ten years go, even five years ago, what my favourite Christmas song was, I would have said this. Why has it dropped so much? Has it been over-played? Am I indulging in hipsterness now that it's a perennial favourite of many since the late 90s? Not really; it's still a lovely bittersweet song. So what's changed?

    That homophobic slur right in the middle of the song. Now, I know there's a bunch of defenses for that: they're playing characters, and it's language that those characters would likely throw around. But. It's still there. And the song would be no less if the alternate line - 'you're cheap and you're haggard' was used (as it is in the clip above).

    I can no longer love it like I used to, as in these times, letting these things slide doesn't feel like an option (and let's be fair, it wasn't in those times either, given that the song came out during the passing of Section 28).

  3. The Holly And The Ivy — Los Campesinos

    Strange things for a LC! record - firstly, Gareth isn't the lead and instead Rob takes the reins (Oho! You're fired — Ed.), and secondly, it's played entirely straight as a heavenly mix of sleigh bells, religious imagery, and the motorcycle through the snow bits of The Snowman.

    (if you're after an actual Gareth LC! Christmas tune, then go find Kindle A Flame In Her Heart which is also good, but not quite as lovely as this)

  4. Christmas Number One — The Black Arts

    In which a Christmas song becomes sentient and attacks Britain. Insanity from Black Box Recorder and Art Brut. Imagine a British version of Invader Zim's Christmas episode set to song and you're pretty much there.

    "they'll have to bring back Top of The Pops this Christmas"

  5. A Christmas Kiss — Charlie's Angels

    Come on, you were waiting for the really obscure entry. This one doesn't even exist on YouTube! In fact, sometimes I think that Charlie's Angels only ever existed in the warped minds of myself and Kieron Gillen, but I have an actual CD that surely counts as physical evidence, dammit.

    Anyhow, this is a lovely slice of mid-90s festive brittleness that always makes my sister complain: "Ian, why are all your Christmas songs so bleak?"

    I scowl and then play New Year, obviously.

  6. Christmas TV — Slow Club


  7. I Wish It Could Be Christmas Everyday — Wizzard
    "You're in Wizzard, Harry!"


    And there isn't, because tomorrow is Christmas. Forever.

  8. I Was Born On Christmas Day — Saint Etienne featuring Tim Burgess I have a long standing bone to pick with this record. I was _convinced_ for years that Sarah Cracknell and Tim Burgess were married on the back of the lyrics. "Tim and Sarah went and tied the knot" is, I would say, not exactly subtle. But all artists are liars, dear reader, and I'm here to tell you that they're not and never were.

    Despite this heinous tale of lies, you won't find a better Christmas record that encapsulates the mid-90s Europop scene. Okay, admittedly, that's a fairly specific niche, but by goodness, did Saint Etienne nail it.

  9. Just Like Christmas — Low
  10. Christmas Wrapping — The Waitresses

    I was planning on being rather snobbish during these two write ups by pointing out that the reason Americans really hate Christmas music is because theirs is mostly rubbish. But that's not quite true, it's just that the American oeuvre is just aimed towards a style of Christmas music that bounces straight off me. It's not just the schmaltz of famous and obscure crooners that you hear as you enter a supermarket after the second week of November. It's even things like the Spector Christmas album or even All I Want For Christmas Is You. I can appreciate the craft, but it all sounds barren and cold to me.

    But not these two records. First up, you've got Low being as jaunty as they're ever going to be whilst delving into a discussion of imagined nostalgia versus real nostalgia. This was very popular on Radio 1 during the late 90s, and still gets played more than you'd think back home.

    And then there's Christmas Wrapping which…I mean, it's "The Grinch That Stole Christmas" for post-punk hipsters! Even the coldest heart can be thawed by the happy ending in the final verse! THE COLDEST HEART.

  11. Merry Xmas Everybody — Slade

    Or as it's also known: "The Noddy Holder Retirement Fund".

    While I've always liked this song, it wasn't until I moved to America that I realized how much I loved it. This song is everything that's wonderful about Christmas in Britain - not just the dead-on description of a family Christmas, but the spectacle of the boys from Birmingham glammed up to the gills as the Three Day Week was about to come down, cheap tin-foil kitsch, and whatever the hell it is that Dave Hill is wearing.

    It's Top of the Pops, it's a knees-up, and nobody at that moment cares that the lights are going to go out. The Imperial Phase of Christmas.

    You never hear it here in America. Never. And that is such a shame, because how can you possibly know that it's Christmas if you don't hear "IT'S CHRISTMAS!" being screamed by Noddy Holder? No wonder they think there's a War On Christmas.

    It's the ending of The Snowman, the tin of Roses in the corner, the Christmas specials: a cultural memory that is firmly British. England Made Me, after all.

And now, Ghostbusters Polka!

This week, I got the answer to a question I had never even considered before: “Just what would a polka version of ‘Wake Me Up Before You Go-Go’ sound like?”

The reason for this unimagined insight? Saying goodbye to a team I’ve been working with for the past year, and their inspired idea to take me to a German beerhouse to celebrate. They were all a little saddened to discover that I don’t actually drink beer (“but you’re British!”). But it was a nice thought!

But oh, the polka. So loud. You have not lived until you’ve heard the polka remix of ‘Video Killed The Radio Star’.1

Anyway, work in New York is wrapped up and as such I’m looking forward to a relaxing…week and a bit until I’m on a plane again. But! This time it’s a flight home and all the FESTIVENESS of the holiday, so it’s not too bad.

And in continued ‘ignoring the signs of aging and attempting to live like it’s 1997 forever’ news, these arrived this week:

Cherry Red.

A post shared by Ian Pointer (@carsondial) on

  1. Okay, you can probably live a full life without having heard it. But I want you to suffer too. [return]

Breaking the new house in…

When you’ve just bought a new house and all your things reside 400 miles away, it’s obvious to host Thanksgiving for six, right? Right?

It wasn’t quite as insane as that sounds; a lot of prep work was done by Tammy and myself1 before the day…and all those ovens makes preparing a roast dinner much easier. Although it will take some experimenting to get the Yorkshire puddings right. The saloon was also a hit, with cowboy hats, toy guns, and yes, even sarsaparilla being deployed for a more ‘authentic’ experience. I’m drawing the line at a cowskin rug or a spittoon, mind you.

Anyway, back in Durham once again for a few days, then New York, then…home for Christmas? So many planes this year…

  1. And just to be clear, most of that was done by Tammy. I…made pastry a few days beforehand. [return]

I shall diminish, and go into the (Mid-)West

I am moving! After a long period of rejecting houses, nervous emails, and an eye-watering wire transfer, I’m heading to Cincinnati in 2018.

And here’s where I’m going!

One of the toughest things about house-shopping (even above doing it remotely) has been to get over my ridiculous imagination of what my perfect house would be. I’m just saying that the chances of finding a board-formed concrete house with floor-to-ceiling glass and a kitchen straight out of Hannibal is…not something that comes up for sale in any housing market, let alone the Cincinnati area. And as I don’t have the several millions of dollars it would take to build it, my imagination had to be bludgeoned into the ground. 1

Having said that, I think I’ve done quite well. It’s not that much bigger than my current house (only by about 400 sq ft, or so I’m told), but it does feel larger, with multiple bathrooms, a finished basement, and a fancy garage.

And there are four ovens. THERE! ARE! FOUR! OVENS!

These will all be set to Celsius by the end of the day, naturally. There’s also stairs! Stairs! STAIRS! I have missed them. And they go down to a basement that has a saloon and Edison bulbs. Seriously. 2

Will I miss Durham? Definitely! It is, in many ways, a completely different city from the one I came to in 2011, and while not all those changes have been great (oh, Green Wall, we still miss you!), for the most part, it has come on in leaps and bounds. It’ll be sad to say goodbye.

Moving is likely to be a slow process; Driver needs a bit of work to get it ready to sell. Nothing too major, but things need to be painted and a few bits around the house replaced before it goes on the market. So for the first four-five months of 2018, I will be splitting my time between both places before putting the old house on the market in the Spring. This will, of course, also include a long ‘goodbye tour’ where I eat my way around my favourite places in the Triangle, and there will be a send-off for Driver which everybody will be invited to!

And of course, there’s plenty of room for visitors up in Cincinnati too! Come visit and I will inflict Skyline Chili on you…then take you to the really good places…

  1. Over the past six months, though, I have discovered that I hate mock-Tudor houses with a deep passion. YOUR COUNTRY DIDN’T EVEN EXIST AT THE TIME. [return]
  2. One of my observations from November 2016 is that it sometimes feels that the Democrats would be better off paying 200-300,000 people from California and New York to live in swing states during an election year. Make the electoral college work for you instead of against you. Moving to Ohio increases the power of my vote in 2018 and 2020 elections… [return]

The Case of The Disappearing H

That Tony Wilson just appeared on YouTube and is, like most Wilson documentaries, quite entertaining. It’s hard to imagine a documentary on an American news/current affairs presenter veering off into ‘well, he’s a twat, but we love him’ or the part where they form one of the most important UK record labels of the last 50 years or so. Obviously it covers most of the usual bases, for a change looks at his career through the lens of Granada rather than Factory Records. Highlights include Paul Ryder talking about how Wilson told the Happy Mondays how to get out of their record contract just before Factory imploded, and the tirade of a speech he gave at the RTS Awards in 20011. The documentary also includes EXTRA GORDON BURNS, so you know you’re in for a good time.

Anyway, all that nicely covers up the fact I don’t have much to say this week. Things continue, the end of 2017 begins to approach, and the nights are drawing in. Next week, though, I will have more of an update. But you might have to wait until the Monday for it…

  1. it’s never made clear exactly who Wilson was railing against in his lifetime achievement acceptance speech, but given how it is couched in terms of ‘regions’, and the timing is close to the Granada/Carlton merger I’d make a stab at somebody at the ITV Network, probably the London set. [return]

Painting All The Things

This weekend I jumpstarted my car for the first time, isolated and fixed a gas leak, and even used a roller to apply paint to a wall. Also this weekend: I spent much of it confined to a couch with a bulging neck, trying to swallow while Tammy actually did 90% of the work. But! I spray-painted things! I actually went back to a shop and bought more paint…AND IT WAS THE RIGHT PAINT. There should be medals.

Before and after.

A post shared by Ian Pointer (@carsondial) on

All credit really goes to Tammy for her long campaign to eliminate knotty pine in all its forms and for picking out the new colours (oh, and the small, small matter of doing it). I will confess that I was a touch sceptical. “How can simply changing the colours do–OH MY GOD WHY DOES THE KITCHEN LOOK SO BIG NOW?”

To sum up: probably should have done this a couple of years ago instead of leaving it until now. Everything looks so open!

I will now head back to the bed and continue watching An Ocean Apart, an Adam Curtis documentary series made before he started narrating - featuring David Dimbleby giving the required “but they were wrong” lines. And then Lemsip.