python

Hinting Cache Decorator Types

Recently, I encountered a python function that I didn’t want to modify, but whose output I wanted cached. Providing typehints for this seemed a bit complicated, so I’m posting this gist as a reminder. The main trick involves extensions from PEP 612. In words, the decorator will take some function f that takes parameters P and produces a str. I want to be able to call f and additionally provide a filename that will point to a file in which the string will be written.

How to store a NifTi as a TFRecord

How to store a NifTi as a TFRecord Patrick Sadil 2022-04-23 A recent project required sending brain images to TensorFlow. Unfortunately, the data exceeded memory and so during training would need to be read from the disk. Poking around the TF documentation, it seems like a recommended way to do this is to store the images as a TFRecord. The steps for doing that are collected in this gist1. There are five main steps

New England GAN

A friend recently moved away from Western Mass, so I wanted to send them a gift to help remind them of the area. I also happened to want to learn a bit more about Generative Adversarial Networks (GANs). Goals Briefly overview GANs Link to fun code for acquiring data from Google Street View Share a neat set of photographs Note that this isn’t an ‘intro to GANs’.