# Images Preprocess करें

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

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 को उसी तरह 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 देखें](https://blog.roboflow.com/exif-auto-orientation/).

### Resize

Resize आपकी images का size बदलता है और, वैकल्पिक रूप से, उन्हें इच्छित 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 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](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 में लगभग uniform distribution होता है, जहाँ pixel colors सभी लगभग समान रूप से represented होते हैं। [और देखें](https://en.wikipedia.org/wiki/Histogram_equalization).
* **Adaptive Equalization**: Contrast Limited Adaptive Histogram Equalization (CLAHE)। स्थानीय contrast enhancement के लिए एक algorithm, जो image के अलग-अलग tile regions पर computed histograms का उपयोग करता है। इसलिए local details image के अधिकांश भाग से अधिक गहरे या हल्के क्षेत्रों में भी enhanced की जा सकती हैं। (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 को detect करने में मदद कर सकता है (विशेष रूप से aerial imagery और microscopy जैसी स्थितियों में। Default setting 2x2 tiling है, हालांकि आप इसे अपनी आवश्यकता के अनुसार adjust कर सकते हैं। Tiling किया जाता है *पहले* preprocessing pipeline में resizing से पहले।

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

### Modify Classes

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

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

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

### 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 लागू करना।](/files/41139a302414ea3a6c915c3627cd7189fe561436)

{% hint style="warning" %}
सुनिश्चित करें कि आपने अपने dataset की ALL images को properly annotate किया है, उपयुक्त images को null annotation के रूप में designated किया है, और/या इस tool का उपयोग करने से पहले किसी भी अनावश्यक 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 में समस्याएँ आएँगी, और training failed भी हो सकती है)। Null annotations केवल तब लागू की जानी चाहिए जब उस image में *कुछ भी* मौजूद न हो जिसे आप अपने model से detect करवाना चाहते हों।
{% endhint %}

### Filter by Tag

Filter by Tag transformation उपयोगकर्ताओं को यह filter करने देती है कि किन images को किसी version में शामिल किया जाना चाहिए या नहीं, इस आधार पर कि कौन से [Tags](https://docs.roboflow.com/datasets/add-tags-to-images) 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 के अधीन।

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-hi/datasets/dataset-versions/image-preprocessing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
