def get_model(): global INPUT_SHAPE if args.net.startswith("resnet50"): if args.net == "resnet50": INPUT_SHAPE = (224, 224, 3) elif args.net == "resnet50_112": INPUT_SHAPE = (112, 112, 3) return resnet50_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) elif args.net.startswith('senet') or args.net.startswith( 'resnet') or args.net.startswith('vgg'): INPUT_SHAPE = (112, 112, 3) if args.net.endswith("_112") else (224, 224, 3) if args.pretraining.startswith('imagenet'): if args.net.startswith('senet') or args.net.startswith('resnet'): return senet_model_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) else: return vgg16_keras_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) else: return vggface_custom_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining, args.net, args.lpf_size) elif args.net == 'mobilenet96': INPUT_SHAPE = (96, 96, 3) return mobilenet_96_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) elif args.net == 'mobilenet224': INPUT_SHAPE = (224, 224, 3) return mobilenet_224_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) elif args.net == 'mobilenet64_bio': INPUT_SHAPE = (64, 64, 3) return mobilenet_64_build(INPUT_SHAPE, NUM_CLASSES) elif args.net.startswith('mobilenetv3large'): if args.net == 'mobilenetv3large': INPUT_SHAPE = (224, 224, 3) elif args.net == 'mobilenetv3large_112': INPUT_SHAPE = (112, 112, 3) return mobilenet_v3_large_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) elif args.net == 'mobilenetv3small': INPUT_SHAPE = (224, 224, 3) return mobilenet_v3_small_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) elif args.net == 'densenet121bc': INPUT_SHAPE = (224, 224, 3) return densenet_121_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining, args.lpf_size) elif args.net.startswith('xception'): INPUT_SHAPE = (71, 71, 3) if args.net == 'xception71' else (299, 299, 3) return xception_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining, args.lpf_size) elif args.net == "shufflenet224": INPUT_SHAPE = (224, 224, 3) return shufflenet_224_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) elif args.net == "squeezenet": INPUT_SHAPE = (224, 224, 3) return squeezenet_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining)
def get_model(): global INPUT_SHAPE if args.net.startswith('resnet'): print("RESNET Network") INPUT_SHAPE = (224, 224, 3) return resnet_model_build(INPUT_SHAPE, args.pretraining) elif args.net.startswith('senet'): print("SENET Network") INPUT_SHAPE = (224, 224, 3) return senet_model_build(INPUT_SHAPE, args.pretraining) elif args.net.startswith('vgg19'): print("VGG19 Network") INPUT_SHAPE = (224, 224, 3) return vgg19_model_build(INPUT_SHAPE, args.pretraining) else: print("VGG16 Network") INPUT_SHAPE = (224, 224, 3) return vggface_custom_build(INPUT_SHAPE, args.pretraining, args.net)
def get_model(): global INPUT_SHAPE if args.net.startswith('senet') or args.net.startswith( 'resnet') or args.net.startswith('vgg'): INPUT_SHAPE = (224, 224, 3) if args.pretraining.startswith('imagenet'): if args.net.startswith('senet') or args.net.startswith('resnet'): return senet_model_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) else: return vgg16_keras_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) else: print("VGGFACE Network") return vggface_custom_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining, args.net, args.lpf_size) elif args.net == 'mobilenet96': INPUT_SHAPE = (96, 96, 3) return mobilenet_96_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) elif args.net == 'mobilenet224': INPUT_SHAPE = (224, 224, 3) return mobilenet_224_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) elif args.net == 'mobilenet64_bio': INPUT_SHAPE = (64, 64, 3) return mobilenet_64_build(INPUT_SHAPE, NUM_CLASSES) elif args.net == 'densenet121bc': INPUT_SHAPE = (224, 224, 3) return densenet_121_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining, args.lpf_size) elif args.net.startswith('xception'): INPUT_SHAPE = (71, 71, 3) if args.net == 'xception71' else (299, 299, 3) return xception_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining, args.lpf_size) elif args.net == "shufflenet224": INPUT_SHAPE = (224, 224, 3) return shufflenet_224_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining) elif args.net == "squeezenet": INPUT_SHAPE = (224, 224, 3) return squeezenet_build(INPUT_SHAPE, NUM_CLASSES, args.pretraining)