microsoft / MMdnn

MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch Onnx and CoreML.
MIT License
5.79k stars 965 forks source link

Error when converting SphereFace from Caffe to Keras #664

Open guesalomon opened 5 years ago

guesalomon commented 5 years ago

Hello, I am having issues with the conversion, the activation function PRelu is not supported by the KerasEmitter. How can I bypass this?

Keras version is 2.4.4 (Up-tp-date)

Thanks!

Using TensorFlow backend. Parse file [6b8d9febaa98422bb0d6df32128d2be0.pb] with binary format successfully. KerasEmitter has not supported operator [PRelu]. relu1_1 KerasEmitter has not supported operator [PRelu]. relu1_2 KerasEmitter has not supported operator [PRelu]. relu1_3 KerasEmitter has not supported operator [PRelu]. relu2_1 KerasEmitter has not supported operator [PRelu]. relu2_2 KerasEmitter has not supported operator [PRelu]. relu2_3 KerasEmitter has not supported operator [PRelu]. relu2_4 KerasEmitter has not supported operator [PRelu]. relu2_5 KerasEmitter has not supported operator [PRelu]. relu3_1 KerasEmitter has not supported operator [PRelu]. relu3_2 KerasEmitter has not supported operator [PRelu]. relu3_3 KerasEmitter has not supported operator [PRelu]. relu3_4 KerasEmitter has not supported operator [PRelu]. relu3_5 KerasEmitter has not supported operator [PRelu]. relu3_6 KerasEmitter has not supported operator [PRelu]. relu3_7 KerasEmitter has not supported operator [PRelu]. relu3_8 KerasEmitter has not supported operator [PRelu]. relu3_9 KerasEmitter has not supported operator [PRelu]. relu4_1 KerasEmitter has not supported operator [PRelu]. relu4_2 KerasEmitter has not supported operator [PRelu]. relu4_3 Target network code snippet is saved as [6b8d9febaa98422bb0d6df32128d2be0.py]. Traceback (most recent call last): File "/home//.local/bin/mmconvert", line 11, in sys.exit(_main()) File "/home//.local/lib/python3.5/site-packages/mmdnn/conversion/_script/convert.py", line 112, in _main dump_code(args.dstFramework, network_filename + '.py', temp_filename + '.npy', args.outputModel, args.dump_tag) File "/home//.local/lib/python3.5/site-packages/mmdnn/conversion/_script/dump_code.py", line 32, in dump_code save_model(MainModel, network_filepath, weight_filepath, dump_filepath) File "/home//.local/lib/python3.5/site-packages/mmdnn/conversion/keras/saver.py", line 2, in save_model model = MainModel.KitModel(weight_filepath) File "6b8d9febaa98422bb0d6df32128d2be0.py", line 59, in KitModel conv1_2_input = layers.ZeroPadding2D(padding = ((1, 1), (1, 1)))(relu1_1) NameError: name 'relu1_1' is not defined

rainLiuplus commented 5 years ago

Hi @guesalomon, could you provide your model so I can add the [PRelu] Op and test the accuracy? Thanks

guesalomon commented 5 years ago

The model and weights are available here:

https://drive.google.com/file/d/1_f1xoFw4g5FL1jRtCTzTO_cbMzgxJcQY/view?usp=sharing

rainLiuplus commented 5 years ago

@guesalomon, [PReLU] has been added and you can have a try

JohannSchumann commented 4 years ago

Hi,

I have the same issue with PReLU. According to rainLiuplus's comment, I was expecting to find the PReLU in the keras-emitter., but didn't. In which branch could I find that?

Thanks! -johann