For some classification problems it can make sense to structure it as a regression problem. To do this with fastai, I’m trying to set num_classes = 1, and changing my loss to MSE.
I tried passing in num_classes as kwargs to cnn_learner with resnet34 pretrained network but it isn’t a kwargs argument. I also tried this:
learn = cnn_learner(data, models.resnet34(num_classes=1), pretrained=True,
callback_fns=[partial(CSVLogger, append=True)],
path='../tmp/model/',
loss_func=MSELoss())
but you cannot instantiate the resnet model before, hence it does not work.