fixes bug in logging function

This commit is contained in:
Raphael Maenle 2021-08-06 13:34:46 +02:00
parent 4de74afcd1
commit f3d65241c5

View File

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