I run a Keypoints detection model using tfjs and then post process it (still using tfjs). Then I use dataSync() on the final tensor in order to process it using JS. The dataSync() takes about 4 times more than the inference + post-processing time. I guess that it happens because dataSync() pulls the data from the GPU. Is there a way to make this process faster? Here's the code that I am using:
let output = model.execute(input_image_tensor);
let kpts = postProcess(output);
renderKpts(kpts.dataSync());
Thank you.