-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Use any
as the default function label type
#9050
Conversation
Currently, the default is `unknown`, but allowing `unknown` as a function label type value creates some complications. * The sets of allowed label types of a task and of a function are not the same, so we have to use different enums to represent them. * `any` and `unknown` have similar meanings, and it's not clear what the difference between them is unless you search the code (AFAIK it's not documented anywhere). The sole benefit of having a separate `unknown` label type seems to be that function labels of type `any` are only allowed to be mapped to task labels of type `any`, while function labels of type `unknown` can be mapped to task labels of any type. But it doesn't seem like a useful distinction. Functions with both `unknown` and `any` label types can produce any shape types, so if we allow one of them, it makes sense to also allow the other. In addition, functions that can produce _multiple_ shape types for a single label are probably going to be rare, so I think it's reasonable to assume that a function with an `any`-typed label will still produce a single shape type and therefore can be mapped to a label with a specific type (although the user is responsible for ensuring that the types actually match). To sum up, I don't think the additional complexity introduced by the `unknown` type is worth it. So let's remove it and use `any` instead. This PR keeps some `unknown`-related logic in the UI, since there's some code in the Enterprise backend that also uses `unknown` as a label type. If this patch is accepted, I'll replace those uses with `any` too, then go back and remove the remaining logic here.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #9050 +/- ##
===========================================
+ Coverage 73.43% 73.73% +0.30%
===========================================
Files 419 428 +9
Lines 44351 44501 +150
Branches 3875 3875
===========================================
+ Hits 32569 32813 +244
+ Misses 11782 11688 -94
|
The idea behind having "unknown" as a default value was: the function always return a certain type of objects. It can't return "car" being a rectangle on the first call and a polygon on the second call. Sounds like something unreal. And it was generally done for backward compatibility. After years, may be to remove it at all, considering detectors, not providing their label types, as incorrect? |
I'm against removing it, for a few reasons:
|
Motivation and context
Currently, the default is
unknown
, but allowingunknown
as a function label type value creates some complications.The sets of allowed label types of a task and of a function are not the same, so we have to use different enums to represent them.
any
andunknown
have similar meanings, and it's not clear what the difference between them is unless you search the code (AFAIK it's not documented anywhere).The sole benefit of having a separate
unknown
label type seems to be that function labels of typeany
are only allowed to be mapped to task labels of typeany
, while function labels of typeunknown
can be mapped to task labels of any type. But it doesn't seem like a useful distinction. Functions with bothunknown
andany
label types can produce any shape types, so if we allow one of them, it makes sense to also allow the other.In addition, functions that can produce multiple shape types for a single label are probably going to be rare, so I think it's reasonable to assume that a function with an
any
-typed label will still produce a single shape type and therefore can be mapped to a label with a specific type (although the user is responsible for ensuring that the types actually match).To sum up, I don't think the additional complexity introduced by the
unknown
type is worth it. So let's remove it and useany
instead.This PR keeps some
unknown
-related logic in the UI, since there's some code in the Enterprise backend that also usesunknown
as a label type. If this patch is accepted, I'll replace those uses withany
too, then go back and remove the remaining logic here.How has this been tested?
Manual testing.
Checklist
develop
branch[ ] I have updated the documentation accordingly[ ] I have added tests to cover my changes[ ] I have linked related issues (see GitHub docs)License
Feel free to contact the maintainers if that's a concern.