Open Maxfashko opened 5 years ago
Hi @ZFTurbo , great work here. I can see you have contributed in the keras-retinanet repo of fizyr too and also tried to support that here. Still facing the same issue as above. Any workaround for this?
@tonmoyborah
Current code supports retinanet. Here is the example. I will add it in test_bench later:
def get_RetinaNet_model():
from keras.models import load_model
from keras.utils import custom_object_scope
from keras_resnet.layers import BatchNormalization
from keras_retinanet.layers import UpsampleLike, Anchors, RegressBoxes, ClipBoxes, FilterDetections
from keras_retinanet.initializers import PriorProbability
custom_objects = {
'BatchNormalization': BatchNormalization,
'UpsampleLike': UpsampleLike,
'Anchors': Anchors,
'RegressBoxes': RegressBoxes,
'PriorProbability': PriorProbability,
'ClipBoxes': ClipBoxes,
'FilterDetections': FilterDetections,
}
with custom_object_scope(custom_objects):
model = load_model("../retinanet_resnet50_500_classes_0.4594_converted.h5")
return model, custom_objects
from keras.utils import custom_object_scope
model, custom_objects = get_RetinaNet_model()
with custom_object_scope(custom_objects):
model_reduced = reduce_keras_model(model)
I'll try this. I made it work by changing deserealize function in keras code but the resulting model didn't provide any speedup. Models other than retinanet are showing huge improvements
I observed the same behaviour for RetinaNet. While many BN layers were removed speed of inference stays the same.
P.S. Added RetinaNet in test_bench.
Hi, @ZFTurbo! I tryed convert retinanet model with backbone resnet50 and it faled. I used https://github.com/fizyr/keras-retinanet.
I would be grateful for any help.