Esempio n. 1
0
  def generate(self, archives):
    batch = Batch()
    batches = set()
    for path in utils.insensitive_glob(self.path):
      batch = batch.add(path)
      batches.add(batch)
    for batch in batches:
			archives.add(Archive(self, self.top, batch.paths))
Esempio n. 2
0
def copy_2_destination(source):
    global counter
    img_directory = os.path.join(source, 'images/')
    ann_directory = os.path.join(source, 'annotations/')

    for filename in u.insensitive_glob(img_directory + '*.jpg'):
        img_name = os.path.split(filename.split('.')[0])[-1]
        new_img_name = img_name.split('_')[0]

        shutil.copy2(
            os.path.join(img_directory, img_name + '.jpg'),
            os.path.join(dest_img_directory,
                         new_img_name + '_' + str(counter) + '.jpg'))

        xml_target = os.path.join(dest_ann_directory,
                                  new_img_name + '_' + str(counter) + '.xml')
        shutil.copy2(os.path.join(ann_directory, img_name + '.xml'),
                     xml_target)

        parser.fix_image_name_in_ann(
            xml_target, new_img_name + '_' + str(counter) + '.jpg')

        print(counter)
        counter += 1
Esempio n. 3
0
 def generate(self, archives):
   for path in utils.insensitive_glob(self.path):
     if not archives.includes(path):
       archives.add(Archive(self, self.top, [path]))