پیش بینی با استفاده از پلتفرم TensorFlow و Cloud AI
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
TensorFlow یک پلت فرم متن باز ML است که از روش های پیشرفته ML مانند یادگیری عمیق پشتیبانی می کند. این صفحه ویژگی های خاص TensorFlow را در Earth Engine توضیح می دهد. اگرچه مدلهای TensorFlow خارج از Earth Engine توسعه یافته و آموزش داده میشوند، API Engine Earth روشهایی را برای صادرات آموزش و آزمایش دادهها در قالب TFRecord و واردات/صادرات تصاویر در قالب TFRecord ارائه میکند. برای اطلاعات بیشتر درباره نحوه توسعه خطوط لوله برای استفاده از TensorFlow با دادههای Earth Engine ، صفحه نمونههای TensorFlow را ببینید. برای کسب اطلاعات بیشتر در مورد نحوه نوشتن داده ها در فایل های TFRecord به صفحه TFRecord مراجعه کنید.
ee.Model
بسته ee.Model تعامل با مدلهای یادگیری ماشینی مبتنی بر TensorFlow را مدیریت میکند.
تعامل با مدل های میزبانی شده در پلتفرم هوش مصنوعی
یک نمونه جدید ee.Model را می توان با ee.Model.fromAiPlatformPredictor() ایجاد کرد. این یک شی ee.Model است که دادههای Earth Engine را در تانسورها بستهبندی میکند، آنها را به عنوان درخواستهای پیشبینی به پلتفرم هوش مصنوعی Google ارسال میکند و سپس به طور خودکار پاسخها را در انواع دادههای Earth Engine دوباره جمع میکند. توجه داشته باشید که بسته به اندازه و پیچیدگی مدل خود و ورودی های آن، ممکن است بخواهید حداقل اندازه گره مدل پلتفرم هوش مصنوعی خود را تنظیم کنید تا حجم بالایی از پیش بینی ها را در خود جای دهد.
Earth Engine به مدلهای پلتفرم هوش مصنوعی برای استفاده از قالب SavedModel TensorFlow نیاز دارد. قبل از اینکه یک مدل میزبان بتواند با Earth Engine تعامل داشته باشد، ورودی/خروجی های آن باید با فرمت تبادلی TensorProto، به ویژه TensorProtos سریال شده در base64 سازگار باشد. برای آسانتر کردن این کار، Earth Engine CLI دستور model prepare را دارد که SavedModel موجود را در عملیاتهای مورد نیاز برای تبدیل فرمتهای ورودی/خروجی میپیچد.
برای استفاده از یک مدل با ee.Model.fromAiPlatformPredictor() ، باید مجوزهای کافی برای استفاده از مدل داشته باشید. به طور خاص، شما (یا هر کسی که از مدل استفاده می کند) حداقل به نقش کاربر مدل موتور ML نیاز دارید. میتوانید مجوزهای مدل را از صفحه مدلهای کنسول Cloud بررسی و تنظیم کنید.
مناطق
شما باید از نقاط انتهایی منطقه ای برای مدل های خود استفاده کنید، منطقه را در ایجاد مدل، ایجاد نسخه و در ee.Model.fromAiPlatformPredictor() مشخص کنید. هر منطقه ای کار می کند (از global استفاده نکنید)، اما us-central1 ترجیح داده می شود. پارامتر REGIONS را مشخص نکنید. اگر در حال ایجاد یک مدل از Cloud Console هستید، مطمئن شوید که کادر منطقه ای علامت زده شده است.
هزینه ها
پیش بینی تصویر
از model.predictImage() برای پیش بینی در ee.Image با استفاده از یک مدل میزبان استفاده کنید. نوع برگشتی predictImage() یک ee.Image است که میتواند به نقشه اضافه شود، در محاسبات دیگر استفاده شود، صادر شود، و غیره (برای اطلاعات بیشتر در مورد نحوه کار کاشی کاری به سند TFRecord مراجعه کنید). توجه داشته باشید که Earth Engine همیشه تانسورهای سه بعدی را به مدل شما ارسال می کند حتی زمانی که باندها اسکالر هستند (آخرین بعد 1 خواهد بود).
تقریباً همه مدلهای کانولوشنیک دارای یک پیشبینی ورودی ثابت خواهند بود (دادههایی که مدل بر روی آن آموزش داده شده است). در این حالت، پارامتر fixInputProj را در فراخوانی به ee.Model.fromAiPlatformPredictor() روی true تنظیم کنید. هنگام تجسم پیشبینیها، هنگام بزرگنمایی مدلی که دارای نمایش ورودی ثابت است، احتیاط کنید. این به همان دلیلی است که در اینجا توضیح داده شده است . به طور خاص، بزرگنمایی به یک محدوده فضایی بزرگ میتواند منجر به درخواست دادههای بیش از حد شود و ممکن است به صورت کاهش سرعت یا رد شدن توسط پلتفرم هوش مصنوعی ظاهر شود.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThis guide is deprecated and users should refer to the TensorFlow with Vertex AI guide for updated information.\u003c/p\u003e\n"],["\u003cp\u003eEarth Engine facilitates the use of TensorFlow for machine learning by providing methods for data export/import in TFRecord format and integration with AI Platform for model hosting.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eee.Model\u003c/code\u003e package enables interaction with TensorFlow models, specifically allowing predictions on Earth Engine images using models hosted on AI Platform.\u003c/p\u003e\n"],["\u003cp\u003eWhen using AI Platform models, ensure compatibility with TensorFlow's SavedModel format and configure necessary permissions for model access.\u003c/p\u003e\n"],["\u003cp\u003eBe mindful of potential costs associated with using billable components of Google Cloud, such as AI Platform and Cloud Storage.\u003c/p\u003e\n"]]],["This content outlines using TensorFlow models with Earth Engine, focusing on `ee.Model` for AI Platform interaction. Key actions include creating `ee.Model` instances with `ee.Model.fromAiPlatformPredictor()`, packaging Earth Engine data into tensors for AI Platform prediction requests, and reassembling responses. Models must use TensorFlow's SavedModel format, prepared using the Earth Engine CLI. Image predictions utilize `model.predictImage()`, returning an `ee.Image`. The document warns about costs associated with AI Platform and Cloud Storage and recommend using regional endpoints.\n"],null,["# Predictions using TensorFlow and Cloud AI Platform\n\n| **Deprecated!** This guide uses datasets that may be removed from the\n| Earth Engine catalog and/or methods that may be removed in future versions of the Earth\n| Engine API. See [](/earth-engine/guides/earth-engine/guides/tensorflow-vertex)instead.\n\n[TensorFlow](https://www.tensorflow.org/) is an open source ML platform that\nsupports advanced ML methods such as deep learning. This page describes TensorFlow\nspecific features in Earth Engine. Although TensorFlow models are developed and trained\noutside Earth Engine, the Earth Engine API provides methods for exporting training and\ntesting data in TFRecord format and importing/exporting imagery in TFRecord format. See\n[the TensorFlow examples page](/earth-engine/guides/tf_examples) for more information about how to\ndevelop pipelines for using TensorFlow with data from Earth Engine. See\n[the TFRecord page](/earth-engine/guides/tfrecord) to learn more about how Earth Engine writes data to\nTFRecord files.\n\n`ee.Model`\n----------\n\n\nThe `ee.Model` package handles interaction with TensorFlow backed machine\nlearning models.\n\n### Interacting with models hosted on AI Platform\n\n\nA new `ee.Model` instance can be created with\n`ee.Model.fromAiPlatformPredictor()`. This is an `ee.Model` object\nthat packages Earth Engine data into tensors, forwards them as predict requests to\n[Google AI Platform](https://cloud.google.com/ai-platform/) then automatically\nreassembles the responses into Earth Engine data types. Note that depending on the size\nand complexity of your model and its inputs, you may wish to\n[adjust\nthe minimum node size](https://cloud.google.com/ml-engine/docs/prediction-overview#node-allocation) of your AI Platform model to accommodate a high volume of\npredictions.\n\nEarth Engine requires AI Platform models to use TensorFlow's\n[SavedModel](https://www.tensorflow.org/guide/saved_model#save_and_restore_models)\nformat. Before a hosted model can interact with Earth Engine, its inputs/outputs need to\nbe compatible with the TensorProto interchange format, specifically serialized\nTensorProtos in base64. To make this easier, the Earth Engine CLI has the\n[`model prepare`](/earth-engine/guides/command_line#model) command that wraps an existing\nSavedModel in the required operations to convert input/output formats.\n\n\nTo use a model with `ee.Model.fromAiPlatformPredictor()`, you must have sufficient\npermissions to use the model. Specifically, you (or anyone who uses the model) needs at\nleast the [ML Engine Model User role](https://cloud.google.com/ai-platform/prediction/docs/access-control#model_user_role). You can inspect and set model permissions from the\n[models page of the Cloud\nConsole](https://console.cloud.google.com/ai-platform/models).\n\n### Regions\n\n\nYou should use regional endpoints for your models, specifying the region at model creation,\nversion creation and in `ee.Model.fromAiPlatformPredictor()`. Any region will\nwork (don't use global), but `us-central1` is preferred. Don't specify the\n`REGIONS` parameter. If you are are creating a model from the\n[Cloud Console](https://console.cloud.google.com/ai-platform/models),\nensure the regional box is checked.\n\nCosts\n-----\n\n| **Warning!** These guides use billable components of Google Cloud including:\n|\n| - AI Platform Training ([pricing](https://cloud.google.com/ai-platform/training/pricing))\n| - AI Platform Prediction ([pricing](https://cloud.google.com/ai-platform/prediction/pricing))\n| - Cloud Storage ([pricing](https://cloud.google.com/storage/pricing))\n|\n| You can use the\n| [Pricing Calculator](https://cloud.google.com/products/calculator) to generate\n| a cost estimate based on your projected usage.\n\n### Image Predictions\n\n\nUse `model.predictImage()` to make predictions on an `ee.Image`\nusing a hosted model. The return type of `predictImage()` is an\n`ee.Image` which can be added to the map, used in other computations,\nexported, etc. Earth Engine will automatically tile the input bands and adjust\nthe output projection for scale changes and overtiling as needed. (See\n[the TFRecord doc](/earth-engine/guides/tfrecord#exporting-images) for more information on how tiling\nworks). Note that Earth Engine will always forward 3D tensors to your model even when\nbands are scalar (the last dimension will be 1).\n\n\nNearly all convolutional models will have a fixed input projection (that of the data\non which the model was trained). In this case, set the `fixInputProj` parameter\nto **true** in your call to `ee.Model.fromAiPlatformPredictor()`.\nWhen visualizing predictions, use caution when zooming out on a model that has a fixed\ninput projection. This is for the same reason as [described\nhere](/earth-engine/guides/projections#reprojecting). Specifically, zooming to a large spatial scope can result in requests for too\nmuch data and may manifest as slowdowns or rejections by AI Platform."]]