शुरू करेंमुफ़्त में शुरू करें

कैप्शन गुणवत्ता का ऑटोमेटेड आकलन

आपने ड्रेस वाली image को सही तरीके से क्लासिफाई किया है, लेकिन मूल विवरण कितना अच्छा था?

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 मॉडल का इस्तेमाल करके इस विवरण की शुद्धता के बारे में संख्यात्मक रूप से बताने के लिए CLIP स्कोर का उपयोग करेंगे. Caption (description), image (image), ToTensor क्लास, और torchmetrics की clip_score() फंक्शन पहले से लोड हैं.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Hugging Face के साथ मल्टी-मोडल मॉडल्स

पाठ्यक्रम देखें

अभ्यास निर्देश

  • image को PyTorch tensor में कन्वर्ट करें ताकि intensities 0-255 की रेंज में हों.
  • clip_score() फंक्शन का उपयोग करके image_tensor और description की तुलना करें, और openai/clip-vit-base-patch32 मॉडल के साथ caption की गुणवत्ता का आकलन करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# 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}")
कोड संपादित करें और चलाएँ