dataset/pascal_voc.py
def prepare_pascal_voc(data_dir=DEFAULT_DATA_DIR,
                       out_dir=DEFAULT_RECORD_DIR,
                       force=False):
  """ Downloads and extracts pascal voc and its annotation data. """
  print("Warning: This dataset was for testing only. It probably won't work anymore.")

  if not os.path.exists(data_dir):
    os.makedirs(data_dir)
  if not os.path.exists(out_dir):
    os.makedirs(out_dir)

  train_record = 'train.record'
  val_record = 'val.record'

  if not (os.path.exists(os.path.join(data_dir, train_record)) and
            os.path.exists(os.path.join(data_dir, val_record))) \
      or force:
    maybe_download(DATA_URL, data_dir, force=force)
    maybe_download(DATA_URL_AUG, data_dir, force=force)
    aug_target_dir = os.path.join(data_dir, DATA_EXTRACTED_DIR,
                                  DATA_AUG_EXTRACTED_DIR)
    if not os.path.exists(aug_target_dir):
      os.rename(os.path.join(data_dir, DATA_AUG_EXTRACTED_DIR), aug_target_dir)

    train_writer = tf.python_io.TFRecordWriter(
      os.path.join(out_dir, train_record))
    for data in get_label_map_dict(
        os.path.join(data_dir, DATA_EXTRACTED_DIR),
        os.path.join('dataset', 'voc_lists', 'train.txt')):
      example = dict_to_example(data)
      train_writer.write(example.SerializeToString())
    train_writer.close()

    val_writer = tf.python_io.TFRecordWriter(os.path.join(out_dir, val_record))
    for data in get_label_map_dict(
        os.path.join(data_dir, DATA_EXTRACTED_DIR),
        os.path.join('dataset', 'voc_lists', 'val.txt')):
      example = dict_to_example(data)
      val_writer.write(example.SerializeToString())
      val_writer.close()
 Downloads and extracts pascal voc and its annotation data. 
Downloads and extracts pascal voc and its annotation data.
Downloads and extracts pascal voc and its annotation data .
def prepare_pascal_voc(data_dir=DEFAULT_DATA_DIR,
                       out_dir=DEFAULT_RECORD_DIR,
                       force=False):
  print("Warning: This dataset was for testing only. It probably won't work anymore.")
  if not os.path.exists(data_dir):
    os.makedirs(data_dir)
  if not os.path.exists(out_dir):
    os.makedirs(out_dir)
  train_record = 'train.record'
  val_record = 'val.record'
  if not (os.path.exists(os.path.join(data_dir, train_record)) and
            os.path.exists(os.path.join(data_dir, val_record))) \
      or force:
    maybe_download(DATA_URL, data_dir, force=force)
    maybe_download(DATA_URL_AUG, data_dir, force=force)
    aug_target_dir = os.path.join(data_dir, DATA_EXTRACTED_DIR,
                                  DATA_AUG_EXTRACTED_DIR)
    if not os.path.exists(aug_target_dir):
      os.rename(os.path.join(data_dir, DATA_AUG_EXTRACTED_DIR), aug_target_dir)
    train_writer = tf.python_io.TFRecordWriter(
      os.path.join(out_dir, train_record))
    for data in get_label_map_dict(
        os.path.join(data_dir, DATA_EXTRACTED_DIR),
        os.path.join('dataset', 'voc_lists', 'train.txt')):
      example = dict_to_example(data)
      train_writer.write(example.SerializeToString())
    train_writer.close()
    val_writer = tf.python_io.TFRecordWriter(os.path.join(out_dir, val_record))
    for data in get_label_map_dict(
        os.path.join(data_dir, DATA_EXTRACTED_DIR),
        os.path.join('dataset', 'voc_lists', 'val.txt')):
      example = dict_to_example(data)
      val_writer.write(example.SerializeToString())
      val_writer.close()
def prepare_pascal_voc ( data_dir = DEFAULT_DATA_DIR , out_dir = DEFAULT_RECORD_DIR , force = False ) : print ( "Warning: This dataset was for testing only. It probably won't work anymore." ) if not os . path . exists ( data_dir ) : os . makedirs ( data_dir ) if not os . path . exists ( out_dir ) : os . makedirs ( out_dir ) train_record = 'train.record' val_record = 'val.record' if not ( os . path . exists ( os . path . join ( data_dir , train_record ) ) and os . path . exists ( os . path . join ( data_dir , val_record ) ) ) or force : maybe_download ( DATA_URL , data_dir , force = force ) maybe_download ( DATA_URL_AUG , data_dir , force = force ) aug_target_dir = os . path . join ( data_dir , DATA_EXTRACTED_DIR , DATA_AUG_EXTRACTED_DIR ) if not os . path . exists ( aug_target_dir ) : os . rename ( os . path . join ( data_dir , DATA_AUG_EXTRACTED_DIR ) , aug_target_dir ) train_writer = tf . python_io . TFRecordWriter ( os . path . join ( out_dir , train_record ) ) for data in get_label_map_dict ( os . path . join ( data_dir , DATA_EXTRACTED_DIR ) , os . path . join ( 'dataset' , 'voc_lists' , 'train.txt' ) ) : example = dict_to_example ( data ) train_writer . write ( example . SerializeToString ( ) ) train_writer . close ( ) val_writer = tf . python_io . TFRecordWriter ( os . path . join ( out_dir , val_record ) ) for data in get_label_map_dict ( os . path . join ( data_dir , DATA_EXTRACTED_DIR ) , os . path . join ( 'dataset' , 'voc_lists' , 'val.txt' ) ) : example = dict_to_example ( data ) val_writer . write ( example . SerializeToString ( ) ) val_writer . close ( )
Downloads and extracts pascal voc and its annotation data.
Downloads and extracts pascal voc and its annotation data .
""" Downloads and extracts pascal voc and its annotation data. """
data_dir
out_dir
force