tensorflow / addons

Useful extra functionality for TensorFlow 2.x maintained by SIG-addons
Apache License 2.0
1.69k stars 611 forks source link

GIoU values not in the admitted range (Question) #2800

Closed gianfrancodemarco closed 1 year ago

gianfrancodemarco commented 1 year ago

System information

Describe the bug I've looked at the paper introducing GIoU and my understanding is that admitted values for the loss range from -1 to 1. Trying to use it as a loss to train an object recognition model, I get GIoU values well over 1, and I don't know how to interpret them. This happens even in the tensorflow addons example:

gl = tfa.losses.GIoULoss()
boxes1 = tf.constant([[4.0, 3.0, 7.0, 5.0], [5.0, 6.0, 10.0, 7.0]])
boxes2 = tf.constant([[3.0, 4.0, 6.0, 8.0], [14.0, 14.0, 15.0, 15.0]])
loss = gl(boxes1, boxes2)
# loss = 1.5041

How should this results be interpreted?

bhack commented 1 year ago

Can you try the same with the GIOU loss in Keras-CV https://github.com/keras-team/keras-cv ?

gianfrancodemarco commented 1 year ago

@bhack I've tried the IoULoss since the GIoULoss is not released yet, howewer the loss is stuck at 1.00 and the network is not learning, while improves using a classic mse loss. I'm overfitting on just on batch of images, using: IoULoss(bounding_box_format="xyxy", mode="linear")

bhack commented 1 year ago

Try with pip install git+https://github.com/keras-team/keras-cv.git

gianfrancodemarco commented 1 year ago

@bhack in this way I was able to use it, but the loss is stuck at 1.8316 and no improving

bhack commented 1 year ago

I suggest to open a ticket on keras-cv as with components already re-implemented in keras-* we suggest to migrate on that library.

seanpmorgan commented 1 year ago

TensorFlow Addons is transitioning to a minimal maintenance and release mode. New features will not be added to this repository. For more information, please see our public messaging on this decision: TensorFlow Addons Wind Down

Please consider sending feature requests / contributions to other repositories in the TF community with a similar charters to TFA: Keras Keras-CV Keras-NLP