Spaces:
Runtime error
Runtime error
| # -------------------------------------------------------- | |
| # Python Single Object Tracking Evaluation | |
| # Licensed under The MIT License [see LICENSE for details] | |
| # Written by Fangyi Zhang | |
| # @author fangyi.zhang@vipl.ict.ac.cn | |
| # @project https://github.com/StrangerZhang/pysot-toolkit.git | |
| # Revised for SiamMask by foolwood | |
| # -------------------------------------------------------- | |
| class Dataset(object): | |
| def __init__(self, name, dataset_root): | |
| self.name = name | |
| self.dataset_root = dataset_root | |
| self.videos = None | |
| def __getitem__(self, idx): | |
| if isinstance(idx, str): | |
| return self.videos[idx] | |
| elif isinstance(idx, int): | |
| return self.videos[sorted(list(self.videos.keys()))[idx]] | |
| def __len__(self): | |
| return len(self.videos) | |
| def __iter__(self): | |
| keys = sorted(list(self.videos.keys())) | |
| for key in keys: | |
| yield self.videos[key] | |
| def set_tracker(self, path, tracker_names): | |
| """ | |
| Args: | |
| path: path to tracker results, | |
| tracker_names: list of tracker name | |
| """ | |
| self.tracker_path = path | |
| self.tracker_names = tracker_names | |