diff --git a/fetchCOCO.py b/fetchCOCO.py index ca4188c..01d30b7 100644 --- a/fetchCOCO.py +++ b/fetchCOCO.py @@ -67,7 +67,7 @@ def fetchCategory(category, destination): os.makedirs(destination) for image_index, (image_id, anns) in enumerate(imageAnns.items()): - if (image_index % 1000 == 0): + if (image_index % 5000 == 0): print(f"Processing image {image_index} of {len(images)}...") # get all objects matching category out of the image and crop each of them to their bbox. # Saved each to different image. diff --git a/fetchImages.py b/fetchImages.py index 2ee4e8a..fdeb612 100644 --- a/fetchImages.py +++ b/fetchImages.py @@ -4,21 +4,23 @@ import fetchPersonal as Personal import fetchVisualGenome as VisualGenome -usage = "fetch.py category destination\n" +usage = "fetch.py destination categories...\n" if __name__ == '__main__': args = sys.argv[1:] - if (len(args) != 2): + if (len(args) < 2): print(usage) sys.exit() - category = args[0] - destination = args[1].rstrip("/") + destination = args[0].rstrip("/") + categories = args[1:] - COCO.fetchCategory(category, destination) - OpenImages.fetchCategory(category, destination) - Personal.fetchCategory(category, destination) - VisualGenome.fetchCategory(category, destination) + for category in categories: + COCO.fetchCategory(category, destination) + OpenImages.fetchCategory(category, destination) + Personal.fetchCategory(category, destination) + VisualGenome.fetchCategory(category, destination) + print("\n") - print(f"DONE! All images of {category} in all databases saved to {destination}") \ No newline at end of file + print(f"DONE! All images of {', '.join(categories)} in all databases saved to {destination}") \ No newline at end of file diff --git a/fetchOpenImages.py b/fetchOpenImages.py index 4e25d25..554cff0 100644 --- a/fetchOpenImages.py +++ b/fetchOpenImages.py @@ -114,7 +114,7 @@ def fetchCategory(category, destination): category = getCategories()[category.lower()] for batchIndex, batch in enumerate( batchImagesForCategory(category, batchSize=8) ): - if (batchIndex % 5 == 0): + if (batchIndex % 10 == 0): print(f"Processing batch {batchIndex}") options = "--no-sign-request --only-show-errors" command = [ diff --git a/fetchVisualGenome.py b/fetchVisualGenome.py index 61173e8..0d6fc75 100644 --- a/fetchVisualGenome.py +++ b/fetchVisualGenome.py @@ -20,7 +20,7 @@ def fetchCategory(category, destination): # queryResults will be a map of imageId : region Containing the largest region in each image that matches category # and is at least half targetDiminsions for imageIndex, img in enumerate(imageObjects): - if (imageIndex % 1000 == 0): + if (imageIndex % 5000 == 0): print(f"Processing image {imageIndex} of {len(imageObjects)}...") largest = None for obj in img['objects']: