Skip to content

Commit

Permalink
fix memory
Browse files Browse the repository at this point in the history
  • Loading branch information
Mmasoud1 committed Feb 4, 2024
1 parent 73537b4 commit 2435c90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions js/brainchop/mainMeshNetFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4762,18 +4762,18 @@ function convByOutputChannelAndInputSlicing(input, filter, biases, stride, pad,
let timer = window.setInterval(async function() {

try {
// if (res.layers[i].activation.getClassName() !== 'linear') {
if (res.layers[i].activation.getClassName() !== 'linear') {
curTensor[i] = res.layers[i].apply( curTensor[i-1]);
// } else {

// curTensor[i] = convByOutputChannelAndInputSlicing(curTensor[i-1],
// res.layers[i].getWeights()[0],
// res.layers[i].getWeights()[1],
// res.layers[i].strides,
// res.layers[i].padding,
// res.layers[i].dilationRate,
// 3); // important for memory use
// }
} else {

curTensor[i] = convByOutputChannelAndInputSlicing(curTensor[i-1],
res.layers[i].getWeights()[0],
res.layers[i].getWeights()[1],
res.layers[i].strides,
res.layers[i].padding,
res.layers[i].dilationRate,
3); // important for memory use
}


// // Log memory usage
Expand Down
2 changes: 1 addition & 1 deletion js/brainchop/mainParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
enableCrop: true, // For speed-up inference, crop brain from background before feeding to inference model to lower memory use.
cropPadding: 2, // Padding size add to cropped brain
filterOutWithPreMask: false, // Can be used to multiply final output with premodel output mask to crean noisy areas
enableSeqConv: false, // For low memory system and low configuration, enable sequential convolution instead of last layer
enableSeqConv: true, // For low memory system and low configuration, enable sequential convolution instead of last layer
textureSize: 13585, // Requested Texture size for the model, if unknown can be 0.
warning: "This model may need dedicated graphics card. For more info please check with Browser Resources <i class='fa fa-cogs'></i>.",
inferenceDelay: 100, // Delay in ms time while looping layers applying.
Expand Down

0 comments on commit 2435c90

Please sign in to comment.