coremltools icon indicating copy to clipboard operation
coremltools copied to clipboard

'generate_detections/while/while' for RetinaNet model

Open hemangchawla opened this issue 2 years ago • 4 comments

  • Name of layer type: 'generate_detections/while/while'
  • Is this a PyTorch or a TensorFlow layer type: Tensorflow
  • Your version of coremltools: 7.1
  • Your version of PyTorch/TensorFlow: 2.13
  • Impact of supporting this layer type. Why is adding support for this layer type important? Is it necessary to support a popular model or use case? It allows using object detection model RetinaNet from the TF2 model garden/ official vision task. (see here)

hemangchawla avatar Nov 18 '23 00:11 hemangchawla

Hi Hemang, thanks for bring this model to our attention! To best facilitate the support process, could you please provide a minimal reproduce?

Concretely, a toy TensorFlow model with only the missing generate_detections/while/while layer

YifanShenSZ avatar Nov 18 '23 07:11 YifanShenSZ

Hi @YifanShenSZ, I am not entirely sure about making a toy model with the exact layer. As you can see in the RetinaNet code, generate_detections is part of the _predict_postprocess function. The postprocess is done until the refinement criteria is met (see generate_detections function.

hemangchawla avatar Nov 18 '23 14:11 hemangchawla

@YifanShenSZ, could you please share if you had some time to look at this? Perhaps the issue is something other than missing layer type?

hemangchawla avatar Nov 22 '23 14:11 hemangchawla

@YifanShenSZ the issue seems to be the while loop within non maximal suppression that is done in the post processing of the model. Is there some support for that?

I note this related open issue in this regard: https://github.com/apple/coremltools/issues/1542

hemangchawla avatar Dec 07 '23 12:12 hemangchawla