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

इमेज क्लासिफिकेशन

इस अभ्यास में, आप पहले वाले ही flickr डेटासेट का उपयोग करेंगे, जिसमें 30,000 इमेज और उनसे जुड़ी captions हैं. अब आप एक प्रीट्रेन मॉडल का उपयोग करके इमेज को classify करेंगे.

Photo of 2 people, 1 is playing the guitar

सैंपल इमेज (image) और पाइपलाइन मॉड्यूल (pipeline) लोड कर दिए गए हैं.

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

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

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

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

  • google/mobilenet_v2_1.0_224 प्रीट्रेन मॉडल के साथ image-classification पाइपलाइन लोड करें.
  • सैंपल इमेज की class predict करने के लिए पाइपलाइन का उपयोग करें.
  • पहला (highest probability) label प्रिंट करें.

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

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

# Load the image-classification pipeline
pipe = ____

# Use the pipeline to predict the class of the sample image
pred = ____

# Print the first (highest probability) label
print("Predicted class:", ____)
कोड संपादित करें और चलाएँ