def _keep_top_k_sorted(self):
        """sort the boxes based on score and keep top k
        """
        if len(self.scores) > self.top_k_scores:
            self.inds = np.argsort(np.array(self.scores).squeeze())[::-1][:self.top_k_scores]
            self.boxes_xyxy = [self.boxes_xyxy[ind] for ind in self.inds]
            self.scores = [self.scores[ind] for ind in self.inds]
sort the boxes based on score and keep top k
        
src/marqo/s2_inference/processing/image.py