Uses .tar instead of .tar.gz now.
Browse files- compress.py +2 -2
- compressed/{chunk_0.tar.gz → chunk_0.tar} +2 -2
- compressed/{chunk_1.tar.gz → chunk_1.tar} +2 -2
- compressed/{chunk_2.tar.gz → chunk_2.tar} +2 -2
- compressed/{chunk_3.tar.gz → chunk_3.tar} +2 -2
- compressed/chunk_4.tar +3 -0
- compressed/chunk_4.tar.gz +0 -3
- compressed/chunk_5.tar +3 -0
- compressed/chunk_5.tar.gz +0 -3
- compressed/chunk_6.tar +3 -0
- compressed/chunk_6.tar.gz +0 -3
- compressed/chunk_7.tar +3 -0
- compressed/chunk_7.tar.gz +0 -3
- compressed/chunk_8.tar +3 -0
- compressed/chunk_8.tar.gz +0 -3
- compressed/chunk_9.tar +3 -0
- compressed/chunk_9.tar.gz +0 -3
- decompress.py +5 -5
compress.py
CHANGED
@@ -8,7 +8,7 @@ IMAGE_DIR = "images"
|
|
8 |
COMPRESSED_DIR = "compressed"
|
9 |
|
10 |
def compress_chunk(chunk, chunk_index):
|
11 |
-
with tarfile.open(os.path.join(COMPRESSED_DIR, f"chunk_{chunk_index}.tar
|
12 |
for image_path in chunk:
|
13 |
tags_path = os.path.splitext(image_path)[0] + ".txt"
|
14 |
if not os.path.isfile(tags_path):
|
@@ -17,7 +17,7 @@ def compress_chunk(chunk, chunk_index):
|
|
17 |
tar.add(tags_path, arcname=os.path.basename(tags_path))
|
18 |
|
19 |
def parse_args():
|
20 |
-
parser = argparse.ArgumentParser(description="
|
21 |
parser.add_argument("num_images_per_chunk", nargs=argparse.REMAINDER, help="Number of images per chunk, default to 1024")
|
22 |
args = parser.parse_args()
|
23 |
if not args.num_images_per_chunk:
|
|
|
8 |
COMPRESSED_DIR = "compressed"
|
9 |
|
10 |
def compress_chunk(chunk, chunk_index):
|
11 |
+
with tarfile.open(os.path.join(COMPRESSED_DIR, f"chunk_{chunk_index}.tar"), "w") as tar:
|
12 |
for image_path in chunk:
|
13 |
tags_path = os.path.splitext(image_path)[0] + ".txt"
|
14 |
if not os.path.isfile(tags_path):
|
|
|
17 |
tar.add(tags_path, arcname=os.path.basename(tags_path))
|
18 |
|
19 |
def parse_args():
|
20 |
+
parser = argparse.ArgumentParser(description="Group images into uncompressed tar files.")
|
21 |
parser.add_argument("num_images_per_chunk", nargs=argparse.REMAINDER, help="Number of images per chunk, default to 1024")
|
22 |
args = parser.parse_args()
|
23 |
if not args.num_images_per_chunk:
|
compressed/{chunk_0.tar.gz → chunk_0.tar}
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1dc29f8a67906beb16649582e80f5bda288797a910f917a83cee491c7bf85786
|
3 |
+
size 6587371520
|
compressed/{chunk_1.tar.gz → chunk_1.tar}
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:14daecd387628bbab48834f055faeb75c272ea46f658fa3036a21759b3febb34
|
3 |
+
size 6350704640
|
compressed/{chunk_2.tar.gz → chunk_2.tar}
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fcd9cc36741c4088bc31ec898125fc09ed363ddff9dc7f8d31853fc4e75a2cd8
|
3 |
+
size 6641674240
|
compressed/{chunk_3.tar.gz → chunk_3.tar}
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:af4d8223ef9a2d4238c2fdda462c9776fb911d8642fef0185432d8ecddffd23f
|
3 |
+
size 7292692480
|
compressed/chunk_4.tar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:90d4704963e77d5ea449e6758ccb5785062c640ad56ccbde0b2b6592ada0e0ba
|
3 |
+
size 6506782720
|
compressed/chunk_4.tar.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:5f04415b1e4a8cacded40b17920330c4d0757b798129860fb0f8047a4030ca09
|
3 |
-
size 6457710727
|
|
|
|
|
|
|
|
compressed/chunk_5.tar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f56f724c24dffea6cba505db03346356a25ae3b3221be414aa18043a458c14c6
|
3 |
+
size 7095900160
|
compressed/chunk_5.tar.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:274b3422c434169f30a07f1424b8083895849546ed82fb7108ff8de6d7269b0b
|
3 |
-
size 7044618031
|
|
|
|
|
|
|
|
compressed/chunk_6.tar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6bd416ec64f767647b859cc9f6855a07caf7f18e4479c14150e57f5556db70b7
|
3 |
+
size 6931691520
|
compressed/chunk_6.tar.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:81e37b08ccfde371666a2ee8ad5cabd75e32f03a446006227d1417c5fabdf3bb
|
3 |
-
size 6876412339
|
|
|
|
|
|
|
|
compressed/chunk_7.tar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:38233aaa3a05a577728a3957492512680fbdb3525e4a9fa13df7d4d9cb177cee
|
3 |
+
size 7031726080
|
compressed/chunk_7.tar.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:e204f4cd38b02fde1c0901394fb07860da78cb8ffada00827b86cd980a22489b
|
3 |
-
size 6981906967
|
|
|
|
|
|
|
|
compressed/chunk_8.tar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d23a580dd2bc23b87e13798841a39615411bef541e11ace1bb2a2822195256ef
|
3 |
+
size 3574056960
|
compressed/chunk_8.tar.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:422ea225d1490139d04185edbd906307d56a3b83bc851b4d13cd2f066d160898
|
3 |
-
size 3530250109
|
|
|
|
|
|
|
|
compressed/chunk_9.tar
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:221ba7dd42b5ba778ab05abdc15d81c04733bed842404c9fb27b380d1fdf0799
|
3 |
+
size 3041423360
|
compressed/chunk_9.tar.gz
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:520e1c25dba7198c8cb3dbd8694b18b309879ec100036a0338cdbb4ff777fd8b
|
3 |
-
size 3009101474
|
|
|
|
|
|
|
|
decompress.py
CHANGED
@@ -8,13 +8,13 @@ IMAGE_DIR = "images"
|
|
8 |
COMPRESSED_DIR = "compressed"
|
9 |
|
10 |
def decompress_chunk(chunk_file, output_dir):
|
11 |
-
with tarfile.open(chunk_file, "r
|
12 |
tar.extractall(path=output_dir)
|
13 |
|
14 |
def parse_args():
|
15 |
-
parser = argparse.ArgumentParser(description="
|
16 |
-
parser.add_argument("-i", "--input-dir", default=COMPRESSED_DIR, help="Input directory containing
|
17 |
-
parser.add_argument("-o", "--output-dir", default=IMAGE_DIR, help="Output directory for
|
18 |
args = parser.parse_args()
|
19 |
return args
|
20 |
|
@@ -23,7 +23,7 @@ def main():
|
|
23 |
if not os.path.exists(args.input_dir):
|
24 |
print(f"Input directory \"{args.input_dir}\" does not exist.")
|
25 |
sys.exit(1)
|
26 |
-
chunk_files = [os.path.join(args.input_dir, f) for f in os.listdir(args.input_dir) if f.endswith(".tar
|
27 |
os.makedirs(args.output_dir, exist_ok=True)
|
28 |
with concurrent.futures.ThreadPoolExecutor(max_workers=os.cpu_count()) as executor:
|
29 |
futures = []
|
|
|
8 |
COMPRESSED_DIR = "compressed"
|
9 |
|
10 |
def decompress_chunk(chunk_file, output_dir):
|
11 |
+
with tarfile.open(chunk_file, "r") as tar:
|
12 |
tar.extractall(path=output_dir)
|
13 |
|
14 |
def parse_args():
|
15 |
+
parser = argparse.ArgumentParser(description="Extract files from chunked tar archives.")
|
16 |
+
parser.add_argument("-i", "--input-dir", default=COMPRESSED_DIR, help="Input directory containing tar chunks")
|
17 |
+
parser.add_argument("-o", "--output-dir", default=IMAGE_DIR, help="Output directory for extracted files")
|
18 |
args = parser.parse_args()
|
19 |
return args
|
20 |
|
|
|
23 |
if not os.path.exists(args.input_dir):
|
24 |
print(f"Input directory \"{args.input_dir}\" does not exist.")
|
25 |
sys.exit(1)
|
26 |
+
chunk_files = [os.path.join(args.input_dir, f) for f in os.listdir(args.input_dir) if f.endswith(".tar")]
|
27 |
os.makedirs(args.output_dir, exist_ok=True)
|
28 |
with concurrent.futures.ThreadPoolExecutor(max_workers=os.cpu_count()) as executor:
|
29 |
futures = []
|