Skip to content

Instantly share code, notes, and snippets.

@Chris-hughes10
Created July 16, 2021 09:29
Show Gist options
  • Save Chris-hughes10/2832a071846e71e732458c502dc6a69b to your computer and use it in GitHub Desktop.
Save Chris-hughes10/2832a071846e71e732458c502dc6a69b to your computer and use it in GitHub Desktop.
Effdet-blog-create-model
from effdet.config.model_config import efficientdet_model_param_dict
from effdet import get_efficientdet_config, EfficientDet, DetBenchTrain
from effdet.efficientdet import HeadNet
from effdet.config.model_config import efficientdet_model_param_dict
def create_model(num_classes=1, image_size=512, architecture="tf_efficientnetv2_l"):
efficientdet_model_param_dict['tf_efficientnetv2_l'] = dict(
name='tf_efficientnetv2_l',
backbone_name='tf_efficientnetv2_l',
backbone_args=dict(drop_path_rate=0.2),
num_classes=num_classes,
url='', )
config = get_efficientdet_config(architecture)
config.update({'num_classes': num_classes})
config.update({'image_size': (image_size, image_size)})
print(config)
net = EfficientDet(config, pretrained_backbone=True)
net.class_net = HeadNet(
config,
num_outputs=config.num_classes,
)
return DetBenchTrain(net, config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment