MediaPipe ইমেজ এমবেডার টাস্ক আপনাকে একটি ইমেজের একটি সাংখ্যিক উপস্থাপনা তৈরি করতে দেয়, যা বিভিন্ন ML-ভিত্তিক ইমেজ টাস্কগুলি সম্পন্ন করতে কার্যকর। এই কার্যকারিতাটি প্রায়শই গাণিতিক তুলনা কৌশল যেমন কোসাইন সাদৃশ্য ব্যবহার করে দুটি চিত্রের সাদৃশ্য তুলনা করতে ব্যবহৃত হয়। এই কাজটি একটি মেশিন লার্নিং (ML) মডেলের সাথে স্ট্যাটিক ডেটা বা একটি অবিচ্ছিন্ন স্ট্রিম হিসাবে ইমেজ ডেটার উপর কাজ করে এবং উচ্চ-মাত্রিক বৈশিষ্ট্য ভেক্টরগুলির একটি তালিকা হিসাবে চিত্র ডেটার একটি সাংখ্যিক উপস্থাপনা আউটপুট করে, যেটি এম্বেডিং ভেক্টর নামেও পরিচিত, হয় ভাসমান অবস্থায়। -পয়েন্ট বা কোয়ান্টাইজড ফর্ম।
আপনার লক্ষ্য প্ল্যাটফর্মের জন্য এই বাস্তবায়ন নির্দেশিকাগুলির একটি অনুসরণ করে এই কাজটি ব্যবহার করা শুরু করুন। এই প্ল্যাটফর্ম-নির্দিষ্ট নির্দেশিকাগুলি আপনাকে একটি প্রস্তাবিত মডেল ব্যবহার করে এই টাস্কের একটি মৌলিক বাস্তবায়নের মাধ্যমে নিয়ে যায় এবং প্রস্তাবিত কনফিগারেশন বিকল্পগুলির সাথে কোড উদাহরণ প্রদান করে:
এই বিভাগটি এই কাজের ক্ষমতা, ইনপুট, আউটপুট এবং কনফিগারেশন বিকল্পগুলি বর্ণনা করে।
বৈশিষ্ট্য
ইনপুট ইমেজ প্রসেসিং - প্রসেসিং এর মধ্যে রয়েছে ইমেজ রোটেশন, রিসাইজ, নরমালাইজেশন এবং কালার স্পেস কনভার্সন।
আগ্রহের অঞ্চল - পুরো চিত্রের পরিবর্তে চিত্রের একটি অঞ্চলে এম্বেডিং সম্পাদন করে৷
এমবেডিং সাদৃশ্য গণনা - দুটি বৈশিষ্ট্য ভেক্টরের মধ্যে কোসাইন সাদৃশ্য গণনা করার জন্য অন্তর্নির্মিত ইউটিলিটি ফাংশন
কোয়ান্টাইজেশন - বৈশিষ্ট্য ভেক্টরের জন্য স্কেলার কোয়ান্টাইজেশন সমর্থন করে।
টাস্ক ইনপুট
টাস্ক আউটপুট
ইনপুট নিম্নলিখিত ডেটা প্রকারগুলির মধ্যে একটি হতে পারে:
স্থির চিত্র
ডিকোডেড ভিডিও ফ্রেম
লাইভ ভিডিও ফিড
ইমেজ এমবেডার এম্বেডিংয়ের একটি তালিকা আউটপুট করে যার মধ্যে রয়েছে:
এমবেডিং: বৈশিষ্ট্য ভেক্টর নিজেই, হয় ফ্লোটিং-পয়েন্ট আকারে বা স্কেলার-কোয়ান্টাইজড।
হেড সূচক: মাথার জন্য সূচক যা এই এমবেডিং তৈরি করেছে।
মাথার নাম (ঐচ্ছিক): মাথার নাম যেটি এই এমবেডিং তৈরি করেছে।
কনফিগারেশন অপশন
এই কাজের নিম্নলিখিত কনফিগারেশন বিকল্প আছে:
বিকল্পের নাম
বর্ণনা
মান পরিসীমা
ডিফল্ট মান
running_mode
টাস্কের জন্য চলমান মোড সেট করে। তিনটি মোড আছে:
IMAGE: একক ইমেজ ইনপুট জন্য মোড.
ভিডিও: একটি ভিডিওর ডিকোড করা ফ্রেমের মোড।
লাইভ_স্ট্রিম: ইনপুট ডেটার লাইভস্ট্রিমের মোড, যেমন ক্যামেরা থেকে। এই মোডে, ফলাফল শ্রোতাকে অ্যাসিঙ্ক্রোনাসভাবে ফলাফল পেতে একটি শ্রোতা সেট আপ করতে কল করতে হবে।
{ IMAGE, VIDEO, LIVE_STREAM }
IMAGE
l2_normalize
L2 আদর্শের সাথে প্রত্যাবর্তিত বৈশিষ্ট্য ভেক্টরকে স্বাভাবিক করতে হবে কিনা। এই বিকল্পটি ব্যবহার করুন শুধুমাত্র যদি মডেলটিতে ইতিমধ্যে একটি নেটিভ L2_NORMALIZATION TFLite Op না থাকে৷ বেশিরভাগ ক্ষেত্রে, এটি ইতিমধ্যেই হয় এবং এইভাবে এই বিকল্পের প্রয়োজন ছাড়াই TFLite অনুমানের মাধ্যমে L2 স্বাভাবিককরণ অর্জন করা হয়।
Boolean
False
quantize
প্রত্যাবর্তিত এমবেডিং স্কেলার কোয়ান্টাইজেশনের মাধ্যমে বাইটে পরিমাপ করা উচিত কিনা। এমবেডিংগুলিকে পরোক্ষভাবে ইউনিট-নর্ম হিসাবে ধরে নেওয়া হয় এবং তাই যে কোনও মাত্রা [-1.0, 1.0]-এ একটি মান থাকার নিশ্চয়তা দেওয়া হয়। যদি এটি না হয় তবে l2_normalize বিকল্পটি ব্যবহার করুন।
Boolean
False
result_callback
ইমেজ এমবেডার যখন লাইভ স্ট্রিম মোডে থাকে তখন অ্যাসিঙ্ক্রোনাসভাবে এম্বেডিং ফলাফল পেতে ফলাফল শ্রোতাকে সেট করে। চলমান মোড LIVE_STREAM এ সেট করা থাকলেই কেবল ব্যবহার করা যাবে৷
N/A
সেট করা হয়নি
মডেল
ইমেজ এমবেডারের জন্য একটি ইমেজ এমবেডিং মডেল প্রয়োজন যা আপনার প্রোজেক্ট ডিরেক্টরিতে ডাউনলোড এবং সংরক্ষণ করা হবে। আপনি যখন এই টাস্কের সাথে বিকাশ শুরু করেন তখন আপনার লক্ষ্য প্ল্যাটফর্মের জন্য ডিফল্ট, প্রস্তাবিত মডেল দিয়ে শুরু করুন। অন্যান্য উপলব্ধ মডেলগুলি সাধারণত কর্মক্ষমতা, নির্ভুলতা, রেজোলিউশন এবং সংস্থান প্রয়োজনীয়তার মধ্যে ট্রেড-অফ করে এবং কিছু ক্ষেত্রে অতিরিক্ত বৈশিষ্ট্যগুলি অন্তর্ভুক্ত করে।
MobileNetV3 মডেল
এই মডেল পরিবার একটি MobileNet V3 আর্কিটেকচার ব্যবহার করে এবং ইমেজনেট ডেটা ব্যবহার করে প্রশিক্ষিত হয়েছিল। এই মডেলটি সঠিকতা-লেটেন্সি ট্রেড অফ টিউন করতে কনভোলিউশনাল লেয়ারে গভীরতার (বৈশিষ্ট্যের সংখ্যা) জন্য 0.75 এর গুণক ব্যবহার করে। উপরন্তু, MobileNet V3 দুটি ভিন্ন আকারে আসে, ছোট এবং বড়, নেটওয়ার্কটিকে কম বা উচ্চ সম্পদ ব্যবহারের ক্ষেত্রে মানিয়ে নিতে।
উপরের পূর্ব-প্রশিক্ষিত মডেলগুলির উপর ভিত্তি করে পুরো পাইপলাইনের জন্য টাস্ক বেঞ্চমার্কগুলি এখানে রয়েছে৷ CPU/GPU ব্যবহার করে Pixel 6-এর গড় বিলম্বিততার ফলাফল হল লেটেন্সি।
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-01-13 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Image embedding task guide\n\nThe MediaPipe Image Embedder task lets you create a numeric representation of an image,\nwhich is useful in accomplishing various ML-based image tasks. This\nfunctionality is frequently used to compare the similarity of two images using\nmathematical comparison techniques such as Cosine Similarity. This task operates\non image data with a machine learning (ML) model as static data or a continuous\nstream, and outputs a numeric representation of the image data as a list of\nhigh-dimensional feature vectors, also known as embedding vectors, in either\nfloating-point or quantized form.\n\n[Try it!arrow_forward](https://mediapipe-studio.webapps.google.com/demo/image_embedder)\n\nGet Started\n-----------\n\nStart using this task by following one of these implementation guides for your\ntarget platform. These platform-specific guides walk you through a basic\nimplementation of this task, using a recommended model, and provide code\nexamples with the recommended configuration options:\n\n- **Android** - [Code\n example](https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/image_embedder/android) - [Guide](./android)\n- **Python** - [Code\n example](https://colab.sandbox.google.com/github/googlesamples/mediapipe/blob/main/examples/image_embedder/python/image_embedder.ipynb) - [Guide](./python)\n- **Web** - [Code example](https://codepen.io/mediapipe-preview/pen/yLqxbaZ) - [Guide](./web_js)\n\nTask details\n------------\n\nThis section describes the capabilities, inputs, outputs, and configuration\noptions of this task.\n\n### Features\n\n- **Input image processing** - Processing includes image rotation, resizing, normalization, and color space conversion.\n- **Region of interest** - Performs embedding on a region of the image instead of the whole image.\n- **Embedding similarity computation** - Built-in utility function to compute the [cosine similarity](https://en.wikipedia.org/wiki/Cosine_similarity) between two feature vectors\n- **Quantization** - Supports scalar quantization for the feature vectors.\n\n| Task inputs | Task outputs |\n|-------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Input can be one of the following data types: - Still images \u003c!-- --\u003e - Decoded video frames \u003c!-- --\u003e - Live video feed | Image Embedder outputs a list of embeddings consisting of: - Embedding: the feature vector itself, either in floating-point form or scalar-quantized. \u003c!-- --\u003e - Head index: the index for the head that produced this embedding. \u003c!-- --\u003e - Head name (optional): the name of the head that produced this embedding. |\n\n### Configurations options\n\nThis task has the following configuration options:\n\n| Option Name | Description | Value Range | Default Value |\n|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------|---------------|\n| `running_mode` | Sets the running mode for the task. There are three modes: \u003cbr /\u003e IMAGE: The mode for single image inputs. \u003cbr /\u003e VIDEO: The mode for decoded frames of a video. \u003cbr /\u003e LIVE_STREAM: The mode for a livestream of input data, such as from a camera. In this mode, resultListener must be called to set up a listener to receive results asynchronously. | {`IMAGE, VIDEO, LIVE_STREAM`} | `IMAGE` |\n| `l2_normalize` | Whether to normalize the returned feature vector with L2 norm. Use this option only if the model does not already contain a native L2_NORMALIZATION TFLite Op. In most cases, this is already the case and L2 normalization is thus achieved through TFLite inference with no need for this option. | `Boolean` | `False` |\n| `quantize` | Whether the returned embedding should be quantized to bytes via scalar quantization. Embeddings are implicitly assumed to be unit-norm and therefore any dimension is guaranteed to have a value in \\[-1.0, 1.0\\]. Use the l2_normalize option if this is not the case. | `Boolean` | `False` |\n| `result_callback` | Sets the result listener to receive the embedding results asynchronously when the Image Embedder is in the live stream mode. Can only be used when running mode is set to `LIVE_STREAM` | N/A | Not set |\n\n| **Note:** The `resultListener` is dependent on `runningMode`. Only set the `resultListener` when `runningMode` is set to `LIVE_STREAM`.\n\nModels\n------\n\nThe Image Embedder requires an image embedding model to be downloaded and stored\nin your project directory. Start with the default, recommended model for your\ntarget platform when you start developing with this task. The other available\nmodels typically make trade-offs between performance, accuracy, resolution, and\nresource requirements, and in some cases, include additional features.\n| **Attention:** This MediaPipe Solutions Preview is an early release. [Learn more](/edge/mediapipe/solutions/about#notice).\n\n### MobileNetV3 model\n\nThis model family uses a [MobileNet V3](https://arxiv.org/abs/1905.02244)\narchitecture and was trained using [ImageNet](https://www.image-net.org) data.\nThis model uses a multiplier of 0.75 for the depth (number of features) in the\nconvolutional layers to tune the accuracy-latency trade off. In addition,\nMobileNet V3 comes in two different sizes, small and large, to adapt the network\nto low or high resource use cases.\n\n| Model name | Input shape | Quantization type | Versions |\n|----------------------------------------------------------------------------------------------------------------------------------------------------|-------------|-------------------|--------------------------------------------------------------------------------------------------------------------------------------|\n| [MobileNet-V3 (small)](https://storage.googleapis.com/mediapipe-models/image_embedder/mobilenet_v3_small/float32/latest/mobilenet_v3_small.tflite) | 224 x 224 | None (float32) | [Latest](https://storage.googleapis.com/mediapipe-models/image_embedder/mobilenet_v3_small/float32/latest/mobilenet_v3_small.tflite) |\n| [MobileNet-V3 (large)](https://storage.googleapis.com/mediapipe-models/image_embedder/mobilenet_v3_large/float32/latest/mobilenet_v3_large.tflite) | 224 x 224 | None (float32) | [Latest](https://storage.googleapis.com/mediapipe-models/image_embedder/mobilenet_v3_large/float32/latest/mobilenet_v3_large.tflite) |\n\nTask benchmarks\n---------------\n\nHere's the task benchmarks for the whole pipeline based on the above\npre-trained models. The latency result is the average latency on Pixel 6 using\nCPU / GPU.\n\n| Model Name | CPU Latency | GPU Latency |\n|----------------------|-------------|-------------|\n| MobileNet-V3 (small) | 3.94ms | 7.83ms |\n| MobileNet-V3 (large) | 9.75ms | 9.08ms |"]]