mb3-centernet
所属分类:数值算法/人工智能
开发工具:JavaScript
文件大小:7682KB
下载次数:0
上传日期:2022-09-18 17:07:53
上 传 者:
sh-1993
说明: mb3中心网,中心网:用于TFJS和NodeJS的微小对象检测
(mb3-centernet,CenterNet: Tiny Object Detection for TFJS and NodeJS)
文件列表:
.eslintrc.json (608, 2022-09-19)
coco-labels.js (2794, 2022-09-19)
inputs (0, 2022-09-19)
inputs\cars.jpg (2279837, 2022-09-19)
inputs\dog.jpg (237644, 2022-09-19)
mb3-centernet.js (6871, 2022-09-19)
model-f16 (0, 2022-09-19)
model-f16\mb3-centernet.bin (4030290, 2022-09-19)
model-f16\mb3-centernet.json (201677, 2022-09-19)
outputs (0, 2022-09-19)
outputs\cars.jpg (2044541, 2022-09-19)
outputs\dog.jpg (223721, 2022-09-19)
package.json (937, 2022-09-19)
# MobileNet-v3 with CenterNet Object Detection for TFJS and NodeJS
Models included in and were converted to TFJS Graph model format from the original repository
Models descriptors and signature have been additionally parsed for readability
Actual model parsing implementation in `mb3-centernet.js` does not follow original Pytyhon implementation and is fully custom and optimized for JavaScript execution
Function `processResults()` takes output of `model.execute` and returns array of objects:
- id: internal number of detection box, used only for debugging
- score: value 0..1
- class: coco class number
- label: coco label as string
- box: detection box [x1, y1, x2, y2] normalized to input image dimensions
- boxRaw: detection box [x1, y1, x2, y2] normalized to 0..1
## Example
![Example Image](https://github.com/vladmandic/mb3-centernet/blob/master/outputs/cars.jpg)
## Conversion Notes
Source:
```shell
tensorflowjs_converter \
--input_format tf_frozen_model \
--output_format tfjs_graph_model \
--quantize_float16=* \
--output_node_names="tower_0/detections,tower_0/keypoints,tower_0/wh" model-frozen/detector.pb model-f16
```
```js
2021-05-19 07:12:34 INFO: nanodet version 0.0.1
2021-05-19 07:12:34 INFO: User: vlado Platform: linux Arch: x*** Node: v16.0.0
2021-05-19 07:12:34 DATA: created on: 2021-05-18T21:49:02.930Z
2021-05-19 07:12:34 INFO: graph model: /home/vlado/dev/mb3-centernet/model-f16/mb3-centernet.json
2021-05-19 07:12:34 INFO: size: { unreliable: true, numTensors: 267, numDataBuffers: 267, numBytes: 8060260 }
2021-05-19 07:12:34 INFO: model inputs based on signature
2021-05-19 07:12:34 INFO: model outputs based on signature
2021-05-19 07:12:34 DATA: inputs: [ { name: 'tower_0/images', dtype: 'DT_FLOAT', shape: [ 1, 512, 512, 3, [length]: 4 ] }, [length]: 1 ]
2021-05-19 07:12:34 DATA: outputs: [
{ id: 0, name: 'tower_0/wh', dytpe: 'DT_FLOAT', shape: [ 1, 128, 128, 4, [length]: 4 ] },
{ id: 1, name: 'tower_0/keypoints', dytpe: 'DT_FLOAT', shape: [ 1, 128, 128, 80, [length]: 4 ] },
{ id: 2, name: 'tower_0/detections', dytpe: 'DT_FLOAT', shape: [ 1, 100, 6, [length]: 3 ] },
[length]: 3
]
```
Where `tower_0/detections` is array of COCO classes * [ x1, y1, x2, y2, score, class ]
`tower_0/detections` is built in-model from `tower_0/wh` which contains strided heatmap - since it's already processed into detections, we don't need heatmap post-processing
## Test
```shell
node ./mb3-centernet.js inputs/dog.jpg
```
```js
2021-05-18 19:37:38 INFO: Loaded model { modelPath: 'file://model/mb3-centernet.json', outputTensors: [ 'tower_0/detections', [length]: 1 ], minScore: 0.1, iouThreshold: 0.4, maxResults: 20 } tensors: 267 bytes: 8060260
2021-05-18 19:37:38 INFO: Model Signature {
inputs: { 'tower_0/images': { name: 'tower_0/images', dtype: 'DT_FLOAT', tensorShape: { dim: [ { size: '1' }, { size: '512' }, { size: '512' }, { size: '3' }, [length]: 4 ] } } },
outputs: { 'tower_0/wh': { name: 'tower_0/wh' }, 'tower_0/keypoints': { name: 'tower_0/keypoints' }, 'tower_0/detections': { name: 'tower_0/detections' } }
}
2021-05-18 19:37:38 INFO: Loaded image: inputs/dog.jpg inputShape: [ 1536, 2048, [length]: 2 ] outputShape: [ 1, 512, 512, 3, [length]: 4 ]
2021-05-18 19:37:38 INFO: Inference time: 216 ms
2021-05-18 19:37:38 INFO: Processing time: 3 ms
2021-05-18 19:37:38 DATA: Results: [
{
id: 0,
score: 0.441189140081405***,
class: 0,
label: 'person',
box: [ 678, 228, 1516, 1899, [length]: 4 ],
boxRaw: [ 0.44152459502220154, 0.11151626706123352, 0.***70420694351196, 0.9275288581848145, [length]: 4 ]
},
{
id: 1,
score: 0.37394979596138,
class: 16,
label: 'dog',
box: [ 4, 566, 826, 1504, [length]: 4 ],
boxRaw: [ 0.0030441880226135254, 0.27652108669281006, 0.538006067276001, 0.7345627546310425, [length]: 4 ]
}
]
2021-05-18 19:37:38 STATE: Created output image: outputs/dog.jpg
```
近期下载者:
相关文件:
收藏者: