keras-cv icon indicating copy to clipboard operation
keras-cv copied to clipboard

Bug Fix for CenterNetBoxLoss

Open TillBeemelmanns opened this issue 2 months ago • 0 comments

I am currently doing some experiments with the Waymo 3D Object Detector Centernet and found out that there is a bug in the CenterNetBoxLoss function.

I trained the model for 2 epochs with the original loss function which results in the following predictions on the val set: waymo_open_dataset_0

Notably there is a constant yaw offset caused by the false ops.floor() operation in the loss function applied on the gt heading.

This PR fixes this issue. The following image depicts the predictions after 2 epochs using the fixed loss function. waymo_open_dataset_0 (Note, that the network has not converged and no NMS has been applied)

The problem probably raised during the conversion from the Tensorflow op tf.math.floormod to Keras ops. However, tf.math.floormod(a, b) != ops.floor(ops.mod(a, b)) but tf.math.floormod(a, b) = ops.mod(a, b)

Hence ops.floor() simply removes the accuracy of the gt heading during loss computation.

Additionally, I implemented a test case for the heading classification (+regression) part of the CenterNetBoxLoss.

Frameworks & Versions:

  • keras-cv==0.8.2
  • keras==3.2.0
  • tensorflow==2.16.1

@divyashreepathihalli @sampathweb

TillBeemelmanns avatar Apr 30 '24 17:04 TillBeemelmanns