Upload 2 files
Browse files
test_v2.0/fake_sampling_submission/create_fake_submission.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
import shutil
|
| 5 |
+
import zipfile
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
from PIL import Image
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def main() -> None:
|
| 13 |
+
num_images = 250
|
| 14 |
+
img_size = (512, 512)
|
| 15 |
+
temp_dir = Path("submission_temp")
|
| 16 |
+
zip_name = "submission.zip"
|
| 17 |
+
|
| 18 |
+
if temp_dir.exists():
|
| 19 |
+
shutil.rmtree(temp_dir)
|
| 20 |
+
temp_dir.mkdir()
|
| 21 |
+
|
| 22 |
+
for idx in range(num_images):
|
| 23 |
+
data = np.random.randint(0, 256, (*img_size[::-1], 3), dtype=np.uint8)
|
| 24 |
+
img = Image.fromarray(data, mode="RGB")
|
| 25 |
+
img.save(temp_dir / f"{idx}.png")
|
| 26 |
+
|
| 27 |
+
readme_content = """{
|
| 28 |
+
"method": "example_method",
|
| 29 |
+
"team": "demo_team",
|
| 30 |
+
"authors": "example_author",
|
| 31 |
+
"e-mail": "N/A",
|
| 32 |
+
"institution": "example_institution",
|
| 33 |
+
"country": "example_country"
|
| 34 |
+
}
|
| 35 |
+
"""
|
| 36 |
+
(temp_dir / "README.txt").write_text(readme_content, encoding="utf-8")
|
| 37 |
+
|
| 38 |
+
if Path(zip_name).exists():
|
| 39 |
+
Path(zip_name).unlink() # overwrite any old file
|
| 40 |
+
|
| 41 |
+
with zipfile.ZipFile(zip_name, "w", zipfile.ZIP_DEFLATED) as zf:
|
| 42 |
+
for file_path in temp_dir.iterdir():
|
| 43 |
+
zf.write(file_path, arcname=file_path.name)
|
| 44 |
+
|
| 45 |
+
shutil.rmtree(temp_dir)
|
| 46 |
+
print(f"Created {zip_name} containing {num_images} PNGs and README.txt")
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if __name__ == "__main__":
|
| 50 |
+
main()
|
| 51 |
+
|
test_v2.0/fake_sampling_submission/submission.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:22a47c0c7e8b253c5547c67dfa3cb6c1475784ad9696abc100dbb4ea6ac356cf
|
| 3 |
+
size 197104889
|