Skip to content

Commit 98e5237

Browse files
lu-wang-gxunkai55
authored andcommitted
Loosen the constraint for score_threshold in AudioClassifier
PiperOrigin-RevId: 373891786
1 parent 4639626 commit 98e5237

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

tensorflow_lite_support/cc/task/audio/audio_classifier.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,6 @@ absl::Status AudioClassifier::SanityCheckOptions(
134134
"Invalid `max_results` option: value must be != 0",
135135
TfLiteSupportStatus::kInvalidArgumentError);
136136
}
137-
if (options.score_threshold() < 0 || options.score_threshold() >= 1) {
138-
return CreateStatusWithPayload(
139-
StatusCode::kInvalidArgument,
140-
absl::StrFormat(
141-
"`score_threshold` out of range: %f. Valid range is [0,1[.",
142-
options.score_threshold()),
143-
TfLiteSupportStatus::kInvalidArgumentError);
144-
}
145137
if (options.class_name_allowlist_size() > 0 &&
146138
options.class_name_denylist_size() > 0) {
147139
return CreateStatusWithPayload(

tensorflow_lite_support/cc/task/audio/proto/audio_classifier_options.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ message AudioClassifierOptions {
3434
// returned.
3535
optional int32 max_results = 3 [default = -1];
3636

37-
// Score threshold in [0,1), overrides the ones provided in the model metadata
37+
// Score threshold, overrides the ones provided in the model metadata
3838
// (if any). Results below this value are rejected.
3939
optional float score_threshold = 4;
4040

tensorflow_lite_support/java/src/java/org/tensorflow/lite/task/audio/classifier/AudioClassifier.java

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

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

0 commit comments

Comments
 (0)