- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried SSD by original data in keras. And I would like to change
trained model (.hdf5) to tensorflow model at first step to work this model
in open VINO.
But I can't convert keras model due to the follow problem.
ValueError: Invalid layer: Normalize
■keras_to_tensorflow
https://github.com/amir-abdi/keras_to_tensorflow
・Windows
・keras2.0.0
ssd.py in ssd_keras includes normalize layer. I think it is cause of
the problem. But I don't know how to change or revise this.
Could you tell me the good way to avoid this error ?
or could you tell me the way to change directly to IR model if there are any ?
-------------ssd.py------------------------------------------------
# Last Pool
net['pool6'] = GlobalAveragePooling2D(name='pool6')(net['conv8_2'])
# Prediction from conv4_3
net['conv4_3_norm'] = Normalize(20, name='conv4_3_norm')(net['conv4_3'])
num_priors = 3
x = Conv2D(num_priors * 4, (3, 3), padding='same',
name='conv4_3_norm_mbox_loc')(net['conv4_3_norm'])
net['conv4_3_norm_mbox_loc'] = x
flatten = Flatten(name='conv4_3_norm_mbox_loc_flat')
net['conv4_3_norm_mbox_loc_flat'] = flatten(net['conv4_3_norm_mbox_loc'])
name = 'conv4_3_norm_mbox_conf'
if num_classes != 21:
name += '_{}'.format(num_classes)
x = Conv2D(num_priors * num_classes, (3, 3), padding='same',
name=name)(net['conv4_3_norm'])
net['conv4_3_norm_mbox_conf'] = x
flatten = Flatten(name='conv4_3_norm_mbox_conf_flat')
net['conv4_3_norm_mbox_conf_flat'] = flatten(net['conv4_3_norm_mbox_conf'])
priorbox = PriorBox(img_size, 30.0, aspect_ratios=[2],
variances=[0.1, 0.1, 0.2, 0.2],
name='conv4_3_norm_mbox_priorbox')
net['conv4_3_norm_mbox_priorbox'] = priorbox(net['conv4_3_norm'])
---------------------------------------------------------------------
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I uploaded the file, this is for share. So train data is very small, but the model architecture is the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I tried follows.
https://github.com/rykov8/ssd_keras/issues/83
Error is not occured at Normalize layer, but it has still a problem at PriorBox layer.
TypeError: __init__() missing 2 required positional arguments: 'img_size' and 'min_size'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that is.
At ssd.py I think the parameters are set, so the model includes these information.
I don't know where I should set. (My understanding for SSD isn't enough.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I appericiate your support. I uploaded the code.
Trained data is in the checkpoints folder, it is the file can't convert to IR.
You use train.py when you use. This code is worked under keras2.
I'm sorry I can't share the original data, so its data is the test data. But code is the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hyodo, Katsuya wrote:@Morishige, Akihito
Thank you.
Did you try the following?
https://github.com/rykov8/ssd_keras/issues/83
Hi, I'm also interested to keep working the conversion from keras to TF. I used the following line of code as for your comment but still do not work. May you elaborate your answer more ?
model = keras.models.load_model(input_model_path, custom_objects={'Normalize': Normalize, 'PriorBox': PriorBox})
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page