Inefficient SkeletonPose TensorFlow model loading
Spiess opened this issue · 3 comments
Spiess commented
Models used for pose detection in images are loaded every time a SkeletonPose
class is instantiated, even for similarity queries not using pose extraction.
The following steps should be taken to avoid this:
- The model should be loaded lazily right before being used.
- The model should persist between instances of
SkeletonPose
.
sauterl commented
Spiess commented
Do you know if it is necessary to use thread-level caching?
The example you are referencing only uses OpenCV functions and models, if I understand correctly, and there this might be necessary, but for TensorFlow models this may even cause problems depending on if the default session is global or thread local.
lucaro commented
Yes, in this case, it might make sense to explicitly avoid parallelism since tensorflow already uses all compute resources it can get (at least in CPU mode).