fizyr / keras-maskrcnn

Keras implementation of MaskRCNN object detection.
Apache License 2.0
406 stars 131 forks source link

Cannot train model on multiple GPU #82

Open cuongnc220592 opened 5 years ago

cuongnc220592 commented 5 years ago

I have tried to use multi_gpu_model function to train on multiple GPU. But when I edit the code as: training_model = multi_gpu_model(model, gpus=2), I got this error The name "masks" is used 2 times in the model. All layer names should be unique. I think it is caused from loss function loss={ 'regression' : keras_retinanet.losses.smooth_l1(), 'classification': keras_retinanet.losses.focal(), 'masks' : losses.mask(), }, Do you have any suggestion to fix it ? Thanks for your support

hgaiser commented 5 years ago

I've never tried to start a multi-gpu process with keras-maskrcnn. I do know that the keras implementation for multi-gpu is a bit weird and flawed, so don't expect great results..

That said, you could look at how we do it for keras-retinanet: https://github.com/fizyr/keras-retinanet/blob/master/keras_retinanet/bin/train.py