__all__ = []

from lib.exp.featx.base import Feats
from lib.exp.tools.slider import Slider
from lib.exp.tools.video import Video
from lib.exp.pre import Reducer


class Featx(Feats):
    def __init__(self, root, name):
        Feats.__init__(self, root, name)

    def get_slide_feats(self):
        ss = Slider(self.root, self.name)
        imgl = ss.get_slides(None, gray=True, resize=True)
        self.feats(imgl, prefix="s")

    def get_frame_feats(self):
        rr = Reducer(self.root, self.name)
        vv = Video(self.root, self.name)
        imgl = vv.get_frames(rr.frame_ids(), gray=True)
        self.feats(imgl, prefix="f")

    def get_feats_pair(self, sid, fid):
        """
        Get features by given `slide`, `frame` pairs
        """
        sk = self.load("s_{:03d}_kps".format(sid))
        sd = self.load("s_{:03d}_des".format(sid))
        fk = self.load("f_{:03d}_kps".format(fid))
        fd = self.load("f_{:03d}_des".format(fid))
        return dict(sk=sk, sd=sd, fk=fk, fd=fd)

@@ -629,24 +629,147 @@
 refix=%22f%22)%0A%0A
+    def load_feats(self, key):%0A        fd = self.load(key)%0A        if fd is None:%0A            return %5B%5D%0A        return fd%0A%0A
     def get_
@@ -887,32 +887,38 @@
   sk = self.load
+_feats
 (%22s_%7B:03d%7D_kps%22.
@@ -952,16 +952,22 @@
 elf.load
+_feats
 (%22s_%7B:03
@@ -1001,32 +1001,38 @@
   fk = self.load
+_feats
 (%22f_%7B:03d%7D_kps%22.
@@ -1066,16 +1066,22 @@
 elf.load
+_feats
 (%22f_%7B:03

Load feats with zero length