Fixes the typos in tasks internal files.

PiperOrigin-RevId: 526063515
This commit is contained in:
MediaPipe Team 2023-04-21 09:44:27 -07:00 committed by Copybara-Service
parent 9be748db00
commit a6c35e9ba5
6 changed files with 15 additions and 15 deletions

View File

@ -47,11 +47,11 @@ class AudioRecord(object):
raise sd_error raise sd_error
if channels <= 0: if channels <= 0:
raise ValueError('channels must be postive.') raise ValueError('channels must be positive.')
if sampling_rate <= 0: if sampling_rate <= 0:
raise ValueError('sampling_rate must be postive.') raise ValueError('sampling_rate must be positive.')
if buffer_size <= 0: if buffer_size <= 0:
raise ValueError('buffer_size must be postive.') raise ValueError('buffer_size must be positive.')
self._audio_buffer = [] self._audio_buffer = []
self._buffer_size = buffer_size self._buffer_size = buffer_size

View File

@ -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_16K_MONO = 'two_heads_16000_hz_mono.wav'
_TWO_HEADS_WAV_44K_MONO = 'two_heads_44100_hz_mono.wav' _TWO_HEADS_WAV_44K_MONO = 'two_heads_44100_hz_mono.wav'
_YAMNET_NUM_OF_SAMPLES = 15600 _YAMNET_NUM_OF_SAMPLES = 15600
_MILLSECONDS_PER_SECOND = 1000 _MILLISECONDS_PER_SECOND = 1000
class AudioClassifierTest(parameterized.TestCase): class AudioClassifierTest(parameterized.TestCase):
@ -75,7 +75,7 @@ class AudioClassifierTest(parameterized.TestCase):
end = min(start + (int)(step_size), len(buffer)) end = min(start + (int)(step_size), len(buffer))
audio_data_list.append((_AudioData.create_from_array( audio_data_list.append((_AudioData.create_from_array(
buffer[start:end].astype(float) / np.iinfo(np.int16).max, 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 start = end
return audio_data_list return audio_data_list

View File

@ -45,7 +45,7 @@ _SPEECH_WAV_48K_MONO = 'speech_48000_hz_mono.wav'
_TWO_HEADS_WAV_16K_MONO = 'two_heads_16000_hz_mono.wav' _TWO_HEADS_WAV_16K_MONO = 'two_heads_16000_hz_mono.wav'
_TEST_DATA_DIR = 'mediapipe/tasks/testdata/audio' _TEST_DATA_DIR = 'mediapipe/tasks/testdata/audio'
_YAMNET_NUM_OF_SAMPLES = 15600 _YAMNET_NUM_OF_SAMPLES = 15600
_MILLSECONDS_PER_SECOND = 1000 _MILLISECONDS_PER_SECOND = 1000
# Tolerance for embedding vector coordinate values. # Tolerance for embedding vector coordinate values.
_EPSILON = 3e-6 _EPSILON = 3e-6
@ -78,7 +78,7 @@ class AudioEmbedderTest(parameterized.TestCase):
end = min(start + (int)(step_size), len(buffer)) end = min(start + (int)(step_size), len(buffer))
audio_data_list.append((_AudioData.create_from_array( audio_data_list.append((_AudioData.create_from_array(
buffer[start:end].astype(float) / np.iinfo(np.int16).max, 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 start = end
return audio_data_list return audio_data_list

View File

@ -188,7 +188,7 @@ class BaseVisionTaskApi(object):
# For 90° and 270° rotations, we need to swap width and height. # For 90° and 270° rotations, we need to swap width and height.
# This is due to the internal behavior of ImageToTensorCalculator, which: # This is due to the internal behavior of ImageToTensorCalculator, which:
# - first denormalizes the provided rect by multiplying the rect width or # - 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 # - then rotates this by denormalized rect by the provided rotation, and
# uses this for cropping, # uses this for cropping,
# - then finally rotates this back. # - then finally rotates this back.

View File

@ -186,7 +186,7 @@ export abstract class VisionTaskRunner extends TaskRunner {
// For 90° and 270° rotations, we need to swap width and height. // For 90° and 270° rotations, we need to swap width and height.
// This is due to the internal behavior of ImageToTensorCalculator, which: // This is due to the internal behavior of ImageToTensorCalculator, which:
// - first denormalizes the provided rect by multiplying the rect width or // - 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 // - then rotates this by denormalized rect by the provided rotation, and
// uses this for cropping, // uses this for cropping,
// - then finally rotates this back. // - then finally rotates this back.

View File

@ -117,12 +117,12 @@ describe('ImageClassifier', () => {
classifcations.setHeadIndex(1); classifcations.setHeadIndex(1);
classifcations.setHeadName('headName'); classifcations.setHeadName('headName');
const classificationList = new ClassificationList(); const classificationList = new ClassificationList();
const clasification = new Classification(); const classification = new Classification();
clasification.setIndex(1); classification.setIndex(1);
clasification.setScore(0.2); classification.setScore(0.2);
clasification.setDisplayName('displayName'); classification.setDisplayName('displayName');
clasification.setLabel('categoryName'); classification.setLabel('categoryName');
classificationList.addClassification(clasification); classificationList.addClassification(classification);
classifcations.setClassificationList(classificationList); classifcations.setClassificationList(classificationList);
classificationResult.addClassifications(classifcations); classificationResult.addClassifications(classifcations);