From a6c35e9ba5b7b877b8d907d0bf5b5c09d8dab6f3 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Fri, 21 Apr 2023 09:44:27 -0700 Subject: [PATCH] Fixes the typos in tasks internal files. PiperOrigin-RevId: 526063515 --- mediapipe/tasks/python/audio/core/audio_record.py | 6 +++--- .../tasks/python/test/audio/audio_classifier_test.py | 4 ++-- .../tasks/python/test/audio/audio_embedder_test.py | 4 ++-- .../tasks/python/vision/core/base_vision_task_api.py | 2 +- .../tasks/web/vision/core/vision_task_runner.ts | 2 +- .../vision/image_classifier/image_classifier_test.ts | 12 ++++++------ 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mediapipe/tasks/python/audio/core/audio_record.py b/mediapipe/tasks/python/audio/core/audio_record.py index 91e39458..bc12e375 100644 --- a/mediapipe/tasks/python/audio/core/audio_record.py +++ b/mediapipe/tasks/python/audio/core/audio_record.py @@ -47,11 +47,11 @@ class AudioRecord(object): raise sd_error if channels <= 0: - raise ValueError('channels must be postive.') + raise ValueError('channels must be positive.') if sampling_rate <= 0: - raise ValueError('sampling_rate must be postive.') + raise ValueError('sampling_rate must be positive.') if buffer_size <= 0: - raise ValueError('buffer_size must be postive.') + raise ValueError('buffer_size must be positive.') self._audio_buffer = [] self._buffer_size = buffer_size diff --git a/mediapipe/tasks/python/test/audio/audio_classifier_test.py b/mediapipe/tasks/python/test/audio/audio_classifier_test.py index fbd96ad3..33f66786 100644 --- a/mediapipe/tasks/python/test/audio/audio_classifier_test.py +++ b/mediapipe/tasks/python/test/audio/audio_classifier_test.py @@ -47,7 +47,7 @@ _TEST_DATA_DIR = 'mediapipe/tasks/testdata/audio' _TWO_HEADS_WAV_16K_MONO = 'two_heads_16000_hz_mono.wav' _TWO_HEADS_WAV_44K_MONO = 'two_heads_44100_hz_mono.wav' _YAMNET_NUM_OF_SAMPLES = 15600 -_MILLSECONDS_PER_SECOND = 1000 +_MILLISECONDS_PER_SECOND = 1000 class AudioClassifierTest(parameterized.TestCase): @@ -75,7 +75,7 @@ class AudioClassifierTest(parameterized.TestCase): end = min(start + (int)(step_size), len(buffer)) audio_data_list.append((_AudioData.create_from_array( buffer[start:end].astype(float) / np.iinfo(np.int16).max, - sample_rate), (int)(start / sample_rate * _MILLSECONDS_PER_SECOND))) + sample_rate), (int)(start / sample_rate * _MILLISECONDS_PER_SECOND))) start = end return audio_data_list diff --git a/mediapipe/tasks/python/test/audio/audio_embedder_test.py b/mediapipe/tasks/python/test/audio/audio_embedder_test.py index 0fc01ee7..e5735b6b 100644 --- a/mediapipe/tasks/python/test/audio/audio_embedder_test.py +++ b/mediapipe/tasks/python/test/audio/audio_embedder_test.py @@ -45,7 +45,7 @@ _SPEECH_WAV_48K_MONO = 'speech_48000_hz_mono.wav' _TWO_HEADS_WAV_16K_MONO = 'two_heads_16000_hz_mono.wav' _TEST_DATA_DIR = 'mediapipe/tasks/testdata/audio' _YAMNET_NUM_OF_SAMPLES = 15600 -_MILLSECONDS_PER_SECOND = 1000 +_MILLISECONDS_PER_SECOND = 1000 # Tolerance for embedding vector coordinate values. _EPSILON = 3e-6 @@ -78,7 +78,7 @@ class AudioEmbedderTest(parameterized.TestCase): end = min(start + (int)(step_size), len(buffer)) audio_data_list.append((_AudioData.create_from_array( buffer[start:end].astype(float) / np.iinfo(np.int16).max, - sample_rate), (int)(start / sample_rate * _MILLSECONDS_PER_SECOND))) + sample_rate), (int)(start / sample_rate * _MILLISECONDS_PER_SECOND))) start = end return audio_data_list diff --git a/mediapipe/tasks/python/vision/core/base_vision_task_api.py b/mediapipe/tasks/python/vision/core/base_vision_task_api.py index d9195d3c..3775f223 100644 --- a/mediapipe/tasks/python/vision/core/base_vision_task_api.py +++ b/mediapipe/tasks/python/vision/core/base_vision_task_api.py @@ -188,7 +188,7 @@ class BaseVisionTaskApi(object): # For 90° and 270° rotations, we need to swap width and height. # This is due to the internal behavior of ImageToTensorCalculator, which: # - first denormalizes the provided rect by multiplying the rect width or - # height by the image width or height, repectively. + # height by the image width or height, respectively. # - then rotates this by denormalized rect by the provided rotation, and # uses this for cropping, # - then finally rotates this back. diff --git a/mediapipe/tasks/web/vision/core/vision_task_runner.ts b/mediapipe/tasks/web/vision/core/vision_task_runner.ts index 2a5c3f0e..b815a24d 100644 --- a/mediapipe/tasks/web/vision/core/vision_task_runner.ts +++ b/mediapipe/tasks/web/vision/core/vision_task_runner.ts @@ -186,7 +186,7 @@ export abstract class VisionTaskRunner extends TaskRunner { // For 90° and 270° rotations, we need to swap width and height. // This is due to the internal behavior of ImageToTensorCalculator, which: // - first denormalizes the provided rect by multiplying the rect width or - // height by the image width or height, repectively. + // height by the image width or height, respectively. // - then rotates this by denormalized rect by the provided rotation, and // uses this for cropping, // - then finally rotates this back. diff --git a/mediapipe/tasks/web/vision/image_classifier/image_classifier_test.ts b/mediapipe/tasks/web/vision/image_classifier/image_classifier_test.ts index 60595310..7058e2a5 100644 --- a/mediapipe/tasks/web/vision/image_classifier/image_classifier_test.ts +++ b/mediapipe/tasks/web/vision/image_classifier/image_classifier_test.ts @@ -117,12 +117,12 @@ describe('ImageClassifier', () => { classifcations.setHeadIndex(1); classifcations.setHeadName('headName'); const classificationList = new ClassificationList(); - const clasification = new Classification(); - clasification.setIndex(1); - clasification.setScore(0.2); - clasification.setDisplayName('displayName'); - clasification.setLabel('categoryName'); - classificationList.addClassification(clasification); + const classification = new Classification(); + classification.setIndex(1); + classification.setScore(0.2); + classification.setDisplayName('displayName'); + classification.setLabel('categoryName'); + classificationList.addClassification(classification); classifcations.setClassificationList(classificationList); classificationResult.addClassifications(classifcations);