Skip to content

Commit 592e246

Browse files
【feature】 新增webai 接口 例子 测试 review by songym
1 parent a928b46 commit 592e246

36 files changed

+134764
-88457
lines changed

dist/mapboxgl/iclient-mapboxgl-es6.js

Lines changed: 94724 additions & 914 deletions
Large diffs are not rendered by default.

dist/mapboxgl/iclient-mapboxgl-es6.min.js

Lines changed: 438 additions & 483 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mapboxgl/iclient-mapboxgl.js

Lines changed: 37836 additions & 84950 deletions
Large diffs are not rendered by default.

dist/mapboxgl/iclient-mapboxgl.min.js

Lines changed: 132 additions & 1301 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/img/building.png

1.56 MB
Loading

examples/img/landcover.png

1.03 MB
Loading

examples/locales/en-US/resources.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ window.examplesResources = {
8787
"vuecomponents_leaflet": "Vue - Leaflet",
8888
"reactcomponents_mbgl": 'React - MapboxGL',
8989
"h5components": "H5",
90-
"template": 'Templates'
90+
"template": 'Templates',
91+
"machineLearning": 'Machine Learning'
9192
},
9293
"more": {
9394
"_name": "More>>",
@@ -685,6 +686,9 @@ window.examplesResources = {
685686
"title_objectdetection":"Machinelearning Result Overlay(Objectdetection)",
686687
"title_binaryclassification":"Machinelearning Result Overlay(Binaryclassification)",
687688
"title_mvt_mapboxgl":"MVT WGS84 (via MapboxGL)",
689+
"title_binary_classification": "Binary Claasification",
690+
"title_landcover_classification": "Landcover Claasification",
691+
"title_object_detection": "Object Detection",
688692

689693
"text_service_name":"Name",
690694
"text_service_type":"Type",
@@ -739,6 +743,7 @@ window.examplesResources = {
739743
"text_removeResult": "Remove result",
740744
"text_addPath": "Add path",
741745
"text_query": "To query",
746+
"text_analyse": "To anaylse",
742747
"text_closestFacilitiesService": "Closest Facilities Analysis Service",
743748
"text_weightField": "Weight field:",
744749
"text_turnField": "End of the mileage point (Turning field):",

examples/locales/zh-CN/resources.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ window.examplesResources = {
5656
"vuecomponents_leaflet": "Vue - Leaflet",
5757
"reactcomponents_mbgl": 'React - MapboxGL',
5858
"h5components": "H5",
59-
"template": '模板'
59+
"template": '模板',
60+
"machineLearning": '机器学习'
6061
}
6162
},
6263
"footer": {
@@ -636,6 +637,9 @@ window.examplesResources = {
636637
"title_objectdetection":"机器学习结果叠加(目标检测)",
637638
"title_binaryclassification":"机器学习结果叠加(二元分类)",
638639
"title_mvt_mapboxgl":"MVT WGS84 (叠加 MapboxGL)",
640+
"title_binary_classification": "二元分类",
641+
"title_landcover_classification": "地物分类",
642+
"title_object_detection": "目标识别",
639643

640644
"text_service_name":"名称",
641645
"text_service_type":"类型",
@@ -690,6 +694,7 @@ window.examplesResources = {
690694
"text_removeResult": "移除结果",
691695
"text_addPath": "生成路径",
692696
"text_query": "查询",
697+
"text_analyse": "分析",
693698
"text_closestFacilitiesService": "最近设施分析",
694699
"text_weightField": "权重字段:",
695700
"text_turnField": "终止里程点:(转向字段)",
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<!--********************************************************************
2+
* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
3+
*********************************************************************-->
4+
<!DOCTYPE html>
5+
<html>
6+
7+
<head>
8+
<meta charset="UTF-8">
9+
<title data-i18n='resources.title_binary_classification'></title>
10+
<style>
11+
#predict {
12+
position: absolute;
13+
left: 10px;
14+
top: 10px;
15+
}
16+
</style>
17+
18+
</head>
19+
<img style="display: none;" class="building" id="tileImg16" src="../img/building.png" alt="">
20+
<canvas id="data-canvas1" width="640" height="640"></canvas>
21+
<input type='button' id='predict' class='btn btn-primary' data-i18n="[value]resources.text_analyse"/>
22+
<script type="text/javascript" include="bootstrap,vue" src="../js/include-web.js"></script>
23+
<script include="iclient-mapboxgl-vue,mapbox-gl-enhance" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
24+
<script>
25+
let img = document.querySelector('#tileImg16');
26+
let canvas = document.querySelector('#data-canvas1');
27+
let ctx = canvas.getContext('2d');
28+
let predictBtn = document.querySelector('#predict');
29+
ctx.drawImage(img, 0, 0, 640, 640);
30+
let webMachineLearning = new SuperMap.WebMachineLearning();
31+
let binaryClassification = new SuperMap.BinaryClassification({ modelUrl: 'http://192.168.11.148:8084/model.json', image: img });
32+
predictBtn.addEventListener('click', function() {
33+
webMachineLearning.execute(binaryClassification).then((res) => {
34+
const { data, width, height } = res;
35+
const bytes = ctx.getImageData(0, 0, 640, 640);
36+
for (let i = 0;i < width * height; i++) {
37+
let j = i * 4;
38+
let threshold = data[i];
39+
if (threshold > 0.9) {
40+
bytes.data[j] = 255;
41+
bytes.data[j + 1] = 255;
42+
bytes.data[j + 2] = 0;
43+
bytes.data[j + 3] = 255;
44+
}
45+
}
46+
ctx.putImageData(bytes, 0, 0);
47+
});
48+
});
49+
50+
</script>
51+
</body>
52+
53+
</html>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy