Skip to content

Unnecessarily loading file contents of pairs.txt into memory lfw_eval.py #63

Open
@sayandipdutta

Description

@sayandipdutta

In lfw_eval.py, the contents of pairs.txt is being loaded into memory, even though it is not used for anything other than iterating over the lines. It will be easier and more memory efficient to iterate over the file object itself.

with open('data/pairs.txt') as f:
    pairs_lines = f.readlines()[1:]

Which will also avoid the __getitem__ call in line 91, making the code more efficient.

for i in range(6000):
    p = pairs_lines[i].replace('\n','').split('\t')

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