From 79b88cf18189a4895b6ac5c739c4f5beb8201158 Mon Sep 17 00:00:00 2001 From: Benteng Ma Date: Wed, 3 Jul 2024 19:49:16 +0100 Subject: [PATCH] Preload the bodipix model so that hopefully now it's quicker. --- .../lasr_vision_bodypix/src/lasr_vision_bodypix/bodypix.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/vision/lasr_vision_bodypix/src/lasr_vision_bodypix/bodypix.py b/common/vision/lasr_vision_bodypix/src/lasr_vision_bodypix/bodypix.py index a490f83db..246443b0e 100644 --- a/common/vision/lasr_vision_bodypix/src/lasr_vision_bodypix/bodypix.py +++ b/common/vision/lasr_vision_bodypix/src/lasr_vision_bodypix/bodypix.py @@ -23,7 +23,11 @@ import rospkg # model cache -loaded_models = {} +# preload resnet 50 model so that it won't waste the time +# doing that in the middle of the task. +loaded_models = { + "resnet50": load_model(BodyPixModelPaths.RESNET50_FLOAT_STRIDE_16) +} r = rospkg.RosPack()