Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATA-3461 - Refactoring code for classifications #4764

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tahiyasalam
Copy link
Member

@tahiyasalam tahiyasalam commented Jan 30, 2025

In app, for the Cloud ML model service, we will need to have code that basically looks at flat tensors and then parses the relevant classifications from them. This is essentially duplicated in the vision service, since that it almost exactly what we do.

Please cross-reference this PR for a WIP of what we're trying to accomplish: https://github.com/viamrobotics/app/pull/7458

I am mainly looking for feedback on whether:
a) this refactoring makes sense
b) if this where all the code should live
c) if you want me to add any more tests to make sure I didn't break anything

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Jan 30, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 30, 2025
@tahiyasalam tahiyasalam requested a review from bhaney January 30, 2025 20:12
Copy link
Member

@bhaney bhaney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! I think as long as all of the written tests in mlmodel service and vision service still pass, this is all looks good! I think as an extra sanity check, also manually test out our ImageNet classifier on a test robot on your computer using the new RDK

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you split this file into two, one with the functions that just have to do with classification, and the other the generic Tensor to protobuf conversion functions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course! thank you for the first pass. I will update the PR description with all the manual testing

}

// softmax takes the input slice and applies the softmax function.
func softmax(in []float64) []float64 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll probably have to make this public, as I think it's used in the vision service

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 30, 2025
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants