new SuperMap.MachineLearningBase(modelUrl, image, backend)
common/thirdparty/ai/MachineLearningBase.js, line 8
Name | Type | Default | Description |
---|---|---|---|
modelUrl |
string |
模型分析地址。 |
|
image |
PixelData | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap |
图片对象。 |
|
backend |
string | backendOptions.WEBGL |
可选
模型分析方式( cpu 或 webgl)。 |
Members
-
backendObject
-
模型分析方式( cpu 或 webgl)。
-
imagePixelData ImageData HTMLImageElement HTMLCanvasElement HTMLVideoElement ImageBitmap
-
图片对象
-
modelUrlstring
-
模型地址
Methods
-
_loadModel(modelUrl){Promise.<tf.GraphModel>}
common/thirdparty/ai/MachineLearningBase.js, line 38 -
加载模型
Name Type Description modelUrl
string 模型地址。
Returns:
Type Description Promise.<tf.GraphModel> -
dispose()
common/thirdparty/ai/MachineLearningBase.js, line 88 -
释放内存
-
handleInputParams(image, width, height, dtype){Object}
common/thirdparty/ai/MachineLearningBase.js, line 56 -
处理输入张量
Name Type Description image
PixelData | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap 图片对象。
width
number 图片宽度。
height
number 图片高度。
dtype
string 数据类型。
Returns:
Type Description Object - 输入处理后的张量
-
handleResult()
common/thirdparty/ai/MachineLearningBase.js, line 49 -
对预测数据进行处理
-
predict(){object}
common/thirdparty/ai/MachineLearningBase.js, line 70 -
对模型进行预测
Returns:
Type Description object