Xresnet n_out

The Lesson 07 module indicates the n_out to be the number of classes/ labels for the dataset.

The source code indicates the xresnet n_out default =1000.

When I tried to use the default, I got similar results as
when I used dls.c.

Is the n_out value a max? such that if the n_out is not indicated, it defaults to the number of classes detected in get_y, or to 1000 if there are more than 1000 classes?

Thank you!


Hi @yrodriguezmd,

as far as I know almost all pretrained vision models are trained for the ImageNet Large Scale Visual Recognition Challenge (ILSVRC), or at least take the data set as a benchmark. The goal of the challenge is to predict 1000 different classes with the best accuracy.


  • the default n_out of (x)resnets is 1000
  • this is usually changed when you use the pretrained model for your dataset
  • dls.c is the number of unique labels in your dataset
  • since the Imagenette dataset in the book has also 1000 classes you didn’t see any changes

Try to run the code on the pets dataset (path = untar_data(URLs.PETS)/'images'). Then you’ll see the dls.c is different.


@JackByte, thank you for the reply!

  • I think xresnet is not pretrained
  • I was not using Imagenette.
  • The dls.c for the dataset I am using is 10. But when I did not indicate any (ie used the default), I got a very similar accuracy. I couldn’t gather info from the docs why this would be so…