vitrivr/cineast

Inefficient SkeletonPose TensorFlow model loading

Spiess opened this issue · 3 comments

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.

Even though the commit bfb6fb1 does not address this issue properly, @Spiess please have a look at this on the branch and report your findings with respect to speedup.

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.

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).