छवि एनोटेशन
Potato में बाउंडिंग बॉक्स, पॉलीगॉन, मास्क और लैंडमार्क के साथ इमेज एनोटेशन कॉन्फ़िगर करें। instance_display से इमेज दिखाएँ और COCO या YOLO में एक्सपोर्ट करें।
Potato क्लासिफ़िकेशन, ऑब्जेक्ट डिटेक्शन, सेगमेंटेशन और कीपॉइंट कार्यों के लिए इमेज एनोटेशन का समर्थन करता है।
इमेज दिखाना
इमेज दिखाना और एनोटेशन इकट्ठा करना दो अलग सेटिंग हैं। instance_display तय करता है कि एनोटेटर क्या देखता है, और annotation_schemes तय करता है कि वह किस सवाल का जवाब देता है। दोनों को अलग रखने से किसी भी तरह की सामग्री को किसी भी तरह के सवाल के साथ रखा जा सकता है:
instance_display:
fields:
- key: image_url # Field name in your data file
type: image
label: "Image to classify"
display_options:
max_width: 600
zoomable: trueimage_annotation स्कीम इमेज पर ड्रॉ करने के लिए है, इमेज दिखाने के लिए नहीं। क्लासिफ़िकेशन कार्य के लिए ऊपर दिया गया डिस्प्ले फ़ील्ड और एक radio या multiselect स्कीम ही काफ़ी है।
डिस्प्ले विकल्प
| विकल्प | विवरण |
|---|---|
max_width | पिक्सेल में अधिकतम रेंडर की गई चौड़ाई |
max_height | पिक्सेल में अधिकतम रेंडर की गई ऊँचाई |
zoomable | क्लिक करके ज़ूम चालू करता है |
object_fit | इमेज अपने बॉक्स को कैसे भरती है |
alt_text | स्क्रीन रीडर के लिए वैकल्पिक टेक्स्ट |
जिस विकल्प के नाम को Potato नहीं पहचानता, वह चुपचाप अनदेखी की गई कुंजी नहीं बल्कि कॉन्फ़िगरेशन त्रुटि है, और त्रुटि संदेश सबसे नज़दीकी असली विकल्प सुझाता है।
डेटा फ़ॉर्मेट
अपनी डेटा फ़ाइल में इमेज का संदर्भ दें:
{"id": "img_001", "image_url": "https://example.com/photo_001.jpg"}
{"id": "img_002", "image_url": "/static/images/photo_002.png"}data_files पाथ की एक सूची है, और item_properties आपके फ़ील्ड नामों को उन नामों से जोड़ता है जिन्हें Potato पढ़ता है:
data_files:
- "data/image_tasks.json"
item_properties:
id_key: id
text_key: image_url # The field holding the image URLइमेज क्लासिफ़िकेशन
पूरी इमेज को क्लासिफ़ाई करें:
annotation_schemes:
- annotation_type: radio
name: category
description: "What is shown in this image?"
labels:
- Cat
- Dog
- Bird
- Other
- annotation_type: multiselect
name: attributes
description: "Select all that apply"
labels:
- Indoor
- Outdoor
- Multiple animals
- Human presentमल्टी-लेबल क्लासिफ़िकेशन
annotation_schemes:
- annotation_type: multiselect
name: objects
description: "What objects are visible?"
labels:
- Person
- Car
- Building
- Tree
- Animal
- Furniture
- Food
- Electronic deviceइमेज गुणवत्ता का आकलन
annotation_schemes:
- annotation_type: likert
name: quality
description: "Overall image quality"
size: 5
min_label: "Very poor"
max_label: "Excellent"
- annotation_type: multiselect
name: issues
description: "Select any quality issues"
labels:
- Blurry
- Overexposed
- Underexposed
- Noisy
- Low resolution
- Watermark visibleइमेज पर ड्रॉ करना
image_annotation स्कीम में tools और labels दोनों ज़रूरी हैं। हर लेबल को एक रंग और एक key_value देना अतिरिक्त पंक्तियों के लायक है, क्योंकि एनोटेटर क्लिक करने की तुलना में कीबोर्ड से लेबल कहीं तेज़ी से लगाते हैं:
annotation_schemes:
- annotation_type: image_annotation
name: object_detection
description: "Draw boxes around objects"
tools:
- bbox
- polygon
labels:
- name: person
color: "#FF6B6B"
key_value: "1"
- name: vehicle
color: "#4ECDC4"
key_value: "2"
- name: animal
color: "#45B7D1"
key_value: "3"
min_annotations: 1
zoom_enabled: true
pan_enabled: truecolor हेक्स में होना चाहिए (#rgb, #rrggbb या #rrggbbaa)। CSS रंगों के नाम और rgb() नहीं पढ़े जाते। आकृतियाँ सही दिखेंगी, लेकिन मास्क पिक्सेल-दर-पिक्सेल पेंट होते हैं और लाल रंग पर लौट आते हैं।
उपलब्ध टूल
| टूल | विवरण |
|---|---|
bbox | आयताकार बाउंडिंग बॉक्स |
polygon | कई बिंदुओं वाले बंद पॉलीगॉन |
polyline | कई बिंदुओं वाले खुले पाथ, लेन मार्किंग, रक्त वाहिकाओं, दरारों और तटरेखाओं के लिए |
ellipse | दीर्घवृत्त और वृत्त, कोशिकाओं, नाभिकों, पहियों और चेहरों के लिए |
keypoint_set | क्रमबद्ध स्केलेटन, इंसान या जानवर की मुद्रा और चेहरे के लैंडमार्क के लिए |
cuboid_2d | इमेज में प्रक्षेपित 3D बॉक्स, KITTI शैली में |
sam | मैजिक वैंड: किसी ऑब्जेक्ट पर क्लिक करें और एक मॉडल उसे सेगमेंट कर देता है |
freeform | हाथ से मुक्त ड्रॉइंग |
landmark | एकल बिंदु मार्कर |
brush | पिक्सेल-स्तर के मास्क के लिए सेगमेंटेशन ब्रश |
eraser | मास्क के क्षेत्र हटाता है |
fill | बंद क्षेत्रों के लिए फ़्लड फ़िल |
पॉलीगॉन बंद होता है और एक क्षेत्र को घेरता है; पॉलीलाइन खुली होती है, उसकी लंबाई होती है पर कोई भीतरी भाग नहीं। यह अंतर एक्सपोर्ट में मायने रखता है, जहाँ पॉलीलाइन area: 0 के साथ लिखी जाती है और उसे कभी क्षेत्र नहीं माना जाता।
पॉलीगॉन एनोटेशन
गैर-आयताकार क्षेत्रों के लिए:
annotation_schemes:
- annotation_type: image_annotation
name: regions
description: "Outline regions of interest"
tools:
- polygon
labels:
- name: Building
- name: Road
- name: Vegetation
- name: Waterसेगमेंटेशन मास्क
पिक्सेल-स्तर के काम के लिए पेंटिंग टूल चालू करें। मास्क प्रति-पिक्सेल ऐरे के बजाय रन-लेंथ एन्कोडिंग में संग्रहीत होते हैं, और इसी वजह से पूरी इमेज का मास्क छोटा रहता है:
annotation_schemes:
- annotation_type: image_annotation
name: segmentation
description: "Paint regions using the brush tool"
tools:
- brush
- eraser
- fill
labels:
- name: road
color: "#45B7D1"
- name: sidewalk
color: "#96CEB4"
brush_size: 20
mask_opacity: 0.5
mask_mode: semanticmask_mode: semantic किसी क्लास के सभी स्ट्रोक को एक ही क्षेत्र में मिला देता है। जब एक ही क्लास के दो ऑब्जेक्ट अलग-अलग रहने चाहिए, तब instance इस्तेमाल करें।
आउटपुट फ़ॉर्मेट
एनोटेशन एक सपाट JSON ऐरे के रूप में संग्रहीत होते हैं, जिसमें हर आकृति और मास्क एक ही सूची में होता है। निर्देशांक इमेज के सापेक्ष 0 से 1 की सीमा में नॉर्मलाइज़ किए जाते हैं, इसलिए इमेज किसी दूसरे आकार में परोसी जाए तब भी एनोटेशन सही रहते हैं:
[
{
"type": "bbox",
"label": "person",
"color": "#FF6B6B",
"coordinates": {"x": 0.125, "y": 0.104, "width": 0.3125, "height": 0.625}
},
{
"type": "polygon",
"label": "vehicle",
"color": "#4ECDC4",
"coordinates": [
{"x": 0.02, "y": 0.04}, {"x": 0.20, "y": 0.04},
{"x": 0.20, "y": 0.21}, {"x": 0.02, "y": 0.21}
]
},
{
"type": "mask",
"label": "road",
"color": "#45B7D1",
"rle": {"counts": [12, 40, 8], "size": [480, 640]}
}
]ज्यामिति की कुंजी प्रकार के अनुसार बदलती है:
| प्रकार | ज्यामिति कुंजी | संरचना |
|---|---|---|
bbox | coordinates | {x, y, width, height}, नॉर्मलाइज़्ड |
polygon | coordinates | {x, y} की सूची, नॉर्मलाइज़्ड |
landmark | coordinates | {x, y}, नॉर्मलाइज़्ड |
freeform | coordinates | {path, left, top, scaleX, scaleY} |
mask | rle | {counts: [ints], size: [height, width]} |
rle.size इसी क्रम में [height, width] है। Python में इन संरचनाओं से और इनमें बदलने के लिए, फ़ील्ड सीधे पढ़ने के बजाय potato.export.cv_utils से normalize_annotation_object() और to_client_object() इस्तेमाल करें।
आकृति कहाँ से आई
संग्रहीत हो जाने के बाद, मॉडल का स्वीकार किया गया डिटेक्शन और हाथ से बनाया गया बॉक्स बाकी हर तरह से एक जैसे होते हैं, इसलिए हर आकृति अपना स्रोत दर्ज करती है। इसके बिना, मॉडल से प्री-लेबल करने वाला प्रोजेक्ट अपने ही डेटा से अपनी स्वीकृति दर नहीं बता सकता:
{
"type": "bbox",
"label": "person",
"coordinates": {"x": 0.125, "y": 0.104, "width": 0.3125, "height": 0.625},
"source": "ai",
"ai_model": "yolov8n",
"confidence": 0.82,
"edited": true
}| कुंजी | अर्थ |
|---|---|
source | human (ब्राउज़र में बनाई गई), ai (मॉडल ने प्रस्ताव दिया और एनोटेटर ने स्वीकार किया), import (डेटा के साथ आई) |
ai_model | कौन-सा मॉडल, जब एंडपॉइंट उसकी जानकारी देता है |
confidence | इस आकृति के लिए डिटेक्टर का अपना स्कोर |
edited | एनोटेटर ने बाद में ऐसी आकृति को खिसकाया, उसका आकार बदला या उसका लेबल बदला जो उसकी अपनी नहीं थी |
carried_over | इस इमेज पर बनाए जाने के बजाय पिछली इमेज से आगे कॉपी की गई |
edited ही बॉक्स को जैसा है वैसा स्वीकार करने और उसे स्वीकार करके फिर सुधारने में फ़र्क़ करता है। केवल पहला मामला मॉडल से सहमति है।
मौजूदा एनोटेशन की समीक्षा
पहले से मौजूद आकृतियों की समीक्षा के लिए, उन्हें किसी डेटा फ़ील्ड में जोड़ने के बजाय इंपोर्ट करें। potato import एक COCO फ़ाइल को चलाने योग्य प्रोजेक्ट में बदल देता है और हर आकृति पर source: import लगा देता है:
potato import --input instances_val2017.json \
--image-dir /data/val2017 \
--image-url-prefix /files \
--output-dir my-project/ \
--schema-name object_detection
potato start my-project/config.yaml -p 8000इसके बाद एनोटेटर इंपोर्ट की गई आकृतियों को उनकी जगह पर ही सुधारते हैं, और एक्सपोर्ट पूरे चक्र में इंसान और मॉडल का बँटवारा बनाए रखता है।
इमेज तुलना
pairwise स्कीम से दो इमेज की तुलना करें। items_key उस डेटा फ़ील्ड का नाम बताता है जिसमें जोड़ी रखी है:
annotation_schemes:
- annotation_type: pairwise
name: preference
description: "Which image looks better?"
mode: binary
items_key: images
show_labels: true
labels:
- "Original"
- "Edited"
allow_tie: true
tie_label: "About the same"इमेज कैप्शनिंग
annotation_schemes:
- annotation_type: text
name: caption
description: "Write a caption for this image"
rows: 4
placeholder: "Describe what you see..."कैप्शन गुणवत्ता की समीक्षा
इमेज और जनरेट किया गया कैप्शन साथ-साथ दिखाएँ, फिर कैप्शन को रेट करें:
instance_display:
fields:
- key: image_url
type: image
label: "Image"
- key: generated_caption
type: text
label: "Generated caption"
annotation_schemes:
- annotation_type: likert
name: accuracy
description: "How accurate is this caption?"
size: 5
min_label: "Very inaccurate"
max_label: "Very accurate"
- annotation_type: likert
name: fluency
description: "How natural is the language?"
size: 5
min_label: "Very awkward"
max_label: "Very natural"
- annotation_type: text
name: improved_caption
description: "Suggest a better caption (optional)"
rows: 4
label_requirement:
required: falseकंटेंट मॉडरेशन
annotation_schemes:
- annotation_type: radio
name: safe_for_work
description: "Is this image safe for work?"
labels:
- Safe
- Questionable
- Not Safe
- annotation_type: multiselect
name: violation_types
description: "Select all violations (if any)"
labels:
- Violence
- Adult content
- Hate symbols
- Graphic content
- Spam/advertisementइंटरचेंज फ़ॉर्मेट
Potato COCO JSON पढ़ता है, जिसमें हर सेगमेंटेशन एन्कोडिंग और crowd क्षेत्र शामिल हैं, और COCO, YOLO, Pascal VOC तथा प्रति-लेबल मास्क PNG लिखता है:
python -m potato.export -c my-project/config.yaml -f coco -o ./export/YOLO और Pascal VOC में केवल बाउंडिंग बॉक्स होते हैं, इसलिए बाकी आकृतियाँ अपने घेरने वाले बॉक्स में बदल दी जाती हैं।
पूर्ण उदाहरण: ऑब्जेक्ट डिटेक्शन समीक्षा
annotation_task_name: "Object Detection Verification"
task_dir: "."
data_files:
- "data/detections.json"
item_properties:
id_key: id
text_key: image_url
instance_display:
fields:
- key: image_url
type: image
label: "Image"
display_options:
max_width: 1000
zoomable: true
annotation_schemes:
# Correct the boxes
- annotation_type: image_annotation
name: objects
description: "Verify and correct object boxes"
tools:
- bbox
labels:
- name: Person
key_value: "1"
- name: Vehicle
key_value: "2"
- name: Animal
key_value: "3"
- name: Object
key_value: "4"
zoom_enabled: true
pan_enabled: true
# Overall assessment
- annotation_type: radio
name: prediction_quality
description: "How accurate were the predictions?"
labels:
- All correct
- Minor corrections needed
- Major corrections needed
- Mostly incorrect
- annotation_type: number
name: missed_objects
description: "How many objects were missed?"
min: 0
max: 50
- annotation_type: text
name: notes
description: "Any issues or comments?"
rows: 4
label_requirement:
required: false
output_annotation_dir: "output/"
export_annotation_format: jsonl
user_config:
allow_all_users: trueसर्वर शुरू करें:
potato start config.yaml -p 8000प्रदर्शन सुझाव
- एनोटेशन से पहले आकार छोटा करें: बड़ी स्रोत इमेज एनोटेशन को बेहतर बनाए बिना लोडिंग धीमी कर देती हैं
- फ़ोटो के लिए JPEG इस्तेमाल करें: छोटी फ़ाइलें, तेज़ लोडिंग
- ग्राफ़िक्स के लिए PNG इस्तेमाल करें: डायग्राम और स्क्रीनशॉट के लिए बेहतर गुणवत्ता
- रेंडर होने वाले आकार की सीमा तय करें:
max_widthसेट करें ताकि ब्राउज़र को हर इंस्टेंस पर बहुत बड़ी इमेज स्केल न करनी पड़े - एक जैसी प्री-प्रोसेसिंग करें: पूरे डेटासेट में आकार और फ़ॉर्मेट नॉर्मलाइज़ करें