Simplified async test cases to invoke the classifier in context
This commit is contained in:
@@ -471,10 +471,9 @@ class ImageClassifierTest(parameterized.TestCase):
|
|||||||
running_mode=_RUNNING_MODE.LIVE_STREAM,
|
running_mode=_RUNNING_MODE.LIVE_STREAM,
|
||||||
classifier_options=classifier_options,
|
classifier_options=classifier_options,
|
||||||
result_callback=check_result)
|
result_callback=check_result)
|
||||||
classifier = _ImageClassifier.create_from_options(options)
|
with _ImageClassifier.create_from_options(options) as classifier:
|
||||||
for timestamp in range(0, 300, 30):
|
for timestamp in range(0, 300, 30):
|
||||||
classifier.classify_async(self.test_image, timestamp)
|
classifier.classify_async(self.test_image, timestamp)
|
||||||
classifier.close()
|
|
||||||
|
|
||||||
def test_classify_async_succeeds_with_region_of_interest(self):
|
def test_classify_async_succeeds_with_region_of_interest(self):
|
||||||
# Load the test image.
|
# Load the test image.
|
||||||
@@ -499,10 +498,9 @@ class ImageClassifierTest(parameterized.TestCase):
|
|||||||
running_mode=_RUNNING_MODE.LIVE_STREAM,
|
running_mode=_RUNNING_MODE.LIVE_STREAM,
|
||||||
classifier_options=classifier_options,
|
classifier_options=classifier_options,
|
||||||
result_callback=check_result)
|
result_callback=check_result)
|
||||||
classifier = _ImageClassifier.create_from_options(options)
|
with _ImageClassifier.create_from_options(options) as classifier:
|
||||||
for timestamp in range(0, 300, 30):
|
for timestamp in range(0, 300, 30):
|
||||||
classifier.classify_async(test_image, timestamp, roi)
|
classifier.classify_async(test_image, timestamp, roi)
|
||||||
classifier.close()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user