> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/roboflow/roboflow-hi/datasets/dataset-versions/image-preprocessing.md).

# Images को Preprocess करें

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

Preprocessing आपके Train, Valid, और Test set की सभी images पर लागू होता है (इसके विपरीत [Augmentations](/roboflow/roboflow-hi/datasets/dataset-versions/image-augmentation.md), जो केवल 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 को उसी तरीके से प्रदर्शित होते देखें जैसे वे disk पर संग्रहीत हैं।

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

* Roboflow recommend करता है कि इसे default रूप से on ही छोड़ें और जाँचें कि inference में आपकी images आपके model को कैसे fed की जा रही हैं।
* यदि आप यह और जानना चाहते हैं कि आपको अपनी images को auto-orient करना चाहिए या नहीं, [हमारा blog देखें](https://blog.roboflow.com/exif-auto-orientation/).

### Resize

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

वर्तमान में, हम केवल downsizing support करते हैं। हम इसके लिए कुछ guidance प्रदान करते हैं [कि आपके use case के लिए कौन-सा resize option सबसे अच्छा हो सकता है](https://blog.roboflow.com/you-might-be-resizing-your-images-incorrectly/).

* **Stretch to:** अपनी images को पसंदीदा pixel-by-pixel dimension तक stretch करें। Annotations proportionally scale की जाती हैं। Images square होती हैं, distorted होती हैं, लेकिन source image data का कोई हिस्सा खोता नहीं है।
* **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 खो जाता है।
* **Fit within:** Source image के dimensions को output image के dimensions के रूप में scale किया जाता है, जबकि source image का aspect ratio बनाए रखा जाता है। उदाहरण के लिए, यदि source image 2600x2080 है और resize option 640x640 पर set है, तो लंबी dimension (2600) को 640 तक scale किया जाता है और दूसरी dimension (2080) को लगभग 512 pixels तक scale किया जाता है। Image के aspect ratios और original data बने रहते हैं, लेकिन वे square नहीं होतीं।
* **Fit (reflect edges) in:** Source image के dimensions को output image के dimensions के रूप में scale किया जाता है, जबकि source image का aspect ratio बनाए रखा जाता है, और newly created padding source image का प्रतिबिंब (reflection) होती है। उदाहरण के लिए, यदि source image 2600x2080 है और resize option 416x416 पर set है, तो लंबी dimension (2600) को 416 तक scale किया जाता है और दूसरी dimension (2080) को लगभग 335.48 pixels तक scale किया जाता है। शेष pixel area (416-335.48, या 80.52 pixels) source image के reflected pixels होते हैं। उल्लेखनीय रूप से, Roboflow default रूप से annotations को भी reflect करता है। Images square होती हैं, padding के साथ होती हैं, और aspect ratios तथा original data बनाए रहते हैं।
* **Fit (black edges) in:** Source image के dimensions को output image के dimensions के रूप में scale किया जाता है, जबकि source image का aspect ratio बनाए रखा जाता है, और newly created padding काला area होता है। उदाहरण के लिए, यदि source image 2600x2080 है और resize option 416x416 पर set है, तो लंबी dimension (2600) को 416 तक scale किया जाता है और दूसरी dimension (2080) को लगभग 335.48 pixels तक scale किया जाता है। शेष pixel area (416-335.48, या 80.52 pixels) काले pixels होते हैं। Images square होती हैं, black padding के साथ होती हैं, और aspect ratios तथा original data बनाए रहते हैं।
* **Fit (white edges) in:** Source image के dimensions को output image के dimensions के रूप में scale किया जाता है, जबकि source image का aspect ratio बनाए रखा जाता है, और newly created padding सफेद area होता है। उदाहरण के लिए, यदि source image 2600x2080 है और resize option 416x416 पर set है, तो लंबी dimension (2600) को 416 तक scale किया जाता है और दूसरी dimension (2080) को लगभग 335.48 pixels तक scale किया जाता है। शेष pixel area (416-335.48, या 80.52 pixels) सफेद pixels होते हैं। Images square होती हैं, white padding के साथ होती हैं, और aspect ratios तथा original data बनाए रहते हैं।

### Grayscale

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

इन weights का उपयोग CRT phosphors द्वारा किया जाता है क्योंकि वे red, green और blue की human perception को समान weights की तुलना में बेहतर दर्शाते हैं। (Via [Scikit-Image](https://scikit-image.org/docs/dev/auto_examples/color_exposure/plot_rgb_to_gray.html).)

### Auto-Adjust Contrast

कम contrast वाली image को enhance करता है। हमने यह explore किया है [कि आप contrast को preprocessing step के रूप में उपयोग करना चाहते हैं या नहीं](https://blog.roboflow.com/when-to-use-contrast-as-a-preprocessing-step/).

* **Contrast Stretching**: image को इस तरह rescale किया जाता है कि 2nd और 98th percentiles के भीतर आने वाली सभी intensities शामिल हों। [और देखें](http://homepages.inf.ed.ac.uk/rbf/HIPR2/stretch.htm).
* **Histogram Equalization**: image में “सबसे अधिक बार आने वाले intensity values” को फैलाता है। equalized image का distribution लगभग uniform होता है, जहाँ pixels के सभी colors लगभग समान रूप से represented होते हैं। [और देखें](https://en.wikipedia.org/wiki/Histogram_equalization).
* **Adaptive Equalization**: Contrast Limited Adaptive Histogram Equalization (CLAHE)। local contrast enhancement के लिए एक algorithm, जो image के अलग-अलग tile regions पर compute किए गए histograms का उपयोग करता है। इसलिए local details को उन regions में भी enhance किया जा सकता है जो image के अधिकांश हिस्से से अधिक dark या light हों। (Via [Scikit-Image](https://scikit-image.org/docs/dev/api/skimage.exposure.html#skimage.exposure.equalize_adapthist).)

## 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।](/files/7b21e2dda9af0ba5266cd04c7376f2afc51197e1)

### Tile

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

![tiling tool और output का एक preview ("grid" में दर्शाया गया)।](/files/d53384ba1e200553d21c55916373b0347eb731c1)

### Modify Classes

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

!["Apple leaf" class को omit करना।](/files/060511f89ff5765107b77951a4a2c07d86b80a55)

!["scratches" class को "scratch" में remap करना।](/files/382f019d90863915b3b7395144e39bd6a893fa96)

### Filter Null

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

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

![Filter Null preprocessing step लागू करना।](/files/41139a302414ea3a6c915c3627cd7189fe561436)

{% hint style="warning" %}
इस tool का उपयोग करने से पहले सुनिश्चित करें कि आपने अपने dataset की ALL images को properly annotate किया है, उपयुक्त images को null annotation के रूप में designated किया है, और/या किसी भी unnecessary classes को omit किया है।
{% endhint %}

{% hint style="info" %}
[Missing और Null Annotations के बीच का अंतर](https://blog.roboflow.com/missing-and-null-image-annotations/)

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

### Filter by Tag

Filter by Tag transformation users को यह filter करने देती है कि किन images को किसी version में शामिल किया जाना चाहिए या नहीं, इस आधार पर कि कौन-से [Tags](https://docs.roboflow.com/datasets/add-tags-to-images) applied हैं। यह transformation नए data subset पर model train करने या unwanted images को training से exclude करने के लिए उपयोगी है।

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

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

<figure><img src="/files/810aec1544243c0c40184d8916286d9a2453e389" alt=""><figcaption><p>इस example में, परिणामी Version में केवल वे images होंगी जिनमें <code>do-not-include</code> tag।</p></figcaption></figure>
