Neural Network Components.


Not every component listed here is HybridBlock, which means some of them are not hybridizable. However, we are trying our best to make sure components required during inference are hybridizable so the entire network can be exported and run in other languages.

For example, encoders are usually non-hybridizable but are only required during training. In contrast, decoders are mostly HybridBlock s.

Basic Blocks

Blocks that usually used in face recognition.

API Reference

Basic Blocks used in GluonFR.

class gluonfr.nn.basic_blocks.NormDense

Norm Dense

class gluonfr.nn.basic_blocks.SELayer

SE Layer

class gluonfr.nn.basic_blocks.FrBase

This is base class for all face recognition network. In this class, we defined the NormDense and control flow of the sub classes. In any sub classes, only need to implement features and embedding_layer. Normally we add embedding_layer to features.

  • classes (int) – Number of classification classes.
  • embedding_size (int) – Units of embedding layer.
  • weight_norm (bool, default False) – Whether use weight norm in NormDense layer.
  • feature_norm (bool, default False) – Whether use features norm in NormDense layer.
  • need_cls_layer (bool, default True) – Whether use NormDense layer.Normally it depends on your loss function. When you use Softmax, ArcLoss or based on Softmax loss, you need to set it to True. When you only need embedding output, like you are predicting or training with triplet loss, you need to set it to False.