Skip to content

Commit

Permalink
Merge pull request #10 from georgw777/develop
Browse files Browse the repository at this point in the history
v1.0.1
  • Loading branch information
georg-wolflein authored Apr 27, 2021
2 parents accd9f5 + 639f4f0 commit df46952
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion chesscog/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.0"
__version__ = "1.0.1"
40 changes: 34 additions & 6 deletions chesscog/data_synthesis/download_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,42 @@

import functools
import argparse
import shutil
import os
import osfclient.cli
import typing
import zipfile
import tempfile
from pathlib import Path
from types import SimpleNamespace
from recap import URI
from logging import getLogger

from chesscog.core.io import download_zip_folder_from_google_drive

ensure_dataset = functools.partial(download_zip_folder_from_google_drive,
"1XClmGJwEWNcIkwaH0VLuvvAY3qk_CRJh",
"data://render")
logger = getLogger(__name__)

if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Download the rendered dataset.").parse_args()
ensure_dataset(show_size=True)

folder = URI("data://render")
with tempfile.TemporaryDirectory() as tmp:
logger.info("Downloading rendered dataset from OSF")
tmp = Path(tmp)
args = SimpleNamespace(project="xf3ka", output=str(tmp), username=None)
osfclient.cli.clone(args)
shutil.rmtree(folder, ignore_errors=True)
os.makedirs(folder.parent, exist_ok=True)
shutil.move(tmp / "osfstorage", folder)
logger.info("Merging train dataset")
try:
os.system(
f"zip -s 0 {folder / 'train.zip'} --out {folder / 'train_full.zip'}")
except Exception:
raise Exception(f"Please manually unpack the ZIP archives at {folder}")
for file in ("train.z01", "train.zip"):
(folder / file).unlink()
shutil.move(folder / "train_full.zip", folder / "train.zip")
for archive in ("train.zip", "val.zip", "test.zip"):
logger.info(f"Extracting {archive}")
with zipfile.ZipFile(folder / archive) as z:
z.extractall(folder)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"

[tool.poetry]
name = "chesscog"
version = "1.0.0"
version = "1.0.1"
description = "Recognise chess positions using computer vision."
authors = [ "Georg Wölflein <[email protected]>",]
include = [ "config/*.yaml", "config/**/_*.yaml",]
Expand Down

0 comments on commit df46952

Please sign in to comment.