A third-party node.js addon for Paddle Inference. The beginning two versions of paddle node are using Paddle Lite for backbone, but we use Paddle Inference instead as it is more compatible for x86_64 platform.
Tested on Windows 10, Node.js v12.16.3.
Current features:
- Import combined model.
- Infer from float array.
- Image classification from file.
paddlenode.set_combined_model(ModelDir)
paddlenode.infer_float(Data, Size)
paddlenode.image_file_classification(ImagePath, InputSize, Scalefactor, Mean, swapRB)
var paddlenode = require('./paddlenode');
paddlenode.set_combined_model('./mobilenetv1');
var res = paddlenode.image_file_classfication("test.jpg",[1, 3, 224, 224],0.007843,[224,224],[0.485,0.456,0.406], false)
console.log('Result', res.indexOf(Math.max(...res)));
var paddlenode = require('./paddlenode');
paddlenode.set_combined_model('./mobilenetv1');
var arr = new Array(150528);
for(var i=0; i<arr.length; i++) arr[i]=1;
paddlenode.infer_float(arr,[1, 3, 224, 224]);
The array returned is calculated from the model. But we manually add an element to indicate the size of the array, it's located at the first position.