Myosotis-Researches 0.1.24__py3-none-any.whl → 0.1.26__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  from .concat_image import concat_image
2
- from .view_dataset import view_dataset
2
+ from .dataset import view_dataset, download_datasets
@@ -0,0 +1,45 @@
1
+ import gdown
2
+ import getpass
3
+ import h5py
4
+ import os
5
+ import subprocess
6
+
7
+
8
+ # view_dataset
9
+ def _print_hdf5(name, obj):
10
+ indent = " " * name.count("/")
11
+ if isinstance(obj, h5py.Dataset):
12
+ print(f"{indent}[Dataset] {name} shape={obj.shape} dtype={obj.dtype}")
13
+ elif isinstance(obj, h5py.Group):
14
+ print(f"{indent}[Group] {name}")
15
+
16
+
17
+ def view_dataset(dataset_path):
18
+ with h5py.File(dataset_path, "r") as f:
19
+ f.visititems(_print_hdf5)
20
+
21
+
22
+ # download_datasets
23
+ _file_id_dict = {
24
+ "Ra": "1YVLFAaQ1ldre0ASLSRdV_kPIcAMkwGqO",
25
+ "MNIST": "18249ryrDPsznWWtOkJuALZWCVoZqfibC",
26
+ }
27
+
28
+
29
+ def download_datasets(datasets_name, datasets_dir):
30
+ if not os.path.exists(datasets_dir):
31
+ os.makedirs(datasets_dir, exist_ok=True)
32
+ zipped_datasets_path = os.path.join(datasets_dir, f"{datasets_name}.rar")
33
+ file_id = _file_id_dict[datasets_name]
34
+ url = f"https://drive.google.com/uc?id={file_id}"
35
+ gdown.download(url, zipped_datasets_path, quiet=False, use_cookies=False)
36
+ unzip_password = getpass.getpass("Please input the zipped file's password:")
37
+ try:
38
+ cmd = ["unrar", "x", f"-p{unzip_password}", zipped_datasets_path, datasets_dir]
39
+ subprocess.run(cmd, check=True)
40
+ except subprocess.CalledProcessError as e:
41
+ print(e)
42
+ os.remove(zipped_datasets_path)
43
+
44
+
45
+ __all__ = ["view_dataset", "download_datasets"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Myosotis-Researches
3
- Version: 0.1.24
3
+ Version: 0.1.26
4
4
  Summary: A repository for storing my progress of researches.
5
5
  Home-page: https://github.com/Zeyu-Xie/Myosotis-Researches
6
6
  Author: Zeyu Xie
@@ -26,11 +26,11 @@ myosotis_researches/CcGAN/train/train_ccgan.py,sha256=0Qxibgd2-WaYgbyYeeOyiMkdcw
26
26
  myosotis_researches/CcGAN/train/train_cgan.py,sha256=sxMzvlmdjmqufwJFxBwatcoJecYqn2Uidedu15CL9ws,9619
27
27
  myosotis_researches/CcGAN/train/train_cgan_concat.py,sha256=OrQbwdU_ujUeKFGixUUpnini6rURtbuHv9NDrP6g0X0,8861
28
28
  myosotis_researches/CcGAN/train/train_net_for_label_embed.py,sha256=4j6r4_o4rXgAN4MdUQL-TXqZJpbhH7d9gWQR8YzBlXw,6976
29
- myosotis_researches/CcGAN/utils/__init__.py,sha256=q13-OwYs-mkVz3qdJ2tNFktlulHNXx0BR13bY0rN1V0,78
29
+ myosotis_researches/CcGAN/utils/__init__.py,sha256=Y6HFAJRAOa4rMXhd1KIyr3NL_GzO0vjbp-dE4NT7QW8,92
30
30
  myosotis_researches/CcGAN/utils/concat_image.py,sha256=BIGKz52Inn9S7M5fBFKye2V9bLJ0DqEQILoOVWAXUiE,2165
31
- myosotis_researches/CcGAN/utils/view_dataset.py,sha256=BaAKII7BAItVhL--H5q88H9cUR7nSDTtAvV_uz6b6hs,415
32
- myosotis_researches-0.1.24.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
33
- myosotis_researches-0.1.24.dist-info/METADATA,sha256=s83HKvH4e0B4DbBXF1sUe6wHEg8N3PZbFmf5h4xaP6o,3484
34
- myosotis_researches-0.1.24.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
35
- myosotis_researches-0.1.24.dist-info/top_level.txt,sha256=zxAiMn5eyZNJM28MewTAkgi_RZJMbfWbzVR-KF0LdZE,20
36
- myosotis_researches-0.1.24.dist-info/RECORD,,
31
+ myosotis_researches/CcGAN/utils/dataset.py,sha256=wDe-fABslaLXOY5Kbmlm0mQ_8CPEK7Y2YkEy-XAiQHI,1363
32
+ myosotis_researches-0.1.26.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
33
+ myosotis_researches-0.1.26.dist-info/METADATA,sha256=yN5d9W51yJkKBOGW2VrFdBVQx5jSFMrkmai57ZuoqGM,3484
34
+ myosotis_researches-0.1.26.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
35
+ myosotis_researches-0.1.26.dist-info/top_level.txt,sha256=zxAiMn5eyZNJM28MewTAkgi_RZJMbfWbzVR-KF0LdZE,20
36
+ myosotis_researches-0.1.26.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- import h5py
2
-
3
-
4
- def _print_hdf5(name, obj):
5
- indent = " " * name.count("/")
6
- if isinstance(obj, h5py.Dataset):
7
- print(f"{indent}[Dataset] {name} shape={obj.shape} dtype={obj.dtype}")
8
- elif isinstance(obj, h5py.Group):
9
- print(f"{indent}[Group] {name}")
10
-
11
-
12
- def view_dataset(dataset_path):
13
- with h5py.File(dataset_path, "r") as f:
14
- f.visititems(_print_hdf5)
15
-
16
- __all__ = ["view_dataset"]