azeme1 / keras2ncnn

MIT License
24 stars 0 forks source link

softmax error #11

Closed wangjing60755 closed 3 years ago

wangjing60755 commented 3 years ago

image

@azeme1

wangjing60755 commented 3 years ago

weights.zip

segment model here!

wangjing60755 commented 3 years ago

model output:

output = layers.Conv2D(filters=numclass, kernel_size=( 1, 1), padding='same', activation='softmax', name='final_layer')(x)

azeme1 commented 3 years ago

The reason of the issue. NCNN does not support the merged Softmax activation. I have to write the split rule to tranrform graph to convertible one. If it is urgent you can modify the model output = layers.Conv2D(filters=numclass, kernel_size=( 1, 1), padding='same', activation=None, name='final_layer')(x) output = Softmax(output )

azeme1 commented 3 years ago

I have fixed the issue. Could you try with new 'main' branch? To import you model you should modify from tensorflow.keras.losses import mae model_list = [load_model('weights.h5', custom_objects={'bce_dice_loss': mae, 'IOU': mae})] #issue 11

azeme1 commented 3 years ago

Succeed to fix the mode and convert it into the NCNN.

https://www.dropbox.com/sh/8anok3k3jxjj81i/AADWMLad_V0MKs4ySN2mgPPda?dl=0 The conversion result can be found here model_zoo\variouse\issue_00011

azeme1 commented 3 years ago

TensorFlowOpLayer what is inside this layer? Could you share the actual model code?

azeme1 commented 3 years ago

Is this actual one?

azeme1 commented 3 years ago

Is the problem solved?