anilsathyan7 / Portrait-Segmentation

Real-time portrait segmentation for mobile devices
MIT License
638 stars 133 forks source link

How to get the most accurate result #12

Open PapaMadeleine2022 opened 4 years ago

PapaMadeleine2022 commented 4 years ago

Hello, when I test your test.py with models/mnv3_seg/munet_mnv3_wm10.h5 and models/mnv3_seg/munet_mnv3_wm10.h5, I find the result is not very good. What model and parameters I should set to get the accurate result? Can you give some advises?

Thanks.

anilsathyan7 commented 4 years ago

I tried a different setting for this model, refer comment: https://github.com/anilsathyan7/Portrait-Segmentation/issues/5#issuecomment-562546843 See the failure cases section for model output comparison. You may need to increase the number of filters in the model and perhaps train with AISegment dataset for better accuracy

anilsathyan7 commented 4 years ago

There may be couple of others reason...

  1. If you compare mobilenetv2(depth multiplier 0.5) with mobilenetv3(depth` multiplier 1.0) the latter has slightly less accuracy(65.4 vs 61.9 top1).

  2. There were no pretrained keras checkpoints for mobilentv3, so i had to train from scratch using the tflite model as reference.

PapaMadeleine2022 commented 4 years ago

@anilsathyan7 Thanks for your reply. In the first reason you said mobilenetv2(depth multiplier 0.5) has more high accuracy ?

PapaMadeleine2022 commented 4 years ago

@anilsathyan7 the models under dir models/segvid_mnv2_port256 is for the model described in Model Type - 3 ?

anilsathyan7 commented 4 years ago

If you go to the aforementioned mobilenetv3 link, there are different version of the model.

You can get the pretrained model with weights using the below code:- mnv3=keras.applications.keras_applications.mobilenet_v3.MobileNetV3Large(input_shape=(224, 224, 3),alpha=1.0, minimalistic=True, include_top=False, weights='imagenet', backend=tf.keras.backend, layers=tf.keras.layers, models=tf.keras.models, utils=tf.keras.utils)

Now you can replace the encoder part in our model with this, connect it to the decoder and finally train the model.

Model-3 is prisma-net architecture and the models in the directory: models/segvid_mnv2_port256 are the mobinenetv2 based models with size 256.

ldenoue commented 4 years ago

What is the model that you have under tensorflowjs?

kooler commented 3 years ago

Curious about the question above as well. Tried to convert all models from h5 to TensorFlowJS, but none of them seems to perform as well as the exiting one.

anilsathyan7 commented 3 years ago

The model under tfjs is 'deconv_fin_munet'. It's a model with 128 input isize ,inside folder models/transpose_seg.