1 minute read

What I did

  • Started work on the Facial key-points project. It’s a bit trickier because of the strange dimensions you need to deal with in the Tensors, and then having to figure out what dimensions get spit out after ta convolution step.

What I learned

  • Here’s how you calculate the dimensions that come out of a convolutional neural network layer:

fill in later

  • To write a lightning module, you need to write the following methods, as a bare minimum, within a class:
class net(pl.LightningModule):
  def __init__(self, hparams):
    super(net, self).__init__()
        self.hparams = hparams
  def forward(self, x):
    pass
  def training_step(self, batch, batch_idx):
    pass
  def train_data_loader(self):
    pass
  def configure_optimizers(self):
    pass

You can also do it as a decorator, like this:

@pl.data_loader
def train_data_loader(self):
    pass

A decorator is python’s way of overriding an existing method in python.

  • I had so many problems with the facial keypoints project in pytorch lightning I ended up just switching to regular pytorch, writing everything myself, and adding it to the colab GPU manually and it all just worked. I had this issue where PL was converting a tensor to a tuple after the first batch. I eventually decided it was a bug of PL lightning and not worth trying to fix. FWIW, you should definitely learn pytorch before learning pytorch lightning. If you don’t know pytorch and you run into an issue with lightning, you’ll have a very hard time trouble-shooting.

What I will do next

  • The German semester at Munich is almost over and now it’s crunch time for me. I may spent most of my time learning ML and becoming a better data scientist, but I am still a full-time grad student and it’s time to focus on passing my exams.
  • There’s another deep learning project I’ll have to do for next week. This one is on semantic segmentation.