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')
In
lfw_eval.py
, the contents ofpairs.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.Which will also avoid the
__getitem__
call in line 91, making the code more efficient.