Densenet failing with Fast AI library

(Steindor Ellertsson) #1

Hey everyone.

I am trying to use Densnet in multiclass image classification but having trouble with loading and using in on a Paperspace P5000 instance. The weird thing is, I can train on every other custom net like Resnet 18, Resnext 50 and many other architectures, using excactly the same code but the Densenet fails for some reason.

The same happens, whether I use Densenet121, 161 or 169. Here is the code that fails:

sz = 224
bs = 8
tfms = tfms_from_model(arch, sz, aug_tfms=transforms_top_down, max_zoom=1.1)

data = ImageClassifierData.from_paths(PATH, tfms=tfms, val_name='test', trn_name='train', bs=bs)
learn = ConvLearner.pretrained(arch, data, precompute=True)

What happens is that it downloads the model and starts precomputing but then a message appears, “The kernel appears to have died, it will restart automatically”. I have tried different batch sizes, from 1 to 64 without luck. The image size is 224x224 which as far as I know is the default input size for Densenet but correct me if I am wrong.

I haven’t seen many topics on Densenet on the forums and I only found it when looking at the fast ai library source code. Perhaps it has not been fully implemented? Anyone else had a similar experience using Densenet and the Fast AI library?