Mask_RCNN icon indicating copy to clipboard operation
Mask_RCNN copied to clipboard

Focal loss

Open rcx986635 opened this issue 5 years ago • 4 comments

if appling focal_loss to rpn_class ,mrcnn_class ,mrcnn_mask , the performance will be better ?

rcx986635 avatar Oct 28 '19 09:10 rcx986635

@rcx986635 is it better?

Amrimn avatar Jan 14 '20 11:01 Amrimn

actually not better than before.

rcx986635 avatar Jan 15 '20 06:01 rcx986635

Apply if your dataset has imbalance, you have to apply multi-class sparse focal loss in all three. checkout here Multi-class Focal loss on mask RCNN.

charlie6echo avatar May 19 '21 05:05 charlie6echo

Apply if your dataset has imbalance, you have to apply multi-class sparse focal loss in all three. checkout here Multi-class Focal loss on mask RCNN.

I am getting this error in 'mrcnn_class_loss_graph' when uncommented the focal loss in the code. Could you please help me with this?

Traceback (most recent call last): File "final.py", line 543, in train(model) File "final.py", line 356, in train model.train(dataset_train, dataset_val, File "/home/ubuntu/Fur_Seg/Mask-RCNN-TF2.7.0-keras2.7.0/mrcnn/model.py", line 2386, in train self.keras_model.fit( File "/home/ubuntu/tf2.7/lib/python3.8/site-packages/keras/engine/training_v1.py", line 777, in fit return func.fit( File "/home/ubuntu/tf2.7/lib/python3.8/site-packages/keras/engine/training_generator_v1.py", line 570, in fit return fit_generator( File "/home/ubuntu/tf2.7/lib/python3.8/site-packages/wandb/integration/keras/keras.py", line 166, in new_generator return old_generator(*args, **kwargs) File "/home/ubuntu/tf2.7/lib/python3.8/site-packages/wandb/integration/keras/keras.py", line 166, in new_generator return old_generator(*args, **kwargs) File "/home/ubuntu/tf2.7/lib/python3.8/site-packages/wandb/integration/keras/keras.py", line 166, in new_generator return old_generator(*args, **kwargs) File "/home/ubuntu/tf2.7/lib/python3.8/site-packages/keras/engine/training_generator_v1.py", line 252, in model_iteration batch_outs = batch_function(*batch_data) File "/home/ubuntu/tf2.7/lib/python3.8/site-packages/keras/engine/training_v1.py", line 1076, in train_on_batch outputs = self.train_function(ins) # pylint: disable=not-callable File "/home/ubuntu/tf2.7/lib/python3.8/site-packages/keras/backend.py", line 4186, in call fetched = self._callable_fn(*array_vals, File "/home/ubuntu/tf2.7/lib/python3.8/site-packages/tensorflow/python/client/session.py", line 1483, in call ret = tf_session.TF_SessionRunCallable(self._session._session, tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) INVALID_ARGUMENT: required broadcastable shapes [[{{node mrcnn_class_loss/mul}}]] [[loss/AddN/_3329]] (1) INVALID_ARGUMENT: required broadcastable shapes [[{{node mrcnn_class_loss/mul}}]] 0 successful operations. 0 derived errors ignored.

avinash-218 avatar Jun 30 '23 06:06 avinash-218