Skip to content

About tokenizing test-split captions on own dataset #31

@gitraffica

Description

@gitraffica

In preprocess/tokenize_captions.py,

def load_annotations(coco_dir):
    with open(os.path.join(coco_dir, 'annotations', f'captions_train2014.json')) as f:
        annotations = json.load(f)['annotations']

    with open(os.path.join(coco_dir, 'annotations', f'captions_val2014.json')) as f:
        annotations.extend(json.load(f)['annotations'])

    return annotations

It seems that this code was not loading test2014. To avoid this problem, I would like you to modify this code into

def load_annotations(coco_dir):
    with open(os.path.join(coco_dir, 'annotations', f'captions_train2014.json')) as f:
        annotations = json.load(f)['annotations']

    with open(os.path.join(coco_dir, 'annotations', f'captions_val2014.json')) as f:
        annotations.extend(json.load(f)['annotations'])
    
    with open(os.path.join(coco_dir, 'annotations', f'captions_test2014.json')) as f:
        annotations.extend(json.load(f)['annotations'])

    return annotations

which took me 2 days to figure out this problem, before which hasn't I walked out of suspecting my dataset problem yet:C

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions