def _update_memory_with_dormant_track()

in siammot/modelling/track_head/track_head.py [0:0]


    def _update_memory_with_dormant_track(self, track_memory):
        cache = self.track_pool.get_cache()
        if not cache or track_memory is None:
            return track_memory

        dormant_caches = []
        for dormant_id in self.track_pool.get_dormant_ids():
            if dormant_id in cache:
                dormant_caches.append(cache[dormant_id])
        cached_features = [x[0][None, ...] for x in dormant_caches]
        if track_memory[0] is None:
            if track_memory[1][0] or track_memory[2][0]:
                raise Exception("Unexpected cache state")
            track_memory = [[]] * 3
            buffer_feat = []
        else:
            buffer_feat = [track_memory[0]]
        features = torch.cat(buffer_feat + cached_features)
        sr = cat_boxlist(track_memory[1] + [x[1] for x in dormant_caches])
        boxes = cat_boxlist(track_memory[2] + [x[2] for x in dormant_caches])
        return features, [sr], [boxes]