> 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/deploy/serverless/instance-segmentation/semantic-segmentation.md).

# Semantic Segmentation

{% tabs %}
{% tab title="cURL" %}
**Linux या MacOS**

नामक स्थानीय फ़ाइल के लिए JSON predictions प्राप्त करना `YOUR_IMAGE.jpg`:

```bash
base64 YOUR_IMAGE.jpg | curl -d @- \\
"https://segment.roboflow.com/your-model/42?api_key=YOUR_KEY"
```

उसके URL के माध्यम से वेब पर कहीं और होस्ट की गई image पर inference करना (यह न भूलें कि [इसे URL encode करें](https://www.urlencoder.org/)):

```bash
curl -X POST "https://segment.roboflow.com/your-model/42?\
api_key=YOUR_KEY&\
image=https%3A%2F%2Fi.imgur.com%2FPEEvqPN.png"
```

**Windows**

आपको इंस्टॉल करना होगा [Windows के लिए curl](https://curl.se/windows/) और [Windows के लिए GNU का base64 tool](http://gnuwin32.sourceforge.net/packages/coreutils.htm). ऐसा करने का सबसे आसान तरीका है उपयोग करना [Windows के लिए git installer](https://git-scm.com/downloads) जिसमें यह भी शामिल है `curl` और `base64` command line tools, जब आप installation के दौरान "Use Git and optional Unix tools from the Command Prompt" चुनते हैं।

फिर आप ऊपर दिए गए समान commands का उपयोग कर सकते हैं।
{% endtab %}

{% tab title="Python" %}
**स्थानीय और होस्ट की गई images पर inference करें**

dependencies इंस्टॉल करने के लिए, `pip install roboflow`.

```python
from roboflow import Roboflow

rf = Roboflow(api_key="")

project = rf.workspace().project("PROJECT_ID")

model = project.version(VERSION).models()[0]

prediction = model.predict("YOUR_IMAGE.jpg")
```

{% endtab %}

{% tab title="JavaScript" %}
**Node.js**

हम उपयोग कर रहे हैं [axios](https://github.com/axios/axios) इस उदाहरण में POST request करने के लिए, इसलिए पहले चलाएँ `npm install axios` ताकि dependency इंस्टॉल हो जाए।

**स्थानीय image पर inference करना**

```javascript
const axios = require("axios");
const fs = require("fs");

const image = fs.readFileSync("YOUR_IMAGE.jpg", {
    encoding: "base64"
});

axios({
    method: "POST",
    url: "https://segment.roboflow.com/your-model/42",
    params: {
        api_key: "YOUR_KEY"
    },
    data: image,
    headers: {
        "Content-Type": "application/x-www-form-urlencoded"
    }
})
.then(function(response) {
    console.log(response.data);
})
.catch(function(error) {
    console.log(error.message);
});
```

**URL के माध्यम से कहीं और होस्ट की गई image पर inference करना**

```javascript
const axios = require("axios");

axios({
    method: "POST",
    url: "https://segment.roboflow.com/your-model/42",
    params: {
        api_key: "YOUR_KEY",
        image: "https://i.imgur.com/PEEvqPN.png"
    }
})
.then(function(response) {
    console.log(response.data);
})
.catch(function(error) {
    console.log(error.message);
});
```

**Web**

हमारे पास real-time on-device inference उपलब्ध है, इसके माध्यम से `roboflow.js`; देखें [दस्तावेज़ यहाँ](/roboflow/roboflow-hi/deploy/sdks/web-browser.md).
{% endtab %}

{% tab title="Swift/iOS" %}
**Swift**

**स्थानीय image पर inference करना**

```swift
import UIKit

// Image लोड करें और Base64 में परिवर्तित करें
let image = UIImage(named: "your-image-path") // अपलोड करने के लिए image का path, उदाहरण: image.jpg
let imageData = image?.jpegData(compressionQuality: 1)
let fileContent = imageData?.base64EncodedString()
let postData = fileContent!.data(using: .utf8)

// API_KEY, Model, और Model Version के साथ Inference Server request प्रारंभ करें
var request = URLRequest(url: URL(string: "https://segment.roboflow.com/your-model/your-model-version?api_key=YOUR_APIKEY&name=YOUR_IMAGE.jpg")!,timeoutInterval: Double.infinity)
request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData

// Post Request निष्पादित करें
URLSession.shared.dataTask(with: request, completionHandler: { data, response, error in
    
    // Response को String में पार्स करें
    guard let data = data else {
        print(String(describing: error))
        return
    }
    
    // Response String को Dictionary में परिवर्तित करें
    do {
        let dict = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]
    } catch {
        print(error.localizedDescription)
    }
    
    // String response प्रिंट करें
    print(String(data: data, encoding: .utf8)!)
}).resume()
```

**Objective C**

[Objective-C snippet का अनुरोध करने के लिए यहाँ क्लिक करें।](https://app.roboflow.com/request/snippet.inference-objc)
{% endtab %}

{% tab title="Android" %}
**Kotlin**

**स्थानीय image पर inference करना**

```kotlin
import java.io.*
import java.net.HttpURLConnection
import java.net.URL
import java.nio.charset.StandardCharsets
import java.util.*

fun main() {
    // Image path प्राप्त करें
    val filePath = System.getProperty("user.dir") + System.getProperty("file.separator") + "YOUR_IMAGE.jpg"
    val file = File(filePath)

    // Base 64 Encode करें
    val encodedFile: String
    val fileInputStreamReader = FileInputStream(file)
    val bytes = ByteArray(file.length().toInt())
    fileInputStreamReader.read(bytes)
    encodedFile = String(Base64.getEncoder().encode(bytes), StandardCharsets.US_ASCII)
    val API_KEY = "" // आपकी API Key
    val MODEL_ENDPOINT = "dataset/v" // model endpoint सेट करें (Dataset URL में मिलता है)

    // URL बनाएँ
    val uploadURL ="https://segment.roboflow.com/" + MODEL_ENDPOINT + "?api_key=" + API_KEY + "&name=YOUR_IMAGE.jpg";

    // Http Request
    var connection: HttpURLConnection? = null
    try {
        // URL के लिए connection कॉन्फ़िगर करें
        val url = URL(uploadURL)
        connection = url.openConnection() as HttpURLConnection
        connection.requestMethod = "POST"
        connection.setRequestProperty("Content-Type",
                "application/x-www-form-urlencoded")
        connection.setRequestProperty("Content-Length",
                Integer.toString(encodedFile.toByteArray().size))
        connection.setRequestProperty("Content-Language", "en-US")
        connection.useCaches = false
        connection.doOutput = true

        // अनुरोध भेजें
        val wr = DataOutputStream(
                connection.outputStream)
        wr.writeBytes(encodedFile)
        wr.close()

        // Response प्राप्त करें
        val stream = connection.inputStream
        val reader = BufferedReader(InputStreamReader(stream))
        var line: String?
        while (reader.readLine().also { line = it } != null) {
            println(line)
        }
        reader.close()
    } catch (e: Exception) {
        e.printStackTrace()
    } finally {
        connection?.disconnect()
    }
}
main()
```

**URL के माध्यम से कहीं और होस्ट की गई image पर inference करना**

```kotlin
import java.io.BufferedReader
import java.io.DataOutputStream
import java.io.InputStreamReader
import java.net.HttpURLConnection
import java.net.URL
import java.net.URLEncoder

fun main() {
    val imageURL = "https://i.imgur.com/PEEvqPN.png" // Image URL बदलें
    val API_KEY = "" // आपकी API Key
    val MODEL_ENDPOINT = "dataset/v" // model endpoint सेट करें

    // Upload URL
    val uploadURL = "https://segment.roboflow.com/" + MODEL_ENDPOINT + "?api_key=" + API_KEY + "&image=" + URLEncoder.encode(imageURL, "utf-8");

    // Http Request
    var connection: HttpURLConnection? = null
    try {
        // URL के लिए connection कॉन्फ़िगर करें
        val url = URL(uploadURL)
        connection = url.openConnection() as HttpURLConnection
        connection.requestMethod = "POST"
        connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded")
        connection.setRequestProperty("Content-Length", Integer.toString(uploadURL.toByteArray().size))
        connection.setRequestProperty("Content-Language", "en-US")
        connection.useCaches = false
        connection.doOutput = true

        // अनुरोध भेजें
        val wr = DataOutputStream(connection.outputStream)
        wr.writeBytes(uploadURL)
        wr.close()

        // Response प्राप्त करें
        val stream = URL(uploadURL).openStream()
        val reader = BufferedReader(InputStreamReader(stream))
        var line: String?
        while (reader.readLine().also { line = it } != null) {
            println(line)
        }
        reader.close()
    } catch (e: Exception) {
        e.printStackTrace()
    } finally {
        connection?.disconnect()
    }
}

main()
```

**Java**

**स्थानीय image पर inference करना**

```java
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class InferenceLocal {
    public static void main(String[] args) throws IOException {
        // Image path प्राप्त करें
        String filePath = System.getProperty("user.dir") + System.getProperty("file.separator") + "YOUR_IMAGE.jpg";
        File file = new File(filePath);

        // Base 64 Encode करें
        String encodedFile;
        FileInputStream fileInputStreamReader = new FileInputStream(file);
        byte[] bytes = new byte[(int) file.length()];
        fileInputStreamReader.read(bytes);
        encodedFile = new String(Base64.getEncoder().encode(bytes), StandardCharsets.US_ASCII);

        String API_KEY = ""; // आपकी API Key
        String MODEL_ENDPOINT = "dataset/v"; // model endpoint

        // URL बनाएँ
        String uploadURL = "https://segment.roboflow.com/" + MODEL_ENDPOINT + "?api_key=" + API_KEY
                + "&name=YOUR_IMAGE.jpg";

        // Http Request
        HttpURLConnection connection = null;
        try {
            // URL के लिए connection कॉन्फ़िगर करें
            URL url = new URL(uploadURL);
            connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

            connection.setRequestProperty("Content-Length", Integer.toString(encodedFile.getBytes().length));
            connection.setRequestProperty("Content-Language", "en-US");
            connection.setUseCaches(false);
            connection.setDoOutput(true);

            // अनुरोध भेजें
            DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
            wr.writeBytes(encodedFile);
            wr.close();

            // Response प्राप्त करें
            InputStream stream = connection.getInputStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
            String line;
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
            }
            reader.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }

    }

}
```

**URL के माध्यम से कहीं और होस्ट की गई image पर inference करना**

```java
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class InferenceHosted {
    public static void main(String[] args) {
        String imageURL = "https://i.imgur.com/PEEvqPN.png"; // Image URL बदलें
        String API_KEY = ""; // आपकी API Key
        String MODEL_ENDPOINT = "dataset/v"; // model endpoint

        // Upload URL
        String uploadURL = "https://segment.roboflow.com/" + MODEL_ENDPOINT + "?api_key=" + API_KEY + "&image="
                + URLEncoder.encode(imageURL, StandardCharsets.UTF_8);

        // Http Request
        HttpURLConnection connection = null;
        try {
            // URL के लिए connection कॉन्फ़िगर करें
            URL url = new URL(uploadURL);
            connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

            connection.setRequestProperty("Content-Length", Integer.toString(uploadURL.getBytes().length));
            connection.setRequestProperty("Content-Language", "en-US");
            connection.setUseCaches(false);
            connection.setDoOutput(true);

            // अनुरोध भेजें
            DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
            wr.writeBytes(uploadURL);
            wr.close();

            // Response प्राप्त करें
            InputStream stream = new URL(uploadURL).openStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
            String line;
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
            }
            reader.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }
    }
}
```

{% endtab %}

{% tab title="Ruby" %}
**Gemfile**

{% code title="Gemfile" %}

```ruby
source "https://rubygems.org"

gem "httparty", "~> 0.18.1"
gem "base64", "~> 0.1.0"
gem "cgi", "~> 0.2.1"
```

{% endcode %}

**Gemfile.lock**

{% code title="Gemfile.lock" %}

```ruby
GEM
  remote: https://rubygems.org/
  specs:
    base64 (0.1.0)
    cgi (0.2.1)
    httparty (0.18.1)
      mime-types (~> 3.0)
      multi_xml (>= 0.5.2)
    mime-types (3.3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2021.0225)
    multi_xml (0.6.0)

प्लेटफ़ॉर्म
  x64-mingw32
  x86_64-linux

निर्भरताएँ
  base64 (~> 0.1.0)
  cgi (~> 0.2.1)
  httparty (~> 0.18.1)

साथ बंडल किया गया
   2.2.15
```

{% endcode %}

**स्थानीय image पर inference करना**

```ruby
require 'base64'
require 'httparty'

encoded = Base64.encode64(File.open("YOUR_IMAGE.jpg", "rb").read)
model_endpoint = "dataset/v" # model endpoint सेट करें
api_key = "" # आपकी API KEY यहाँ

params = "?api_key=" + api_key
+ "&name=YOUR_IMAGE.jpg"

response = HTTParty.post(
    "https://segment.roboflow.com/" + model_endpoint + params,
    body: encoded, 
    headers: {
    'Content-Type' => 'application/x-www-form-urlencoded',
    'charset' => 'utf-8'
  })

  puts response

 
```

**URL के माध्यम से कहीं और होस्ट की गई image पर inference करना**

```ruby
require 'httparty'
require 'cgi'

model_endpoint = "dataset/v" # model endpoint सेट करें
api_key = "" # आपकी API KEY यहाँ
img_url = "https://i.imgur.com/PEEvqPN.png" # URL बनाएं

img_url = CGI::escape(img_url)

params =  "?api_key=" + api_key + "&image=" + img_url

response = HTTParty.post(
    "https://segment.roboflow.com/" + model_endpoint + params,
    headers: {
    'Content-Type' => 'application/x-www-form-urlencoded',
    'charset' => 'utf-8'
  })

puts response
```

{% endtab %}

{% tab title="PHP" %}
**स्थानीय image पर inference करना**

```php
<?php

// Image को Base64 में Encode करें
$data = base64_encode(file_get_contents("YOUR_IMAGE.jpg"));

$api_key = ""; // API Key सेट करें
$model_endpoint = "dataset/v"; // model endpoint सेट करें (Dataset URL में मिलता है)

// Http Request के लिए URL
$url = "https://segment.roboflow.com/" . $model_endpoint
. "?api_key=" . $api_key
. "&name=YOUR_IMAGE.jpg";

// Http request सेटअप करें और भेजें
$options = array(
  'http' => array (
    'header' => "Content-type: application/x-www-form-urlencoded\r\n",
    'method'  => 'POST',
    'content' => $data
  ));

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
?>
```

**URL के माध्यम से कहीं और होस्ट की गई image पर inference करना**

```php
<?php

$api_key = ""; // API Key सेट करें
$model_endpoint = "dataset/v"; // model endpoint सेट करें (Dataset URL में मिलता है)
$img_url = "https://i.imgur.com/PEEvqPN.png";

// Http Request के लिए URL
$url =  "https://segment.roboflow.com/" . $model_endpoint
. "?api_key=" . $api_key
. "&image=" . urlencode($img_url);

// Http request सेटअप करें और भेजें
$options = array(
  'http' => array (
    'header' => "Content-type: application/x-www-form-urlencoded\r\n",
    'method'  => 'POST'
  ));

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
?>
```

{% endtab %}

{% tab title="Go" %}
**स्थानीय image पर inference करना**

```go
package main

import (
    "bufio"
    "encoding/base64"
    "fmt"
    "io/ioutil"
    "os"
	"net/http"
	"strings"
)

func main() {
	api_key := ""  // आपकी API Key
	model_endpoint := "dataset/v" // model endpoint सेट करें

    // डिस्क पर फ़ाइल खोलें।
    f, _ := os.Open("YOUR_IMAGE.jpg")

    // पूरे JPG को byte slice में पढ़ें।
    reader := bufio.NewReader(f)
    content, _ := ioutil.ReadAll(reader)

    // Base64 में encode करें।
    data := base64.StdEncoding.EncodeToString(content)
	uploadURL := "https://segment.roboflow.com/" + model_endpoint + "?api_key=" + api_key + "&name=YOUR_IMAGE.jpg"

	req, _ := http.NewRequest("POST", uploadURL, strings.NewReader(data))
    req.Header.Set("Accept", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

   	bytes, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(bytes))

}
```

**URL के माध्यम से कहीं और होस्ट की गई image पर inference करना**

```go
package main

import (
    "fmt"
	"net/http"
	"net/url"
  "io/ioutil"
)

func main() {
	api_key := ""  // आपकी API Key
	model_endpoint := "dataset/v" // model endpoint सेट करें
	img_url := "https://i.ibb.co/jzr27x0/YOUR-IMAGE.jpg"


	uploadURL := "https://segment.roboflow.com/" + model_endpoint + "?api_key=" + api_key + "&image=" + url.QueryEscape(img_url)

	req, _ := http.NewRequest("POST", uploadURL, nil)
    req.Header.Set("Accept", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

   	bytes, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(bytes))


}
```

{% endtab %}

{% tab title=".NET" %}
**स्थानीय image पर inference करना**

```csharp
using System;
using System.IO;
using System.Net;
using System.Text;

namespace InferenceLocal
{
    class InferenceLocal
    {

        static void Main(string[] args)
        {
            byte[] imageArray = System.IO.File.ReadAllBytes(@"YOUR_IMAGE.jpg");
            string encoded = Convert.ToBase64String(imageArray);
            byte[] data = Encoding.ASCII.GetBytes(encoded);
            string API_KEY = ""; // आपकी API Key
            string MODEL_ENDPOINT = "dataset/v"; // मॉडल endpoint सेट करें

            // URL बनाएँ
            string uploadURL =
                    "https://segment.roboflow.com/" + MODEL_ENDPOINT + "?api_key=" + API_KEY
                + "&name=YOUR_IMAGE.jpg";

            // सर्विस request कॉन्फ़िग
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            // request कॉन्फ़िगर करें
            WebRequest request = WebRequest.Create(uploadURL);
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = data.Length;

            // डेटा लिखें
            using (Stream stream = request.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
            }

            // Response प्राप्त करें
            string responseContent = null;
            using (WebResponse response = request.GetResponse())
            {
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader sr99 = new StreamReader(stream))
                    {
                        responseContent = sr99.ReadToEnd();
                    }
                }
            }

            Console.WriteLine(responseContent);

        }
    }
}
```

**URL के माध्यम से कहीं और होस्ट की गई image पर inference करना**

```csharp
using System;
using System.IO;
using System.Net;
using System.Web;

namespace InferenceHosted
{
    class InferenceHosted
    {
        static void Main(string[] args)
        {
            string API_KEY = ""; // आपकी API Key
            string imageURL = "https://i.ibb.co/jzr27x0/YOUR-IMAGE.jpg";
            string MODEL_ENDPOINT = "dataset/v"; // मॉडल endpoint सेट करें

            // URL बनाएँ
            string uploadURL =
                    "https://segment.roboflow.com/" + MODEL_ENDPOINT
                    + "?api_key=" + API_KEY
                    + "&image=" + HttpUtility.UrlEncode(imageURL);

            // सर्विस पॉइंट कॉन्फ़िग
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            // Http Request कॉन्फ़िगर करें
            WebRequest request = WebRequest.Create(uploadURL);
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = 0;

            // Response प्राप्त करें
            string responseContent = null;
            using (WebResponse response = request.GetResponse())
            {
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader sr99 = new StreamReader(stream))
                    {
                        responseContent = sr99.ReadToEnd();
                    }
                }
            }

            Console.WriteLine(responseContent);

        }
    }
}
```

{% endtab %}

{% tab title="एलिक्सिर" %}
हम उपयोगकर्ताओं द्वारा अनुरोध किए जाने पर code snippets जोड़ रहे हैं. यदि आप अपने एलिक्सिर ऐप में inference API को integrate करना चाहते हैं, तो कृपया [अपना upvote दर्ज करने के लिए यहाँ क्लिक करें](https://app.roboflow.com/request/snippet.upload-elixir).
{% endtab %}
{% endtabs %}

### Response Object प्रारूप

Hosted API inference route एक लौटाता है `JSON` predictions की एक array वाला एक object. प्रत्येक prediction में निम्न properties होती हैं:

* `segmentation_mask` = base64-encoded single-channel image, जिसकी dimensions input image के बराबर होती हैं, जहाँ प्रत्येक pixel value एक class ID के अनुरूप होती है
* `class_map` = class IDs को class names से map करने वाला object
* `image` = input image dimensions वाला एक object
  * height = input image की height, pixels में
  * width = input image की width, pixels में

```json
// एक उदाहरण JSON object
{
    "segmentation_mask": "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAAAAADRE4smAAAIqElEQVR4nO3dyXbb2BJFQfCt+v9f5htYstWwQXNB3pMZMaiaeMkAcjMBSpa0LAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACRLu8+gJf4cZbX9xzFlBoEcPMUNfChfgB3z1ADy1I/gEfnp4ClegDPzk4CpQNYc27tE/jfuw/gPKvarvwCWKXuBVh9Zr2XQNkNsL7suq+BNYqe/bbT6rwDam6AjVkXfRWsUjKAzQNtXEDJALbrW0DFAPZMs20BBQNoO8td6gWwc/5dsykXwO5BNi2gXAD79SxAAP+0LKBaAC2HeESxAMx/q1oBHJx/x3xqBXBUwwJKBXB8fv0KKBUA21UKYMTLt90KqBQAOxQKoN2Ld4g6AQyaf7eM6gTALgL4qdkKKBPAuLn1KqBMAOwjgOaqBDByb7e6B1QJgJ0E0F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E5Qev71Aphj985xFGuUC2CKaz/DMaxUL4DhVz9omjsUDOD9kpKpGMC96/+quSTNv2QAdyYQNZeXKRnATS+bf1ZoNQO4MYOssbxOzQDGjnvbDxcOK61oAL+Gdmgsu78POUDVAMaKG+t6ZQN4z8zySqn7lY5vZ/aa3wOcN/7CG2D0NFZ8uMT5F94Ay+gfEfrsUkXOv3YAn6c3aDSPr1Xm/KsHMNj9qxU6/srPAGe4O+bY+dsAW926YLnjF8AOPy9Z8vgFsNffn0H/1qMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACARv4PAgMMHbaPKVQAAAAASUVORK5CYII=",
    "class_map": {
        "0": " पृष्ठभूमि",
        "1": " वस्तु"
    },
    "image": {
        "width": 1232,
        "height": 821
    }
}
```

## API संदर्भ

## Inference API का उपयोग करना

<mark style="color:हरा;">`POST`</mark> `https://segment.roboflow.com/:datasetSlug/:versionNumber`

आप base64 encoded image को सीधे अपने model endpoint पर POST कर सकते हैं. या आप URL को उसी `image` parameter in the query string में पास कर सकते हैं, यदि आपकी image पहले से कहीं और hosted है.

#### पथ पैरामीटर्स

| नाम         | प्रकार | विवरण                                                                                                                                                                                                                                   |
| ----------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| datasetSlug | string | dataset name का URL-safe version. Training के बाद अपने model को train करने के बाद dataset version के train results section में मुख्य project view पर URL देखकर या "Get curl command" बटन पर क्लिक करके आप इसे web UI में ढूँढ सकते हैं. |
| संस्करण     | संख्या | आपके dataset के संस्करण की पहचान करने वाला version number                                                                                                                                                                               |

#### Query Parameters

| नाम        | प्रकार | विवरण                                                                                                                                                                                                                       |
| ---------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| image      | string | <p>जोड़ने के लिए image का URL. इसका उपयोग करें यदि आपकी image कहीं और hosted है. (जब आप request body में base64 encoded image POST नहीं करते हैं, तब आवश्यक.)<br><br><strong>नोट:</strong> इसे URL-encode करना न भूलें.</p> |
| confidence | संख्या | <p>0-100 की scale पर लौटाई गई predictions के लिए threshold. कम संख्या अधिक predictions लौटाएगी. अधिक संख्या कम लेकिन अधिक निश्चित predictions लौटाएगी.<br><br><strong>डिफ़ॉल्ट:</strong> 50</p>                             |
| api\_key   | string | आपकी API key (आपकी workspace API settings page के माध्यम से प्राप्त)                                                                                                                                                        |

#### Request Body

| नाम | प्रकार | विवरण                                                                                         |
| --- | ------ | --------------------------------------------------------------------------------------------- |
|     | string | एक base64 encoded image. (जब आप query parameters में image URL पास नहीं करते हैं, तब आवश्यक.) |

{% tabs %}
{% tab title="200 JSON format predictions. (x,y) बॉक्स के" %}

```
{
    "segmentation_mask": "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAAAAADRE4smAAAIqElEQVR4nO3dyXbb2BJFQfCt+v9f5htYstWwQXNB3pMZMaiaeMkAcjMBSpa0LAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACRLu8+gJf4cZbX9xzFlBoEcPMUNfChfgB3z1ADy1I/gEfnp4ClegDPzk4CpQNYc27tE/jfuw/gPKvarvwCWKXuBVh9Zr2XQNkNsL7suq+BNYqe/bbT6rwDam6AjVkXfRWsUjKAzQNtXEDJALbrW0DFAPZMs20BBQNoO8td6gWwc/5dsykXwO5BNi2gXAD79SxAAP+0LKBaAC2HeESxAMx/q1oBHJx/x3xqBXBUwwJKBXB8fv0KKBUA21UKYMTLt90KqBQAOxQKoN2Ld4g6AQyaf7eM6gTALgL4qdkKKBPAuLn1KqBMAOwjgOaqBDByb7e6B1QJgJ0E0FyRAFpt7aGKBDBWp5wE0FyNADq9ZAerEcBojYISwE19CigRQJ9xjVciAPYTQHMVAnAHOKBCABwggOYE0JwAmhPAbW0eLAXQnACaKxBAm219igIBcIQAmhNAcwJoTgB3dHm0zA+gy6ROkh8AhwigOQE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zySqn7lY5vZ/aa3wOcN/7CG2D0NFZ8uMT5F94Ay+gfEfrsUkXOv3YAn6c3aDSPr1Xm/KsHMNj9qxU6/srPAGe4O+bY+dsAW926YLnjF8AOPy9Z8vgFsNffn0H/1qMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACARv4PAgMMHbaPKVQAAAAASUVORK5CYII=",
    "class_map": {
        "0": " पृष्ठभूमि",
        "1": " वस्तु"
    },
    "image": {
        "width": 1232,
        "height": 821
    }
}
```

{% endtab %}

{% tab title="403 यदि आपकी api\_key model तक पहुँचने के लिए अधिकृत नहीं है." %}

```
{
    "Message": "उपयोगकर्ता को इस संसाधन तक पहुँचने की अनुमति नहीं है"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-hi/deploy/serverless/instance-segmentation/semantic-segmentation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
