def _download(self, annFile): """ Utility function for downloading the COCO annotation file :param annFile: path of the annotations file :return: void - extracts the archive """ if not os.path.exists(annFile): if not os.path.isdir(annFile): if "2017" in annFile: annotations_dir_zip = os.path.join( self.root, "annotations_train%s2017.zip" % self.split ) elif "2014" in annFile: annotations_dir_zip = os.path.join( self.root, "annotations_train%s2014.zip" % self.split ) else: annotations_dir_zip = None if annotations_dir_zip is not None: print( "Attempt to extract annotations file at {zip_loc}".format( zip_loc=annotations_dir_zip ) ) extract_archive(from_path=annotations_dir_zip, to_path=self.root)
def _get_path(self, local_root, local_unzip=False): root = Path(change_root_if_server(root=local_root, server_root=".data/nlp/" + self.pwc_name.lower())) zip_name = self.pwc_name.lower() + "-v1.zip" dataset_path = root / "wiki.test.tokens" if not dataset_path.exists(): # unzip extract_archive(str(root / zip_name), to_path=root.parent) return dataset_path
def get_path(local_root, local_unzip=False): root = Path( change_root_if_server(root=local_root, server_root=".data/nlp/multinli")) zip_name = "MNLI.zip" dataset_path = root / "MNLI" / "dev_matched.tsv" if not dataset_path.exists(): # unzip extract_archive(str(root / zip_name), to_path=root) return (dataset_path, dataset_path.parent / "dev_mismatched.tsv")
def _download(self, annFile): if not os.path.isdir(annFile): if "2017" in annFile: annotations_dir_zip = os.path.join( self.root, "annotations_train%s2017.zip" % self.split) elif "2014" in annFile: annotations_dir_zip = os.path.join( self.root, "annotations_train%s2014.zip" % self.split) else: annotations_dir_zip = None if annotations_dir_zip is not None: print( 'Attempt to extract annotations file at {zip_loc}'.format( zip_loc=annotations_dir_zip)) extract_archive(from_path=annotations_dir_zip, to_path=self.root)
has_amp = True except ImportError: has_amp = False from sotabencheval.object_detection import COCOEvaluator from sotabencheval.utils import is_server, extract_archive from effdet import create_model from data import CocoDetection, create_loader NUM_GPU = 1 BATCH_SIZE = (128 if has_amp else 64) * NUM_GPU ANNO_SET = 'val2017' if is_server(): DATA_ROOT = './.data/vision/coco' image_dir_zip = os.path.join('./.data/vision/coco', f'{ANNO_SET}.zip') extract_archive(from_path=image_dir_zip, to_path='./.data/vision/coco') else: # local settings DATA_ROOT = '' def _bs(b=64): b *= NUM_GPU if has_amp: b *= 2 return b def _entry(model_name, paper_model_name, paper_arxiv_id, batch_size=BATCH_SIZE, model_desc=None): return dict( model_name=model_name,