Verifies that the correct dataset is downloaded; downloads if it isn't and ``download=True``. :raises: FileNotFoundError if the subset sequence, annotation or root folder is missing.
(self)
| 191 | ) |
| 192 | |
| 193 | def _check_directories(self): |
| 194 | # language=rst |
| 195 | """ |
| 196 | Verifies that the correct dataset is downloaded; downloads if it isn't and |
| 197 | ``download=True``. |
| 198 | |
| 199 | :raises: FileNotFoundError if the subset sequence, annotation or root folder is |
| 200 | missing. |
| 201 | """ |
| 202 | if not os.path.exists(self.root): |
| 203 | if self.download: |
| 204 | self._download() |
| 205 | else: |
| 206 | raise FileNotFoundError( |
| 207 | "DAVIS not found in the specified directory, download it from " |
| 208 | f"{self.DATASET_WEB} or add download=True to your call" |
| 209 | ) |
| 210 | if not os.path.exists(os.path.join(self.imagesets_path, f"{self.subset}.txt")): |
| 211 | raise FileNotFoundError( |
| 212 | f"Subset sequences list for {self.subset} not found, download the " |
| 213 | f"missing subset for the {self.task} task from {self.DATASET_WEB}" |
| 214 | ) |
| 215 | if self.subset in ["train", "val"] and not os.path.exists(self.mask_path): |
| 216 | raise FileNotFoundError( |
| 217 | f"Annotations folder for the {self.task} task not found, " |
| 218 | f"download it from {self.DATASET_WEB}" |
| 219 | ) |
| 220 | if self.converted: |
| 221 | if not os.path.exists(self.converted_img_path): |
| 222 | self._convert_sequences() |
| 223 | self.img_path = self.converted_img_path |
| 224 | self.mask_path = self.converted_mask_path |
| 225 | self.imagesets_path = self.converted_imagesets_path |
| 226 | |
| 227 | def get_frames(self, sequence): |
| 228 | for img, msk in zip( |
no test coverage detected