Update README.md
Browse files
README.md
CHANGED
|
@@ -112,19 +112,23 @@ Example:
|
|
| 112 |
These parts correspond to a single original archive. You can merge them into a single folder using Python:
|
| 113 |
|
| 114 |
```python
|
| 115 |
-
import zipfile
|
| 116 |
from pathlib import Path
|
| 117 |
|
| 118 |
sequence_dir = Path("SynLiDAR/FullDataset/sequences")
|
| 119 |
-
|
|
|
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
|
|
|
| 123 |
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
| 128 |
```
|
| 129 |
|
| 130 |
|
|
|
|
| 112 |
These parts correspond to a single original archive. You can merge them into a single folder using Python:
|
| 113 |
|
| 114 |
```python
|
|
|
|
| 115 |
from pathlib import Path
|
| 116 |
|
| 117 |
sequence_dir = Path("SynLiDAR/FullDataset/sequences")
|
| 118 |
+
# find bases that have part files
|
| 119 |
+
bases = sorted({p.stem.split("_part")[0] for p in sequence_dir.glob("*_part*.zip")})
|
| 120 |
|
| 121 |
+
for base in bases:
|
| 122 |
+
parts = sorted(sequence_dir.glob(f"{base}_part*.zip"))
|
| 123 |
+
output_zip = sequence_dir / f"{base}.zip"
|
| 124 |
|
| 125 |
+
print(f"[{base}] merging {len(parts)} parts -> {output_zip}")
|
| 126 |
+
with open(output_zip, "wb") as out:
|
| 127 |
+
for p in parts:
|
| 128 |
+
with open(p, "rb") as f:
|
| 129 |
+
out.write(f.read())
|
| 130 |
+
|
| 131 |
+
print("All sequences merged.")
|
| 132 |
```
|
| 133 |
|
| 134 |
|