Implementation from paper "Co-Occurrent Features in Semantic Segmentation"
- High Level API
- ResNet101 backbones
- Models can be used as Subclassed or Functional Model
- Implement like paper code, adding multi head attention and mixtures of softmax to CFNet with source code from TASM
Requirements Windows or Linus
- Python 3.6 or higher
- tensorflow >= 2.3.0 (>= 2.0.0 is sufficient if no efficientnet backbone is used)
- numpy
Clone Repository
$ git clone https://github.com/huy105/CFNet.git
or directly install it:
Pip Install Repository
$ pip install git+https://github.com/huy105/CFNet.git
Please check that Tensorflow is installed on your computer.
To import the model just use the standard python import statement
Firstly, import function to get base model (backbone) and main head (CFNet):
from backbone import create_base_model
from main import CFNet
Then, get the backbone model, output layers, height and width:
BACKBONE_NAME = "resnet101"
WEIGHTS = "imagenet"
HEIGHT = 224
WIDTH = 224
model, layers_outputs, layer_names = create_base_model(name= BACKBONE_NAME, weights= WEIGHTS, height= HEIGHT, width= WIDTH, channels=3)
After that, create full model (base model + head) with parameter you want
CFnet_model = CFNet(n_classes = 5, base_model = model, output_layers = layers_outputs, n_heads=2, n_mix = 4,backbone_trainable = True)
If you want to use the Functional Model class define instead:
CFnet_model = CFNet(n_classes = 5, base_model = model, output_layers = layers_outputs, n_heads=2,
n_mix = 4,backbone_trainable = True, height= HEIGHT, width= WIDTH).model()
Using custom layers and main code from TensorFlow Advanced Segmentation Models (TASM).
- TensorFlow Advanced Segmentation Models, GitHub, GitHub Repository, https://github.com/JanMarcelKezmann/TensorFlow-Advanced-Segmentation-Models
- Code from author of paper, GitHub, GitHub Repository, https://github.com/zhanghang1989/PyTorch-Encoding