FastAI is too abstracted... how to create custom networks?

I’ve been looking through the notebooks for FastAI_v1, and the functions are way too abstracted for me to understand what’s going on. Can anyone recommend a guide on how to create custom network network that leverage as much as the fastai infrastructure as possible?

For example, let’s say I’m working on a Siamese network problem. I would want to use a pre-trained ResNet 34 as the backbone network, then add additional layers to concat the output, maybe a couple of dense layers after that (there’s lots of experimenting involved as to the actual architecture I need). I can easily do that in Keras with the functional API, but I’m still trying to navigate through fastai on this.


1 Like

Have you checked out the docs?

You can also view the documentation for functions from notebooks by typing docs(create_cnn), for example.

I would want to use a pre-trained ResNet 34 as the backbone network

If you’re trying to create a convolutional network (which you may be, I don’t know), shows you how to load in a pre-trained model as the “backbone”.

I’d recommend watching the first video lecture to get a better idea of how some of the functions work. I’ve only watched that far, so I don’t have any other advice to give.

There’s a few fastai siamese nets around you can borrow from. Basically you just create a normal pytorch nn.Module containing the siamese head, then pass that as custom_head to cnn_learner.


Hei Derek,
thanks for the replay.
It seems your second link is broken.
Do you have access to the original content in some way?

Simplest example:

learn = cnn_learner(dls, resnet34, metrics=error_rate)