diff --git a/coco_gen.py b/coco_gen.py index bb473e1..a9729c0 100644 --- a/coco_gen.py +++ b/coco_gen.py @@ -4,14 +4,13 @@ import numpy as np from PIL import Image - no_label = 0 small = 0 passed = 0 - count = 0 + print("loading coco annotations...") coco = json.load(open('./coco/annotations/instances_val2014.json')) print("done") @@ -36,6 +35,7 @@ def show(pil, pause=0.2): def parseImage(coImg): + global no_label, small, passed, coco # open image file path = "coco/val2014/" + coImg['file_name'] @@ -62,13 +62,14 @@ def parseImage(coImg): passed += 1 if __name__ == "__main__": + for coImg in coco['images']: parseImage(coImg) count += 1 if count % 100 == 0: print("status:") print(f"no labels: {no_label}") - print(f"to small: {small") + print(f"to small: {small}") print(f"passed: {passed}") print("-----")