opconty / keras-shufflenetV2

Keras implementation of ShuffleNet V2
96 stars 44 forks source link

How to train this network? #2

Open Richardkang1992 opened 5 years ago

Richardkang1992 commented 5 years ago

Dear opconty, Thanks for sharing your codes firstly. Of course, I've met some problems when I want to use your codes. Hope that you can help me! Where is the main function to train this network? I've added this shufflenetV2 network into my own objects, but there were always some errors. So, I want to know how do you add this shuffle network into your object. Would you mind sharing your train.py (or something like this) to me?

opconty commented 5 years ago

Dear Richardkang: you can use this model like: from shufflenetv2 import ShuffleNetV2

create model

model = ShuffleNetV2(include_top=True, input_shape=(224, 224, 3), bottleneck_ratio=1, classes=1000)

dataloader

compile model

train model

Just same as pretrained models in keras, taking vgg16 for e.g.: In [1]: from keras.applications import VGG16 In [2]: model = VGG16(include_top=True, weights='imagenet', input_shape=(224, 22 ...: 4,3))

Hope this useful.

yangzijia commented 5 years ago

Dear opconty, Thank you for your training methods. Do you have the method of shufflenetv2 transfer learning? If you use this network for transfer learning, how many layers need to be frozen? Hope that you can help me!

opconty commented 5 years ago

this is a transfer learning example: https://github.com/opconty/face_detection_in_realtime

any questions plz let me know. best