Skip to content

Commit

Permalink
Use LRU cache for shape transformation
Browse files Browse the repository at this point in the history
Only cache transform if shapes are actually the same
  • Loading branch information
mdraw committed Jul 4, 2023
1 parent 814e6a2 commit 7082b35
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deface/centerface.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
import os

from functools import lru_cache

import numpy as np
import cv2

Expand Down Expand Up @@ -121,6 +122,7 @@ def __call__(self, img, threshold=0.5):
return dets, lms

@staticmethod
@lru_cache(maxsize=128)
def shape_transform(in_shape, orig_shape):
h_orig, w_orig = orig_shape
w_new, h_new = in_shape
Expand Down

0 comments on commit 7082b35

Please sign in to comment.