Tutorials4 min read
تصنيف الصور باستخدام Potato
تعلم كيفية إعداد مهام تصنيف الصور مع معاينات مصغرة وعناصر تحكم في التكبير ودعم التسميات المتعددة.
Potato Team·
تصنيف الصور باستخدام Potato
يعد تصنيف الصور حجر الأساس في الرؤية الحاسوبية. سواء كنت تبني نظام تصنيف منتجات أو خط إدارة محتوى أو مصنف تصوير طبي، يوفر Potato الأدوات التي تحتاجها لتوسيم الصور بكفاءة.
ما ستتعلمه
- إعداد مهام توسيم الصور
- التصنيف بتسمية واحدة وتسميات متعددة
- هياكل الفئات الهرمية
- ضبط الجودة لمهام الصور
تصنيف الصور الأساسي
لنبدأ بمهمة تصنيف بتسمية واحدة بسيطة.
التكوين
yaml
annotation_task_name: "Product Image Classification"
# Image data
data_files:
- data/products.json
item_properties:
id_key: product_id
text_key: image_url
# Classification labels
annotation_schemes:
- annotation_type: image_annotation
name: category
description: "What type of product is shown?"
labels:
- Electronics
- Clothing
- Home & Garden
- Sports & Outdoors
- Books & Media
- Other
keyboard_shortcuts:
Electronics: "1"
Clothing: "2"
"Home & Garden": "3"
"Sports & Outdoors": "4"
"Books & Media": "5"
Other: "6"صيغة البيانات
أنشئ data/products.json:
json
{"product_id": "P001", "image_url": "/images/products/laptop.jpg"}
{"product_id": "P002", "image_url": "/images/products/tshirt.jpg"}
{"product_id": "P003", "image_url": "/images/products/garden_tools.jpg"}
{"product_id": "P004", "image_url": "https://example.com/images/basketball.jpg"}يمكن أن تكون الصور مسارات محلية أو عناوين URL.
التصنيف متعدد التسميات
للصور التي تنتمي لفئات متعددة:
yaml
annotation_schemes:
- annotation_type: multiselect
name: attributes
description: "Select all attributes that apply to this image"
labels:
- Contains people
- Outdoor scene
- Indoor scene
- Contains text
- Product photo
- Lifestyle photo
- Close-up shot
- Wide angle
min_selections: 1
max_selections: 5الفئات الهرمية
للتصنيفات المعقدة، استخدم تسميات متداخلة:
yaml
annotation_schemes:
- annotation_type: radio
name: main_category
description: "Primary category"
labels:
- Apparel
- Electronics
- Home
- annotation_type: radio
name: subcategory
description: "Subcategory"
conditional:
depends_on: main_category
options:
Apparel:
- Tops
- Bottoms
- Footwear
- Accessories
Electronics:
- Phones
- Computers
- Audio
- Cameras
Home:
- Furniture
- Decor
- Kitchen
- Beddingتقييم جودة الصور
أضف فحوصات الجودة جنباً إلى جنب مع التصنيف:
yaml
annotation_schemes:
- annotation_type: radio
name: category
description: "Product category"
labels: [Electronics, Clothing, Home, Other]
- annotation_type: radio
name: image_quality
description: "Is this image suitable for the product catalog?"
labels:
- name: Approved
description: "Clear, well-lit, product is visible"
- name: Needs review
description: "Minor issues but potentially usable"
- name: Rejected
description: "Poor quality, wrong product, or inappropriate"
- annotation_type: multiselect
name: quality_issues
description: "If not approved, what issues are present?"
labels:
- Blurry or out of focus
- Poor lighting
- Wrong product shown
- Watermark or text overlay
- Inappropriate content
- Multiple products in frame
conditional:
depends_on: image_quality
show_when: ["Needs review", "Rejected"]إعدادات الصور المتقدمة
لتخصيص عرض الصور المتقدم، كوّن نوع image_annotation في مخططات التوسيم واستخدم CSS أو تنسيقاً مخصصاً حسب الحاجة.
مثال كامل
إليك تكويناً جاهزاً للإنتاج:
yaml
annotation_task_name: "E-commerce Image Classification"
data_files:
- data/images.json
item_properties:
id_key: sku
text_key: image_path
annotation_schemes:
- annotation_type: image_annotation
name: primary_category
description: "Select the main product category"
labels:
- Electronics
- Clothing & Accessories
- Home & Living
- Beauty & Personal Care
- Sports & Fitness
- Toys & Games
- Other
required: true
keyboard_shortcuts:
Electronics: "1"
"Clothing & Accessories": "2"
"Home & Living": "3"
"Beauty & Personal Care": "4"
"Sports & Fitness": "5"
"Toys & Games": "6"
Other: "7"
- annotation_type: multiselect
name: image_attributes
description: "Select all that apply"
labels:
- White background
- Lifestyle shot
- Multiple angles
- Model wearing/using
- Size reference included
- Brand visible
required: false
- annotation_type: radio
name: listing_ready
description: "Is this image ready for product listing?"
labels:
- Yes - Ready to publish
- No - Needs editing
- No - Reshoot required
required: true
annotation_guidelines:
title: "Image Classification Guidelines"
content: |
## Category Selection
Choose the most specific category that fits the product.
## Image Quality
- "Ready to publish": Clear, professional, meets standards
- "Needs editing": Good photo but needs cropping/color correction
- "Reshoot required": Fundamentally unsuitableنصائح لتوسيم الصور
- إعداد شاشة متسق: تأكد من معايرة شاشات المُوسِّمين
- تعريفات فئات واضحة: ضمّن صوراً نموذجية في الإرشادات
- التعامل مع الحالات الحدية: وثّق ما يجب فعله مع الصور الغامضة
- معايرة منتظمة: راجع العينات معاً كفريق
الخطوات التالية
- تعلم توسيم مربعات الإحاطة لاكتشاف الأجسام
- أعدّ توسيم المضلعات للتجزئة
- استكشف توسيم الفيديو للمهام الزمنية
راجع وثائق توسيم الصور الكاملة في /docs/features/image-annotation.