Skip to content

Commit

Permalink
feat: tools: images_size.py
Browse files Browse the repository at this point in the history
Estimate size of images (images.txt)
  • Loading branch information
yzqzss committed Sep 12, 2023
1 parent 3654492 commit ce17a94
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tools/images_size.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import argparse

def parse_args():
parser = argparse.ArgumentParser(description='Estimate size of images')
parser.add_argument('images_list', help='Path to images.txt')
args = parser.parse_args()
return args

if __name__ == '__main__':
arg = parse_args()
images_list = arg.images_list
size = 0
with open(images_list, 'r', encoding='utf-8') as f:
for line in f:
try:
size += int(line.strip().split('\t')[3])
except Exception:
pass
print(size // 1024 // 1024 // 1024, 'GB')

0 comments on commit ce17a94

Please sign in to comment.