Images preprocess करें

models के लिए data तैयार करने के लिए image preprocessing steps।

Preprocessing यह सुनिश्चित करता है कि आपका dataset एक मानक format में हो (जैसे, सभी images एक ही size की हों)। यह step model को train करने से पहले आपके dataset को consistent सुनिश्चित करने के लिए आवश्यक है।

Preprocessing आपके Train, Valid, और Test set की सभी images पर लागू होती है (इसके विपरीत Augmentations , जो केवल Train set पर लागू होती हैं)।

Roboflow platform निम्नलिखित preprocessing options प्रदान करता है:

  • Auto-Orient

  • Resize

  • Grayscale

  • Auto-Adjust Contrast

  • Isolate Objects

  • Static Crop

  • Tile

  • Modify Classes

  • Filter Null

  • Filter by Tag

प्रत्येक option का विवरण नीचे दिया गया है।

Auto-Orient

Auto-orient आपकी images से उनका EXIF data हटा देता है ताकि आप images को उसी तरह displayed देखें जैसे वे disk पर stored हैं।

EXIF data किसी image की orientation निर्धारित करता है। Applications (जैसे Mac पर Preview) इस data का उपयोग image को एक विशिष्ट orientation में display करने के लिए करती हैं, भले ही disk पर उसके storage की orientation अलग हो।

  • Roboflow सलाह देता है कि इसे default रूप से on ही रहने दें और देखें कि inference में आपकी images आपके model को कैसे feed की जा रही हैं।

  • यदि आप यह अधिक जानना चाहते हैं कि आपको अपनी images को auto-orient करना चाहिए या नहीं, हमारा blog देखें.

Resize

Resize आपकी images का size बदलता है और, वैकल्पिक रूप से, उन्हें इच्छित dimensions के set में scale करता है। Annotations को proportionally adjust किया जाता है (नीचे दिए गए “fill” के मामले को छोड़कर)।

वर्तमान में, हम केवल downsizing support करते हैं। हम इसके लिए कुछ guidance प्रदान करते हैं कि आपके use case के लिए कौन-सा resize option सबसे अच्छा हो सकता है.

  • Stretch to: अपनी images को पसंदीदा pixel-by-pixel dimension तक stretch करें। Annotations proportionally scale होती हैं। Images square होती हैं, distorted होती हैं, लेकिन source image data lost नहीं होता।

  • Fill (with center crop) in: Generated image आपकी desired output dimensions का centered crop होती है। उदाहरण के लिए, यदि source image 2600x2080 है और resize option 640x640 पर set है, तो output resize source image का central 640x640 होगा। Aspect ratio बना रहता है, लेकिन source image data lost होता है।

  • Fit within: Source dimension के dimensions को source image aspect ratio बनाए रखते हुए output image के dimensions के रूप में scale किया जाता है। उदाहरण के लिए, यदि source image 2600x2080 है और resize option 640x640 पर set है, तो longer dimension (2600) को 640 तक scale किया जाता है और secondary dimension (2080) को लगभग 512 pixels तक scale किया जाता है। Image aspect ratios और original data बने रहते हैं, लेकिन वे square नहीं होते।

  • Fit (reflect edges) in: Source dimension के dimensions को source image aspect ratio बनाए रखते हुए output image के dimensions के रूप में scale किया जाता है, और newly created padding source image का reflection होती है। उदाहरण के लिए, यदि source image 2600x2080 है और resize option 416x416 पर set है, तो longer dimension (2600) को 416 तक scale किया जाता है और secondary dimension (2080) को लगभग 335.48 pixels तक scale किया जाता है। शेष pixel area (416-335.48, या 80.52 pixels) source image के reflected pixels होते हैं। विशेष रूप से, Roboflow default रूप से annotations को भी reflect करता है। Images square होती हैं, padded होती हैं, और aspect ratios plus original data बनाए रहते हैं।

  • Fit (black edges) in: Source dimension के dimensions को source image aspect ratio बनाए रखते हुए output image के dimensions के रूप में scale किया जाता है, और newly created padding black area होती है। उदाहरण के लिए, यदि source image 2600x2080 है और resize option 416x416 पर set है, तो longer dimension (2600) को 416 तक scale किया जाता है और secondary dimension (2080) को लगभग 335.48 pixels तक scale किया जाता है। शेष pixel area (416-335.48, या 80.52 pixels) black pixels होते हैं। Images square होती हैं, black padded होती हैं, और aspect ratios plus original data बनाए रहते हैं।

  • Fit (white edges) in: Source dimension के dimensions को source image aspect ratio बनाए रखते हुए output image के dimensions के रूप में scale किया जाता है, और newly created padding white area होती है। उदाहरण के लिए, यदि source image 2600x2080 है और resize option 416x416 पर set है, तो longer dimension (2600) को 416 तक scale किया जाता है और secondary dimension (2080) को लगभग 335.48 pixels तक scale किया जाता है। शेष pixel area (416-335.48, या 80.52 pixels) white pixels होते हैं। Images square होती हैं, white padded होती हैं, और aspect ratios plus original data बनाए रहते हैं।

Grayscale

RGB channels वाली image को एक single grayscale channel वाली image में बदलता है, जिससे आपकी memory बच सकती है। प्रत्येक grayscale pixel का value संबंधित red, green और blue pixels के weighted sum के रूप में calculate किया जाता है: Y = 0.2125 R + 0.7154 G + 0.0721 B.

इन weights का उपयोग CRT phosphors द्वारा किया जाता है क्योंकि वे equal weights की तुलना में red, green और blue की human perception को बेहतर दर्शाते हैं। (Via Scikit-Image.)

Auto-Adjust Contrast

कम contrast वाली image को enhance करता है। हमने यह explore किया है कि क्या आप contrast को preprocessing step के रूप में उपयोग करना चाहते हैं.

  • Contrast Stretching: image को rescale किया जाता है ताकि 2nd और 98th percentiles के भीतर आने वाली सभी intensities शामिल हों। और देखें.

  • Histogram Equalization: image में “सबसे अधिक बार आने वाले intensity values” को फैला देता है। Equalized image में लगभग uniform distribution होता है, जहाँ pixel colors सभी लगभग समान रूप से represented होते हैं। और देखें.

  • Adaptive Equalization: Contrast Limited Adaptive Histogram Equalization (CLAHE)। स्थानीय contrast enhancement के लिए एक algorithm, जो image के अलग-अलग tile regions पर computed histograms का उपयोग करता है। इसलिए local details image के अधिकांश भाग से अधिक गहरे या हल्के क्षेत्रों में भी enhanced की जा सकती हैं। (Via Scikit-Image.)

Advanced Preprocessing Features

Isolate Objects

Isolate Objects transform प्रत्येक bounding box को crop करके एक individual image में extract करेगा। यह step Object Detection datasets को Classification datasets में बदलता है।

उन मामलों में जहाँ dataset में कई classes समान हों, क्रम में दो models का उपयोग करना आम बात है। पहला model (object detection) object को ढूँढता है और दूसरा model (classification) यह पहचानता है कि object क्या है। Isolate Objects transformation दूसरे model को train करने के लिए आवश्यक dataset बनाने में उपयोगी है।

Static Crop

static crop feature, और एक example output।

Tile

Tiling छोटे objects को detect करने में मदद कर सकता है (विशेष रूप से aerial imagery और microscopy जैसी स्थितियों में। Default setting 2x2 tiling है, हालांकि आप इसे अपनी आवश्यकता के अनुसार adjust कर सकते हैं। Tiling किया जाता है पहले preprocessing pipeline में resizing से पहले।

tiling tool और output का एक preview ("grid" में दर्शाया गया)।

Modify Classes

एक preprocessing tool जिसका उपयोग नई dataset version generate करते समय specific classes को omit करने या classes को remap (rename) करने के लिए किया जाता है। ये changes केवल आपके द्वारा generate की गई version पर लागू होती हैं। आपके underlying dataset में कोई changes नहीं किए जाएँगे।

"Apple leaf" class को omit करना।
"scratches" class को "scratch" में remap करना।

Filter Null

Filter Null transformation उपयोगकर्ताओं को dataset में images के एक हिस्से को annotated होने की आवश्यकता निर्धारित करने देती है। Images जिन्हें null annotation के रूप में marked किया गया है, या Modify Classes tool लागू करने के बाद "unannotated" हैं, Filter Null का उपयोग करते समय केवल वही प्रभावित होती हैं।

यह transformation उस स्थिति में उपयोगी है जहाँ dataset का एक बड़ा हिस्सा इच्छित objects को शामिल नहीं करता।

Filter Null preprocessing step लागू करना।

Missing और Null Annotations के बीच अंतर

"Missing Annotations" तब होती हैं जब images annotated नहीं होतीं (images को unannotated छोड़ने से आपके trained dataset के performance में समस्याएँ आएँगी, और training failed भी हो सकती है)। Null annotations केवल तब लागू की जानी चाहिए जब उस image में कुछ भी मौजूद न हो जिसे आप अपने model से detect करवाना चाहते हों।

Filter by Tag

Filter by Tag transformation उपयोगकर्ताओं को यह filter करने देती है कि किन images को किसी version में शामिल किया जाना चाहिए या नहीं, इस आधार पर कि कौन से Tags applied हैं। यह transformation नए data subset पर model train करने या training से unwanted images को exclude करने के लिए उपयोगी है।

प्रत्येक Tag के लिए तीन options उपलब्ध हैं:

  • Require: केवल Required tags वाली images ही version में शामिल की जाएँगी।

  • Exclude: Excluded tags वाली images version में शामिल नहीं की जाएँगी।

  • Allow: Allowed tags वाली images version में शामिल की जाएँगी, Exclude और Require rules के अधीन।

इस उदाहरण में, resulting Version में केवल वे images होंगी जिनमें do-not-include tag नहीं है।

अंतिम अपडेट

क्या यह उपयोगी था?