시작하기무료로 시작하기

캡션 품질 자동 평가

드레스 이미지를 정확히 분류하셨네요. 그렇다면 원래 설명은 얼마나 괜찮았을까요?

Maa Fab wrap with a Trendy design dress with Vibrant color for an elegant touch of Fabric completely Soft and Comfortable wear with amazing design of Solid Boat ? Neck Flared Dress to make a perfect addition to your wardrobe collection.

이제 CLIP 점수를 사용해 이 설명이 얼마나 정확한지 정량적으로 평가해 볼 거예요. torchmetricsclip_score() 함수와 함께 캡션(description), 이미지(image), ToTensor 클래스가 이미 로드되어 있습니다.

이 연습은 강의의 일부입니다

Hugging Face로 배우는 멀티모달 모델

강의 보기

연습 안내

  • 이미지를 0-255 범위의 강도를 갖는 PyTorch 텐서로 변환하세요.
  • clip_score() 함수를 사용해 openai/clip-vit-base-patch32 모델로 image_tensordescription을 비교하여 캡션의 품질을 평가하세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Convert the image to a PyTorch tensor
image_tensor = ____()(image)*____

# Use the clip_score function to assess the quality of the caption
score = ____(____, ____, "____")

print(f"CLIP score: {score}")
코드 편집 및 실행