keras-team/keras-cv

Boxes from TensorFlow Serving

Closed this issue · 5 comments

Current Behavior:

I trained a Yolov8 model on custom data and would now like to use TensorFlow Serving to get predictions. When I use the Saved Model CLI I see the output for boxes has a shape of (-1, -1, 64). I can save this with keras.saving.save_model, model.save, or tf.saved_model.save and I get the same result. The same result happens when I use a pre-trained model.

Expected Behavior:

I would expect a shape of (-1, -1, 4). I am unsure of how to get bounding boxes from the 64 values I am currently getting.

Steps To Reproduce:

https://colab.research.google.com/gist/alejones/ccc69bd72a1b96fcf1c62a7476e561e6/object_detection_keras_cv.ipynb

Version:

Keras version: 2.15.0
Keras_cv version: 0.8.2

you need to write custom postprocessing for serving:

https://colab.research.google.com/gist/Alparslan-Tamer/8f17cf31e5bdb21e9cb1e52b8347c903/object_detection_keras_cv.ipynb

i changed your code in here.

@Alparslan-Tamer is right. Thanks for responding @Alparslan-Tamer! Let me know if this addresses your issue @alejones.

@Alparslan-Tamer, Thank you! That solved my issue.

Is there any documentation on how to add a signature or other postprocessing functions. In particular I'd like to be able to return a string with the class name instead of having an int that needs to be mapped to a class name.

Hi @alejones , you can do any customization inside the inference function, I wrote a simple code (you can write a better one) for the problem you mentioned, you can see it from the link below.

https://colab.research.google.com/gist/Alparslan-Tamer/8f17cf31e5bdb21e9cb1e52b8347c903/object_detection_keras_cv.ipynb

@Alparslan-Tamer, Thanks again! This is what I was looking for.