Skip to content

Commit 0e73f66

Browse files
【update】 新增目标识别例子 测试 review by songym
1 parent 12987a1 commit 0e73f66

14 files changed

+1529
-921
lines changed

dist/mapboxgl/iclient-mapboxgl-es6.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ module.exports = toPairs;
12741274

12751275
/***/ }),
12761276

1277-
/***/ 107:
1277+
/***/ 558:
12781278
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
12791279

12801280
(function (global, factory) {
@@ -1645,8 +1645,9 @@ if (typeof globalNS['Promise'] !== 'function') {
16451645
/******/ // The require function
16461646
/******/ function __webpack_require__(moduleId) {
16471647
/******/ // Check if module is in cache
1648-
/******/ if(__webpack_module_cache__[moduleId]) {
1649-
/******/ return __webpack_module_cache__[moduleId].exports;
1648+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
1649+
/******/ if (cachedModule !== undefined) {
1650+
/******/ return cachedModule.exports;
16501651
/******/ }
16511652
/******/ // Create a new module (and put it into the cache)
16521653
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -1668,8 +1669,8 @@ if (typeof globalNS['Promise'] !== 'function') {
16681669
/******/ // getDefaultExport function for compatibility with non-harmony modules
16691670
/******/ __webpack_require__.n = (module) => {
16701671
/******/ var getter = module && module.__esModule ?
1671-
/******/ () => module['default'] :
1672-
/******/ () => module;
1672+
/******/ () => (module['default']) :
1673+
/******/ () => (module);
16731674
/******/ __webpack_require__.d(getter, { a: getter });
16741675
/******/ return getter;
16751676
/******/ };
@@ -1701,10 +1702,12 @@ if (typeof globalNS['Promise'] !== 'function') {
17011702
/******/
17021703
/******/ /* webpack/runtime/hasOwnProperty shorthand */
17031704
/******/ (() => {
1704-
/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
1705+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
17051706
/******/ })();
17061707
/******/
17071708
/************************************************************************/
1709+
var __webpack_exports__ = {};
1710+
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
17081711
(() => {
17091712
"use strict";
17101713

@@ -12516,8 +12519,8 @@ SuperMap.TimeFlowControl = TimeFlowControl;
1251612519

1251712520

1251812521

12519-
// EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
12520-
var polyfill = __webpack_require__(107);
12522+
// EXTERNAL MODULE: ./src/common/node_modules/promise-polyfill/dist/polyfill.js
12523+
var polyfill = __webpack_require__(558);
1252112524
// EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
1252212525
var fetch = __webpack_require__(693);
1252312526
// EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
@@ -40231,7 +40234,7 @@ class BinaryClassification extends MachineLearningModelBase {
4023140234
super(options);
4023240235
}
4023340236
/**
40234-
* @function SuperMap.ObjectDetection.prototype.handleResult
40237+
* @function SuperMap.BinaryClassification.prototype.handleResult
4023540238
* @description 对预测数据进行处理
4023640239
* @param {Object} prediction - 模型预测后的张量。
4023740240
* @returns {Object} 处理返回的数据
@@ -40336,7 +40339,9 @@ class ObjectDetection extends MachineLearningModelBase {
4033640339

4033740340
const scoreData = {};
4033840341
score.forEach((colData, index) => {
40339-
scoreData[index] = +colData[1].toFixed(5);
40342+
if (colData[1] >= 0.5) {
40343+
scoreData[index] = +colData[1].toFixed(5);
40344+
}
4034040345
});
4034140346
const filterBbox = bbox
4034240347
.filter((item, index) => {
@@ -40447,6 +40452,7 @@ class ObjectDetection extends MachineLearningModelBase {
4044740452
*/
4044840453

4044940454
async nms(bbox, scores) {
40455+
console.log('bbox, scores', bbox, scores);
4045040456
const res = await external_function_try_return_tf_catch_e_return_namespaceObject.image.nonMaxSuppressionWithScoreAsync(bbox, scores, 100, 0.3);
4045140457
return res.selectedIndices.arraySync();
4045240458
}
@@ -40459,7 +40465,7 @@ class ObjectDetection extends MachineLearningModelBase {
4045940465
* @returns {array} 返回被间隔取值后的数组
4046040466
*/
4046140467

40462-
_getIntervalFromArray(array, interval, start) {
40468+
getIntervalFromArray(array, interval, start) {
4046340469
return array.map((arr) => {
4046440470
return arr.filter((item, index) => {
4046540471
return index >= start && index % interval === start;
@@ -83378,6 +83384,7 @@ class WebMap extends (external_mapboxgl_default()).Evented {
8337883384

8337983385
})();
8338083386

83387+
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
8338183388
(() => {
8338283389
"use strict";
8338383390

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

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

dist/mapboxgl/iclient-mapboxgl.css

Lines changed: 2 additions & 2 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: 290 additions & 285 deletions
Large diffs are not rendered by default.

dist/mapboxgl/iclient-mapboxgl.min.js

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

dist/mapboxgl/include-mapboxgl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
// dist
173173
if (!inArray(excludes, 'iclient-mapboxgl')) {
174174
if (supportES6()) {
175-
inputScript('../../dist/mapboxgl/iclient-mapboxgl-es6.min.js');
175+
inputScript('../../dist/mapboxgl/iclient-mapboxgl-es6.js');
176176
} else {
177177
inputScript('../../dist/mapboxgl/iclient-mapboxgl.min.js');
178178
}

examples/img/plane600x600.png

705 KB
Loading
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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/plane600x600.png" alt="">
20+
<canvas id="data-canvas1" width="600" height="600"></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="tensorflow" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
24+
<script>
25+
var modelUrl = 'https://iclient.supermap.io/web/data/machine_learning/objcet_detection/model.json';
26+
var img = document.querySelector('#tileImg16');
27+
var canvas = document.querySelector('#data-canvas1');
28+
var ctx = canvas.getContext('2d');
29+
var predictBtn = document.querySelector('#predict');
30+
ctx.drawImage(img, 0, 0, 600, 600);
31+
var webMachineLearning = new SuperMap.WebMachineLearning();
32+
var objectDetection = new SuperMap.ObjectDetection({ modelUrl, image: img });
33+
predictBtn.addEventListener('click', function() {
34+
webMachineLearning.execute(objectDetection).then((bboxList) => {
35+
bboxList.forEach(bbox => {
36+
drawBbox(ctx, bbox);
37+
});
38+
});
39+
});
40+
function drawBbox(ctx, bbox) {
41+
const {x, y, w, h} = bbox;
42+
ctx.strokeStyle = '#00FFFF';
43+
ctx.lineWidth = 3;
44+
ctx.strokeRect(x, y, w, h);
45+
}
46+
47+
</script>
48+
</body>
49+
50+
</html>

examples/mapboxgl/landcoverClassification.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<canvas style="position: absolute; left: 0px; top: 0px;" id="data-canvas1" width="640" height="640"></canvas>
2020
<input type='button' id='predict' class='btn btn-primary' data-i18n="[value]resources.text_analyse"/>
2121
<script type="text/javascript" include="bootstrap,vue" src="../js/include-web.js"></script>
22-
<script include="iclient-mapboxgl-vue,mapbox-gl-enhance,tensorflow" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
22+
<script include="tensorflow" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
2323

2424
<script>
2525
var modelUrl = 'https://iclient.supermap.io/web/data/machine_learning/landcover_classification/model.json';

src/common/thirdparty/ai/BinaryClassification.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class BinaryClassification extends MachineLearningBase {
1313
super(options);
1414
}
1515
/**
16-
* @function SuperMap.ObjectDetection.prototype.handleResult
16+
* @function SuperMap.BinaryClassification.prototype.handleResult
1717
* @description 对预测数据进行处理
1818
* @param {Object} prediction - 模型预测后的张量。
1919
* @returns {Object} 处理返回的数据

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