Whisper 정확도 팁: 전사 품질을 높이는 방법

Whisper 정확도 팁: 전사 품질을 높이는 방법

Eric King

Eric King

Author


Whisper 정확도 팁: 전사 품질을 높이는 방법

OpenAI Whisper는 이미 오픈 소스 음성 인식 모델 중에서도 정확도가 높은 편이지만, 여러 전략으로 전사 품질을 더 끌어올릴 수 있습니다. 이 가이드는 사용 사례에 맞게 Whisper 정확도를 높이기 위한 실용적인 팁, 코드 예제, 모범 사례를 정리합니다.
이런 분께 추천합니다:
  • Whisper 전사 정확도를 최적화하는 개발자
  • 팟캐스트·영상을 전사하는 크리에이터
  • 오디오 데이터를 다루는 연구자
  • Whisper 정확도 팁을 찾는 분

Whisper 정확도에 영향을 주는 요소

최적화에 앞서 무엇이 중요한지 알아두세요.
  • 오디오 품질(가장 중요)
  • 모델 크기 선택
  • 언어 감지 정확도
  • 오디오 전처리
  • 설정 매개변수
  • 오디오 길이와 분할

팁 1: 적절한 모델 크기 선택

Whisper는 다섯 가지 크기로, 각각 속도와 정확도의 균형이 다릅니다.
import whisper

# Model sizes from fastest to most accurate:
# tiny, base, small, medium, large

# For maximum accuracy, use medium or large
model = whisper.load_model("medium")  # Best balance
# or
model = whisper.load_model("large")  # Maximum accuracy
모델 선택 가이드:
모델정확도속도이럴 때
tiny⭐⭐⭐⭐⭐⭐⭐빠른 테스트, 단순 오디오
base⭐⭐⭐⭐⭐⭐⭐일반 용도, 균형
small⭐⭐⭐⭐⭐⭐⭐좋은 정확도, 허용 가능한 속도
medium⭐⭐⭐⭐⭐⭐⭐높은 정확도 필요
large⭐⭐⭐⭐⭐⭐최고 정확도, 노이즈 많은 오디오
코드 예제:
import whisper

def transcribe_with_optimal_model(audio_path, prioritize_accuracy=True):
    """
    Select model based on accuracy vs speed priority.
    
    Args:
        audio_path: Path to audio file
        prioritize_accuracy: True for accuracy, False for speed
    """
    if prioritize_accuracy:
        model_size = "medium"  # or "large" for best accuracy
    else:
        model_size = "base"  # or "small" for balanced
    
    model = whisper.load_model(model_size)
    result = model.transcribe(audio_path)
    
    return result

# For critical transcriptions
result = transcribe_with_optimal_model("important_meeting.mp3", prioritize_accuracy=True)
핵심: 정확도가 매우 중요하면 medium 또는 large를 사용하세요. 중요한 콘텐츠에서는 속도와의 트레이드오프가 대개 감수할 만합니다.

팁 2: 알려진 경우 언어 지정

Whisper는 언어를 자동 감지하지만, 명시적으로 지정하면 정확도가 좋아집니다.
import whisper

model = whisper.load_model("base")

# Auto-detect (less accurate)
result_auto = model.transcribe("audio.mp3")

# Specify language (more accurate)
result_en = model.transcribe("audio.mp3", language="en")
result_zh = model.transcribe("audio.mp3", language="zh")
result_es = model.transcribe("audio.mp3", language="es")
도움이 되는 이유:
  • 언어 감지 오류 감소
  • 다중 언어 화자에게 더 나은 결과
  • 감지 단계를 건너뛰어 더 빠를 수 있음
  • 억양·방언 처리에 유리
언어 감지 예제:
import whisper
import langdetect

def transcribe_with_language_detection(audio_path, model_size="base"):
    """
    Detect language first, then transcribe with explicit language.
    """
    model = whisper.load_model(model_size)
    
    # Quick language detection
    result_quick = model.transcribe(audio_path, language=None)
    detected_lang = result_quick["language"]
    
    # Re-transcribe with detected language for better accuracy
    result = model.transcribe(audio_path, language=detected_lang)
    
    return result

result = transcribe_with_language_detection("audio.mp3")

팁 3: 전사 전 오디오 전처리

전처리는 Whisper 정확도를 크게 높일 수 있습니다.
import whisper
import numpy as np
from scipy.io import wavfile
from scipy import signal

def preprocess_audio(audio_path, output_path):
    """
    Preprocess audio to improve transcription accuracy.
    """
    # Read audio file
    sample_rate, audio = wavfile.read(audio_path)
    
    # Normalize audio (scale to [-1, 1])
    if audio.dtype == np.int16:
        audio = audio.astype(np.float32) / 32768.0
    elif audio.dtype == np.int32:
        audio = audio.astype(np.float32) / 2147483648.0
    
    # Remove DC offset
    audio = audio - np.mean(audio)
    
    # Normalize volume
    max_val = np.max(np.abs(audio))
    if max_val > 0:
        audio = audio / max_val * 0.95  # Leave headroom
    
    # Resample to 16kHz (Whisper's optimal sample rate)
    if sample_rate != 16000:
        num_samples = int(len(audio) * 16000 / sample_rate)
        audio = signal.resample(audio, num_samples)
        sample_rate = 16000
    
    # Save preprocessed audio
    wavfile.write(output_path, sample_rate, (audio * 32767).astype(np.int16))
    
    return output_path

# Usage
preprocessed = preprocess_audio("raw_audio.wav", "preprocessed.wav")
model = whisper.load_model("base")
result = model.transcribe(preprocessed)
전처리 단계:
  1. 레벨 정규화 — 일정한 볼륨
  2. DC 오프셋 제거 — 직류 편차 제거
  3. 16kHz로 리샘플 — Whisper에 적합한 샘플링 속도
  4. 무음 제거 — 음성 구간에 집중
  5. 노이즈 감소 — 배경 소음 정리

팁 4: temperature 설정으로 결과 개선

temperature 매개변수는 무작위성을 조절합니다. 낮을수록 정확도에 유리한 경우가 많습니다.
import whisper

model = whisper.load_model("base")

# Default temperature (0.0)
result_default = model.transcribe("audio.mp3")

# Lower temperature for more deterministic results
result_low_temp = model.transcribe(
    "audio.mp3",
    temperature=0.0,  # Most deterministic
    best_of=5,  # Try multiple decodings, pick best
    beam_size=5  # Beam search size
)
temperature 설정:
  • temperature=0.0: 가장 결정적, 정확도에 유리
  • temperature=0.2: 약간의 무작위, 균형
  • temperature=0.6: 기본값, 균형
  • 더 높은 값: 다양하지만 덜 정확할 수 있음
모범 사례:
def transcribe_with_optimal_settings(audio_path, model_size="base"):
    """
    Use optimal settings for maximum accuracy.
    """
    model = whisper.load_model(model_size)
    
    result = model.transcribe(
        audio_path,
        temperature=0.0,  # Most deterministic
        best_of=5,  # Try 5 decodings, pick best
        beam_size=5,  # Beam search
        patience=1.0,  # Patience for beam search
        condition_on_previous_text=True,  # Use context
        initial_prompt="This is a conversation about technology."  # Context hint
    )
    
    return result

팁 5: 문맥을 위한 initial prompt

내용에 대한 문맥을 주면 정확도가 좋아집니다.
import whisper

model = whisper.load_model("base")

# Without context
result_basic = model.transcribe("meeting.mp3")

# With context (much better accuracy)
result_context = model.transcribe(
    "meeting.mp3",
    initial_prompt="This is a business meeting discussing project timelines and deliverables."
)

# For technical content
result_tech = model.transcribe(
    "lecture.mp3",
    initial_prompt="This is a computer science lecture about machine learning and neural networks."
)
initial prompt를 쓰기 좋은 경우:
  • 기술 콘텐츠: 도메인 용어 포함
  • 이름·장소: 중요한 고유명사 언급
  • 억양: 화자의 억양·방언 설명
  • 문맥: 상황이나 주제 설명
예:
def transcribe_with_context(audio_path, context_description):
    """
    Transcribe with context for better accuracy.
    """
    model = whisper.load_model("medium")
    
    result = model.transcribe(
        audio_path,
        initial_prompt=context_description,
        language="en"
    )
    
    return result

# Example usage
result = transcribe_with_context(
    "interview.mp3",
    "This is an interview with Dr. Sarah Johnson about medical research. "
    "The conversation includes technical medical terminology."
)

팁 6: 긴 오디오 파일 다루기

매우 긴 파일은 정확도를 떨어뜨릴 수 있습니다. 다음처럼 처리하세요.
import whisper
from pydub import AudioSegment
import os

def transcribe_long_audio(audio_path, model_size="base", chunk_length_minutes=30):
    """
    Transcribe long audio by splitting into optimal chunks.
    """
    model = whisper.load_model(model_size)
    
    # Load audio
    audio = AudioSegment.from_file(audio_path)
    chunk_length_ms = chunk_length_minutes * 60 * 1000
    
    # Split into chunks
    chunks = []
    for i in range(0, len(audio), chunk_length_ms):
        chunks.append(audio[i:i + chunk_length_ms])
    
    # Transcribe each chunk
    full_text = []
    all_segments = []
    
    for i, chunk in enumerate(chunks):
        chunk_path = f"temp_chunk_{i}.wav"
        chunk.export(chunk_path, format="wav")
        
        print(f"Transcribing chunk {i+1}/{len(chunks)}")
        result = model.transcribe(chunk_path)
        
        # Adjust timestamps for chunk offset
        offset = i * chunk_length_ms / 1000.0
        for segment in result["segments"]:
            segment["start"] += offset
            segment["end"] += offset
            all_segments.append(segment)
        
        full_text.append(result["text"])
        
        # Clean up
        os.remove(chunk_path)
    
    # Combine results
    combined_result = {
        "text": " ".join(full_text),
        "segments": all_segments,
        "language": result["language"]
    }
    
    return combined_result

# Usage
result = transcribe_long_audio("long_podcast.mp3", model_size="medium", chunk_length_minutes=30)
긴 오디오 모범 사례:
  • 20~30분 단위로 분할
  • 청크마다 동일한 모델 크기 유지
  • 청크 간 문맥 유지
  • 타임스탬프를 올바르게 병합

팁 7: 노이즈 많은 오디오 최적화

Whisper는 노이즈에 강하지만 더 개선할 수 있습니다.
import whisper
import noisereduce as nr
import soundfile as sf
import numpy as np

def transcribe_noisy_audio(audio_path, model_size="medium"):
    """
    Reduce noise before transcription for better accuracy.
    """
    # Load audio
    audio, sample_rate = sf.read(audio_path)
    
    # Reduce noise
    reduced_noise = nr.reduce_noise(
        y=audio,
        sr=sample_rate,
        stationary=False,  # For non-stationary noise
        prop_decrease=0.8  # Reduce noise by 80%
    )
    
    # Save cleaned audio
    cleaned_path = "cleaned_audio.wav"
    sf.write(cleaned_path, reduced_noise, sample_rate)
    
    # Transcribe with larger model (better for noisy audio)
    model = whisper.load_model(model_size)
    result = model.transcribe(cleaned_path)
    
    # Clean up
    os.remove(cleaned_path)
    
    return result

# Usage
result = transcribe_noisy_audio("noisy_recording.mp3", model_size="medium")
노이즈가 많을 때:
  • medium 또는 large 모델 사용
  • 노이즈 감소로 전처리
  • best_of 증가
  • 노이즈 상황을 프롬프트로 알려 주기

팁 8: 단어 타임스탬프로 세밀하게 제어

단어 수준 타임스탬프로 더 세밀한 제어가 가능합니다.
import whisper

model = whisper.load_model("base")

# Get word timestamps
result = model.transcribe(
    "audio.mp3",
    word_timestamps=True  # Enable word-level timestamps
)

# Access word timestamps
for segment in result["segments"]:
    print(f"Segment: {segment['text']}")
    print(f"Start: {segment['start']:.2f}s, End: {segment['end']:.2f}s")
    
    if "words" in segment:
        for word in segment["words"]:
            print(f"  Word: {word['word']} ({word['start']:.2f}s - {word['end']:.2f}s)")
활용 사례:
  • 자막: 단어별 정확한 타이밍
  • 오류 수정: 문제 단어 식별
  • 검색: 전사문에서 단어 찾기
  • 화자 분석: 발화 패턴 분석

팁 9: 여러 디코딩 결합

best_of로 여러 디코딩을 시도하고 최선을 선택합니다.
import whisper

model = whisper.load_model("base")

# Single decoding (default)
result_single = model.transcribe("audio.mp3")

# Multiple decodings, pick best (more accurate)
result_best = model.transcribe(
    "audio.mp3",
    best_of=5,  # Try 5 decodings
    temperature=(0.0, 0.2, 0.4, 0.6, 0.8)  # Different temperatures
)
트레이드오프:
  • 정확도: 여러 디코딩일수록 높아지기 쉬움
  • 속도: 느려짐(best_of=5 시 약 5배)
  • 적합한 경우: 정확도가 속도보다 중요할 때

팁 10: 전사 후처리

후처리로 Whisper의 흔한 오류를 고칠 수 있습니다.
import re
import whisper

def post_process_transcript(text):
    """
    Fix common transcription errors.
    """
    # Fix common contractions
    text = re.sub(r"\b(\w+) '(\w+)\b", r"\1'\2", text)  # Fix spacing in contractions
    
    # Fix common homophones (add your own)
    replacements = {
        "there": "their",  # Context-dependent
        "its": "it's",  # Context-dependent
        # Add more based on your domain
    }
    
    # Capitalize sentences
    sentences = re.split(r'([.!?]\s+)', text)
    capitalized = []
    for i, sentence in enumerate(sentences):
        if sentence.strip():
            capitalized.append(sentence[0].upper() + sentence[1:] if len(sentence) > 1 else sentence.upper())
        else:
            capitalized.append(sentence)
    
    return "".join(capitalized)

# Usage
model = whisper.load_model("base")
result = model.transcribe("audio.mp3")
processed_text = post_process_transcript(result["text"])

완전한 예: 프로덕션 수준의 정확도 최적화

여러 정확도 팁을 결합한 완전한 예입니다.
import whisper
import os
from pathlib import Path

def transcribe_with_maximum_accuracy(
    audio_path,
    model_size="medium",
    language=None,
    context_prompt=None,
    output_format="txt"
):
    """
    Transcribe audio with maximum accuracy using best practices.
    
    Args:
        audio_path: Path to audio file
        model_size: Whisper model size (medium or large recommended)
        language: Language code (None for auto-detect)
        context_prompt: Initial prompt for context
        output_format: Output format (txt, json, srt)
    """
    # Load model (medium or large for best accuracy)
    print(f"Loading Whisper model: {model_size}")
    model = whisper.load_model(model_size)
    
    # Prepare transcription parameters
    transcribe_kwargs = {
        "temperature": 0.0,  # Most deterministic
        "best_of": 5,  # Try multiple decodings
        "beam_size": 5,  # Beam search
        "patience": 1.0,
        "condition_on_previous_text": True,
        "word_timestamps": True,  # Get word-level timestamps
    }
    
    # Add language if specified
    if language:
        transcribe_kwargs["language"] = language
    
    # Add context prompt if provided
    if context_prompt:
        transcribe_kwargs["initial_prompt"] = context_prompt
    
    # Transcribe
    print(f"Transcribing: {audio_path}")
    result = model.transcribe(audio_path, **transcribe_kwargs)
    
    # Post-process
    result["text"] = post_process_transcript(result["text"])
    
    # Save result
    base_name = Path(audio_path).stem
    output_path = f"{base_name}_transcript.{output_format}"
    
    if output_format == "txt":
        with open(output_path, "w", encoding="utf-8") as f:
            f.write(result["text"])
    elif output_format == "json":
        import json
        with open(output_path, "w", encoding="utf-8") as f:
            json.dump(result, f, indent=2, ensure_ascii=False)
    
    print(f"✓ Transcription saved: {output_path}")
    print(f"  Language: {result['language']}")
    print(f"  Duration: {result['segments'][-1]['end']:.2f}s")
    
    return result

# Example usage
result = transcribe_with_maximum_accuracy(
    audio_path="important_meeting.mp3",
    model_size="medium",
    language="en",
    context_prompt="This is a business meeting discussing quarterly results and project updates.",
    output_format="txt"
)

정확도 비교: 최적화 전후

최적화 시 기대할 수 있는 효과입니다.
최적화정확도 개선속도 영향
모델 크기(base→medium)+15~20%−50%
언어 지정+5~10%+10%(더 빠를 수 있음)
initial prompt+5~15%영향 없음
Temperature=0.0+2~5%영향 없음
best_of=5+3~8%−80%(약 5배 느림)
오디오 전처리+10~20%미미
조합하면 기본 설정 대비 정확도가 30~50%까지 오를 수 있습니다.

모범 사례 요약

최대 정확도:

  1. medium 또는 large 모델
  2. ✅ 언어 명시
  3. initial_prompt로 문맥
  4. ✅ 결정적 결과에 temperature=0.0
  5. ✅ 상세 출력에 word_timestamps
  6. ✅ 노이즈 오디오 전처리
  7. ✅ 긴 파일 분할
  8. ✅ 중요 콘텐츠에 best_of=5

속도·정확도 균형:

  1. small 또는 base 모델
  2. ✅ Whisper에 언어 자동 감지 맡기기
  3. ✅ 기본 temperature
  4. best_of 생략
  5. ✅ 전처리 최소화

흔한 실수

❌ 중요한 콘텐츠에 tiny 사용

해결: 최소 base, 가능하면 small 또는 medium

❌ 언어를 지정하지 않음

해결: 알면 항상 지정

❌ 문맥 무시

해결: 전문 분야에서는 initial_prompt 사용

❌ 노이즈가 큰데 기본 설정

해결: 더 큰 모델과 전처리

❌ 매우 긴 파일을 한 번에 처리

해결: 20~30분 단위로 분할

정확도 문제 해결

문제: 기술 용어에서 정확도 낮음

해결:
result = model.transcribe(
    "technical_audio.mp3",
    initial_prompt="This audio contains technical terminology related to machine learning, neural networks, and deep learning."
)

문제: 억양 때문에 정확도 낮음

해결:
# Use larger model
model = whisper.load_model("medium")

# Provide accent context
result = model.transcribe(
    "accented_audio.mp3",
    initial_prompt="This speaker has a British accent.",
    language="en"
)

문제: 고유명사 오류

해결:
# Include names in initial prompt
result = model.transcribe(
    "interview.mp3",
    initial_prompt="This interview features Dr. Sarah Johnson and Professor Michael Chen discussing research."
)

결론

Whisper 정확도는 올바른 선택으로 좌우됩니다.
  • 모델: 중요한 콘텐츠는 medium 또는 large
  • 설정: 최적의 temperature와 디코딩
  • 문맥: 도메인 정보를 initial_prompt
  • 전처리: 전사 전 오디오 정리
  • 후처리: 흔한 오류 자동 수정
핵심 요약:
  1. 모델 크기가 정확도에 가장 큰 영향
  2. 언어 지정은 효과가 큼
  3. 문맥 프롬프트는 전문 콘텐츠에 특히 유용
  4. best_of는 정확도는 올리지만 속도는 느려짐
  5. 오디오 품질이 가장 중요한 요소
이 팁을 따르면 상용 음성-텍스트 서비스에 맞먹거나 그 이상의 전사 품질을, 데이터와 워크플로를 스스로 통제하면서 달성할 수 있습니다.

Whisper 정확도를 높이고 싶으신가요? 더 큰 모델로 바꾸고 언어를 지정해 보세요. 바로 차이를 느낄 수 있습니다.

지금 무료로 체험하기

지금 바로 저희 AI 음성·오디오·영상 서비스를 체험해 보세요! 고정밀 음성-텍스트 전사, 다국어 번역, 지능형 화자 분리를 제공할 뿐 아니라, 동영상 자동 자막 생성, 오디오·영상 콘텐츠의 스마트 편집, 음성·영상 동기 분석까지 지원합니다. 회의 기록, 숏폼 영상 제작, 팟캐스트 제작 등 모든 상황을 완전히 커버합니다. 지금 무료 체험을 시작해 보세요!