A number of documented Keras applications are missing from my (up-to-date) Keras installation and TensorFlow 1.10 Keras API installation. I import Keras' applications module as suggested and use it as follows:
from keras import applications
resnet = applications.ResNeXt101(include_top=False, weights='imagenet', input_shape=(SCALED_HEIGHT, SCALED_WIDTH, 3), pooling=None)
I also tried
resnet = applications.resnext.ResNeXt101(include_top=False, weights='imagenet', input_shape=(SCALED_HEIGHT, SCALED_WIDTH, 3), pooling=None)
But in both cases I get the same type of error:
AttributeError: module 'keras.applications' has no attribute 'ResNeXt101'
Printing help(applications) yields:
Help on package keras.applications in keras:
NAME
keras.applications
PACKAGE CONTENTS
densenet
imagenet_utils
inception_resnet_v2
inception_v3
mobilenet
mobilenet_v2
mobilenetv2
nasnet
resnet50
vgg16
vgg19
xception
FUNCTIONS
DenseNet121 = wrapper(*args, **kwargs)
DenseNet169 = wrapper(*args, **kwargs)
DenseNet201 = wrapper(*args, **kwargs)
InceptionResNetV2 = wrapper(*args, **kwargs)
InceptionV3 = wrapper(*args, **kwargs)
MobileNet = wrapper(*args, **kwargs)
MobileNetV2 = wrapper(*args, **kwargs)
NASNetLarge = wrapper(*args, **kwargs)
NASNetMobile = wrapper(*args, **kwargs)
ResNet50 = wrapper(*args, **kwargs)
VGG16 = wrapper(*args, **kwargs)
VGG19 = wrapper(*args, **kwargs)
Xception = wrapper(*args, **kwargs)
keras_modules_injection(base_fun)
which shows that the models initially aren't present in my installation. Why not? They're also not packaged in the TensorFlow's Keras API.
I tried copying the files from the Keras applications GitHub repository and pasting them in site-packages/keras/applications/, but this results in the following stacktrace:
File "myscript.py", line 517, in get_fpn
resnet = applications.resnext.ResNeXt101(include_top=False, weights='imagenet', input_shape=(SCALED_HEIGHT, SCALED_WIDTH, 3), pooling=None)
File "site-packages/keras/applications/resnet_common.py", line 575, in ResNeXt101
**kwargs)
File "site-packages/keras/applications/resnet_common.py", line 348, in ResNet
data_format=backend.image_data_format(),
AttributeError: 'NoneType' object has no attribute 'image_data_format'
Any ideas on how to fix this? Why aren't these included and working in default installations of either Keras or TensorFlow? Why does the documentation not explain this?