Giter Club home page Giter Club logo

Comments (10)

bhack avatar bhack commented on July 29, 2024

Additionally, we should be able to vectorize area computation in the iou function

What version do you want to implement? We have a vectorized IOU in:
https://github.com/tensorflow/models/blob/master/official/vision/detection/utils/box_utils.py#L643

It is quite the same of the old vectorized benchmarks in:
https://medium.com/@venuktan/vectorized-intersection-over-union-iou-in-numpy-and-tensor-flow-4fa16231b63d

from keras-cv.

bhack avatar bhack commented on July 29, 2024

Also with the scope of having a reusable component library for CV we have also in TF Addons:

https://github.com/tensorflow/addons/blob/master/tensorflow_addons/losses/giou_loss.py#L107-L128

from keras-cv.

LukeWood avatar LukeWood commented on July 29, 2024

Wow, thank you for the vectorized iou. This will save me a lot of time.

from keras-cv.

LukeWood avatar LukeWood commented on July 29, 2024

Additionally, we should be able to vectorize area computation in the iou function

What version do you want to implement? We have a vectorized IOU in: https://github.com/tensorflow/models/blob/master/official/vision/detection/utils/box_utils.py#L643

It is quite the same of the old vectorized benchmarks in: https://medium.com/@venuktan/vectorized-intersection-over-union-iou-in-numpy-and-tensor-flow-4fa16231b63d

moved to https://github.com/tensorflow/models/blob/master/official/legacy/detection/utils/box_utils.py

from keras-cv.

LukeWood avatar LukeWood commented on July 29, 2024

Profile trace of COCORecall:

image

Looks like TensorScatterAdds make up for 20% of compute costs. To fix this, I can use a TensorArray in COCOBase of shape (num_categories*num_thresholds) then reshape it after stacking. This will be much more efficient.

Additionally, we should look into the cost of the sum operations.

from keras-cv.

bhack avatar bhack commented on July 29, 2024

Can you share the gist to reproduce this as we still don't have any CI infra for PR performance regression check?

I suppose one of the problem is that TensorSCattterAdd and Sum are in the inner loop.
Is StridedSlice also coming from _match_boxes innner loop?

The top 3 occurrences in the inner loops are going to take 48,5% of the device time.

from keras-cv.

LukeWood avatar LukeWood commented on July 29, 2024

Can you share the gist to reproduce this as we still don't have any CI infra for PR performance regression check?

Unfortunately no. This uses an internal profiling tool.

I suppose one of the problem is that TensorSCattterAdd and Sum are in the inner loop.
Yeah, the sum operation I expect we can't improve. The ScatterND add, I would bet we can improve this drastically. I will be updating the results to TensorArrays, which should help a lot.

Re: StridedSlice and matching boxes:
I also expect this to take a lot of compute time, it may just be an inherent truth of the algorithm required to compute the metric.

from keras-cv.

bhack avatar bhack commented on July 29, 2024

I think we need to be on the same page to test this also with the same (simulated/random?) input size. Can you share your benchmark gist?

Have you checked if you are ok with the constrains imposed by:
https://www.tensorflow.org/api_docs/python/tf/vectorized_map

from keras-cv.

bhack avatar bhack commented on July 29, 2024

moved to https://github.com/tensorflow/models/blob/master/official/legacy/detection/utils/box_utils.py

The new box and iou ops are in:
https://github.com/tensorflow/models/tree/master/official/vision/beta/ops

from keras-cv.

LukeWood avatar LukeWood commented on July 29, 2024

Unfortunately no. This uses an internal profiling tool.

:( Sorry

from keras-cv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.