From 4efc829b1200b21e13af043d6e51fa25e5c2a698 Mon Sep 17 00:00:00 2001 From: Brandon Rozek Date: Mon, 15 May 2023 11:46:58 -0400 Subject: [PATCH] Model change Not sure if this improves things, I'm mostly uploading this changeset I had sitting around on my desktop. --- server.js | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/server.js b/server.js index 5582c9b..be85362 100644 --- a/server.js +++ b/server.js @@ -3,12 +3,37 @@ const tf = require('@tensorflow/tfjs-node'); const bodyPix = require('@tensorflow-models/body-pix'); const {decodeJpeg} = require('./decode_image'); +/* + * outputStride: Specifies the output stride of the BodyPix model. + * The smaller the value, the larger the output resolution, and more accurate + * the model at the cost of speed. Set this to a larger value to increase speed + * at the cost of accuracy. Stride 32 is supported for ResNet and + * stride 8,16,32 are supported for various MobileNetV1 models. + */ + +/* + * multiplier: An optional number with values: 1.01, 1.0, 0.75, or + * 0.50. The value is used only by MobileNet architecture. It is the float + * multiplier for the depth (number of channels) for all convolution ops. + * The larger the value, the larger the size of the layers, and more accurate + * the model at the cost of speed. Set this to a smaller value to increase speed + * at the cost of accuracy. + */ + +/* + * quantBytes: An optional number with values: 1, 2, or 4. This parameter + * affects weight quantization in the models. The available options are + * 1 byte, 2 bytes, and 4 bytes. The higher the value, the larger the model size + * and thus the longer the loading time, the lower the value, the shorter the + * loading time but lower the accuracy. + */ + async function main() { const net = await bodyPix.load({ - architecture: 'MobileNetV1', - outputStride: 16, - multiplier: 0.5, - quantBytes: 2 + architecture: 'ResNet50', + outputStride: 16, + multiplier: 1.0, + quantBytes: 4 }); const sock = new zmq.Reply;