Open cooperlab opened 2 years ago
Attempted this today and it was not trivial since Faster R-CNN is composed of many submodels. It required many casting operations in RoiAlign and train_step. The result was slightly slower.
Leaving this issue up in case Keras changes, or to look at performing mixed precision for the backbone only.
Update Faster R-CNN constituent networks and example to support mixed precision.
Each model output that feeds a loss needs to output an fp32 float. This can be accomplished by adding a linear activation with float32 type without impacting the network:
output = layers.Activation('linear', dtype='float32', name='predictions')(input)