Closed ma3252788 closed 2 years ago
We embed the width and height info in the annotation file. You may try the following script to do this.
import json
from tqdm import tqdm
from PIL import Image
src = '/data/datasets/crowdhuman/annotation_val.odgt'
dst = '/data/datasets/crowdhuman/annotation_val_hw.odgt'
img_path = '/data/datasets/crowdhuman/train_image/'
with open(src, 'r') as f:
lines = f.readlines()
with open(dst, 'w') as f:
for line in tqdm(lines):
record = json.loads(line)
file_path = img_path + '{}.jpg'.format(record['ID'])
im = Image.open(file_path)
record['width'], record['height'] = im.size
f.write(json.dumps(record) + "\n")
Sorry for the inconvenience.
Hello, thank you very much for your work. I first trained for 2 epochs, then started the test, and the result reported an error:
I followed the instructions completely, but why did it report an error?