Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mrcnn_bbox_loss #1220

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

keineahnung2345
Copy link
Contributor

According to #786 and the paper of Fast R-CNN, L_loc should be the sum of smooth_l1_loss of its four items.

@waleedka
Copy link
Collaborator

waleedka commented Feb 4, 2019

@keineahnung2345 I couldn't find that reference in the paper! Can you point me to the specific section? Also, please see my comments on #786 . I think we do need to update the SmoothL1 loss, but probably not in this particular way.

@keineahnung2345
Copy link
Contributor Author

I am referring to the following formula in Fast R-CNN:
image
just as @jnd77 says.
I've checked your comment and revise the denominator to Nreg.

@jnd77
Copy link

jnd77 commented Feb 12, 2019

@keineahnung2345 thanks for looking at the issue.
However, I have the feeling we are mixing the 2 localisation losses:

The Fast-RCNN one (mrcnn_bbox_loss) which you first commit did correct.

The Faster-RCNN one (rpn_bbox_loss) which @waleedka mentioned in #786 (where the denominator is Nreg).

So I believe the first commit was the correct one.

@keineahnung2345
Copy link
Contributor Author

keineahnung2345 commented Feb 12, 2019

@jnd77 You are right. I will revert to the first version after @waleedka confirm it.
In the paper of Mask R-CNN, it says:

Formally, during training, we define a multi-task loss on
each sampled RoI as L = Lcls + Lbox + Lmask. The classification loss Lcls and bounding-box loss Lbox are identical as those defined in [12].

In which [12] links to Fast R-CNN.
And reference to benchmark - fast r-cnn box loss, the denominator should be the count of proposals.

@jimmy15923
Copy link

Hi @keineahnung2345 !
Thanks for updating the bbox loss, I am wondering if this change affects the training?

@yhcccc
Copy link

yhcccc commented Jul 18, 2019

@keineahnung2345 , I modified it as you proposed, but got error:

Traceback (most recent call last):
  File "samples/coco/coco.py", line 464, in <module>
    model_dir=args.logs)
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1955, in __init__
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 2138, in build
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/keras/engine/base_layer.py", line 457, in __call__
    output = self.call(inputs, **kwargs)
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/keras/layers/core.py", line 687, in call
    return self.function(inputs, **arguments)
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 2137, in <lambda>
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/mask_rcnn-2.1-py3.6.egg/mrcnn/model.py", line 1212, in mrcnn_bbox_loss_graph
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 856, in binary_op_wrapper
    y = ops.convert_to_tensor(y, dtype=x.dtype.base_dtype, name="y")
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 611, in convert_to_tensor
    as_ref=False)
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 676, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 121, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 102, in constant
    tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
  File "/data1/gaoxi/yh/Tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 364, in make_tensor_proto
    raise ValueError("None values not supported.")
ValueError: None values not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants