Skip to content

Commit 4639626

Browse files
lu-wang-gxunkai55
authored andcommitted
Loosen the constraint for score_threshold in ImageClassifier
PiperOrigin-RevId: 373805511
1 parent 9f9faca commit 4639626

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

tensorflow_lite_support/cc/task/vision/image_classifier.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,6 @@ absl::Status ImageClassifier::SanityCheckOptions(
103103
"Invalid `max_results` option: value must be != 0",
104104
TfLiteSupportStatus::kInvalidArgumentError);
105105
}
106-
if (options.score_threshold() < 0 || options.score_threshold() >= 1) {
107-
return CreateStatusWithPayload(
108-
StatusCode::kInvalidArgument,
109-
absl::StrFormat(
110-
"`score_threshold` out of range: %f. Valid range is [0,1[.",
111-
options.score_threshold()),
112-
TfLiteSupportStatus::kInvalidArgumentError);
113-
}
114106
if (options.class_name_whitelist_size() > 0 &&
115107
options.class_name_blacklist_size() > 0) {
116108
return CreateStatusWithPayload(

tensorflow_lite_support/cc/task/vision/proto/image_classifier_options.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ message ImageClassifierOptions {
4343
// returned.
4444
optional int32 max_results = 2 [default = -1];
4545

46-
// Score threshold in [0,1), overrides the ones provided in the model metadata
46+
// Score threshold, overrides the ones provided in the model metadata
4747
// (if any). Results below this value are rejected.
4848
optional float score_threshold = 3;
4949

tensorflow_lite_support/java/src/java/org/tensorflow/lite/task/vision/classifier/ImageClassifier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public Builder setMaxResults(int maxResults) {
275275
}
276276

277277
/**
278-
* Sets the score threshold in [0,1).
278+
* Sets the score threshold.
279279
*
280280
* <p>It overrides the one provided in the model metadata (if any). Results below this value
281281
* are rejected.

0 commit comments

Comments
 (0)