(self)
extract and resize images then write manifest files to disk.
extract and resize images then write manifest files to disk.
extract and resize images then write manifest files to disk .
def run(self):
        """
        extract and resize images then write manifest files to disk.
        """
        cfg_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'train.cfg')
        log_file = os.path.join(self.orig_out_dir, 'train.log')
        manifest_list_cfg = ', '.join([k+':'+v for k, v in self.manifests.items()])

        with open(cfg_file, 'w') as f:
            f.write('manifest = [{}]\n'.format(manifest_list_cfg))
            f.write('manifest_root = {}\n'.format(self.out_dir))
            f.write('log = {}\n'.format(log_file))
            f.write('epochs = 90\nrng_seed = 0\nverbose = True\neval_freq = 1\n')

        if (all([os.path.exists(manifest) for manifest in self.manifests.values()])
                and not self.overwrite):
            print("Found manfiest files, skipping ingest, use --overwrite to overwrite them.")
            return

        for setn, manifest in self.manifests.items():
            pairs = self.train_or_val_pairs(setn)
            records = [(os.path.relpath(fname, self.out_dir), int(tgt))
                       for fname, tgt in pairs]
            records.insert(0, ('@FILE', 'STRING'))
            np.savetxt(manifest, records, fmt='%s\t%s')
def run ( self ) : cfg_file = os . path . join ( os . path . dirname ( os . path . realpath ( __file__ ) ) , 'train.cfg' ) log_file = os . path . join ( self . orig_out_dir , 'train.log' ) manifest_list_cfg = ', ' . join ( [ k + ':' + v for k , v in self . manifests . items ( ) ] ) with open ( cfg_file , 'w' ) as f : f . write ( 'manifest = [{}]\n' . format ( manifest_list_cfg ) ) f . write ( 'manifest_root = {}\n' . format ( self . out_dir ) ) f . write ( 'log = {}\n' . format ( log_file ) ) f . write ( 'epochs = 90\nrng_seed = 0\nverbose = True\neval_freq = 1\n' ) if ( all ( [ os . path . exists ( manifest ) for manifest in self . manifests . values ( ) ] ) and not self . overwrite ) : print ( "Found manfiest files, skipping ingest, use --overwrite to overwrite them." ) return for setn , manifest in self . manifests . items ( ) : pairs = self . train_or_val_pairs ( setn ) records = [ ( os . path . relpath ( fname , self . out_dir ) , int ( tgt ) ) for fname , tgt in pairs ] records . insert ( 0 , ( '@FILE' , 'STRING' ) ) np . savetxt ( manifest , records , fmt = '%s\t%s' )