(self, tarDir = None, imgIds = [] )
Download COCO images from mscoco.org server.
        :param tarDir (str): COCO results directory name
               imgIds (list): images to be downloaded
        :return:
Download COCO images from mscoco.org server.
        :param tarDir (str): COCO results directory name
               imgIds (list): images to be downloaded
        :return:
Download COCO images from mscoco . org server . : param tarDir ( str ) : COCO results directory name imgIds ( list ) : images to be downloaded : return :
def download(self, tarDir = None, imgIds = [] ):
        '''
        Download COCO images from mscoco.org server.
        :param tarDir (str): COCO results directory name
               imgIds (list): images to be downloaded
        :return:
        '''
        if tarDir is None:
            print('Please specify target directory')
            return -1
        if len(imgIds) == 0:
            imgs = self.imgs.values()
        else:
            imgs = self.loadImgs(imgIds)
        N = len(imgs)
        if not os.path.exists(tarDir):
            os.makedirs(tarDir)
        for i, img in enumerate(imgs):
            tic = time.time()
            fname = os.path.join(tarDir, img['file_name'])
            if not os.path.exists(fname):
                urlretrieve(img['coco_url'], fname)
            print('downloaded {}/{} images (t={:0.1f}s)'.format(i, N, time.time()- tic))
def download ( self , tarDir = None , imgIds = [ ] ) : if tarDir is None : print ( 'Please specify target directory' ) return - 1 if len ( imgIds ) == 0 : imgs = self . imgs . values ( ) else : imgs = self . loadImgs ( imgIds ) N = len ( imgs ) if not os . path . exists ( tarDir ) : os . makedirs ( tarDir ) for i , img in enumerate ( imgs ) : tic = time . time ( ) fname = os . path . join ( tarDir , img [ 'file_name' ] ) if not os . path . exists ( fname ) : urlretrieve ( img [ 'coco_url' ] , fname ) print ( 'downloaded {}/{} images (t={:0.1f}s)' . format ( i , N , time . time ( ) - tic ) )