Myosotis-Researches 0.0.29__py3-none-any.whl → 0.0.31__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.
@@ -3,11 +3,13 @@ import os
3
3
 
4
4
  datasets_dir = resources.files("myosotis_researches").joinpath("CcGAN", "datasets")
5
5
 
6
+
6
7
  def show_datasets():
7
8
 
8
- datasets = []
9
+ if not os.path.exists(datasets_dir):
10
+ os.makedirs(datasets_dir, exist_ok=True)
9
11
 
12
+ datasets = []
10
13
  for item in os.listdir(datasets_dir):
11
14
  datasets.append(item)
12
-
13
- print("\n".join(datasets))
15
+ print("\n".join(datasets))
@@ -1,6 +1,5 @@
1
1
  from .print_hdf5_structure import print_hdf5_structure
2
- from .concat_image_horizontal import concat_image_horizontal
3
- from .concat_image_vertical import concat_image_vertical
2
+ from .concat_image import concat_image
4
3
  from .make_h5 import make_h5
5
4
 
6
- __all__ = ["print_hdf5_structure", "concat_image_horizontal", "concat_image_vertical", "make_h5"]
5
+ __all__ = ["print_hdf5_structure", "concat_image", "make_h5"]
@@ -0,0 +1,72 @@
1
+ from PIL import Image
2
+
3
+
4
+ def _concat_image_horizontal(img_list: list[Image], gap=2) -> Image:
5
+ N = len(img_list)
6
+
7
+ # Error 1: no images
8
+ if N == 0:
9
+ raise ValueError("The length of the image list is 0.")
10
+
11
+ # Error 2: Size differs
12
+ width = img_list[0].width
13
+ height = img_list[0].height
14
+ for i in range(1, N):
15
+ if img_list[i].width != width:
16
+ raise ValueError("All images should have the same width.")
17
+ if img_list[i].height != height:
18
+ raise ValueError("All images should have the same height.")
19
+
20
+ # Create concated image
21
+ concated_width = width * N + gap * (N + 1)
22
+ concated_height = height + gap * 2
23
+ concated_image = Image.new("RGB", (concated_width, concated_height))
24
+
25
+ # Copy ans paste
26
+ for i in range(N):
27
+ concated_image.paste(img_list[i], (width * i + gap * (i + 1), gap))
28
+
29
+ # return
30
+ return concated_image
31
+
32
+
33
+ def _concat_image_vertical(img_list: list[Image], gap=2) -> Image:
34
+ N = len(img_list)
35
+
36
+ # Error 1: no images
37
+ if N == 0:
38
+ raise ValueError("The length of the image list is 0.")
39
+
40
+ # Error 2: Size differs
41
+ width = img_list[0].width
42
+ height = img_list[0].height
43
+ for i in range(1, N):
44
+ if img_list[i].width != width:
45
+ raise ValueError("All images should have the same width.")
46
+ if img_list[i].height != height:
47
+ raise ValueError("All images should have the same height.")
48
+
49
+ # Create concated image
50
+ concated_width = width + gap * 2
51
+ concated_height = height * N + gap * (N + 1)
52
+ concated_image = Image.new("RGB", (concated_width, concated_height))
53
+
54
+ # Copy ans paste
55
+ for i in range(N):
56
+ concated_image.paste(img_list[i], (gap, height * i + gap * (i + 1)))
57
+
58
+ # return
59
+ return concated_image
60
+
61
+
62
+ def concat_image(img_list: list[Image], gap=2, direction="vertical"):
63
+
64
+ if direction == "vertical":
65
+ _concat_image_vertical(img_list, gap=gap)
66
+ elif direction == "horizontal":
67
+ _concat_image_horizontal(img_list, gap=gap)
68
+ else:
69
+ raise ValueError("Direction should be 'vertical' or 'horizontal'.")
70
+
71
+
72
+ __all__ = ["concat_image"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Myosotis-Researches
3
- Version: 0.0.29
3
+ Version: 0.0.31
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
@@ -2,7 +2,7 @@ myosotis_researches/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
2
2
  myosotis_researches/CcGAN/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  myosotis_researches/CcGAN/internal/__init__.py,sha256=b-63yANNRQXgLF9k9yGdrm7mlULqGic1HTQTzg9wIME,209
4
4
  myosotis_researches/CcGAN/internal/install_datasets.py,sha256=jJwLOZrDnHMrJSUhXxSIFobdeWK5N6eitPmjeBW9FyA,1144
5
- myosotis_researches/CcGAN/internal/show_datasets.py,sha256=A8WBQ-C_q3TfQHwHOW95c5_84VVzzpUUZoG-SNzAhxU,276
5
+ myosotis_researches/CcGAN/internal/show_datasets.py,sha256=BWtQ6vdiEUOTrOs8aMBv6utuUN0IiaLKcK5iXq9y2qI,363
6
6
  myosotis_researches/CcGAN/internal/uninstall_datasets.py,sha256=7pxPZcSe9RHncF0I_4rf8ZdI7eQwv-sFVfxzSVZfYHQ,297
7
7
  myosotis_researches/CcGAN/models_128/CcGAN_SAGAN.py,sha256=uYDngtHoB7frPg2Vs7YCFXeUh7Y7MjaAXbRWHXO_xvw,10629
8
8
  myosotis_researches/CcGAN/models_128/ResNet_class_eval.py,sha256=wa5CPkYzrS0X6kZ6pGHM-GxcGNkSpBdTTqgy5dKVKkU,5131
@@ -44,14 +44,13 @@ myosotis_researches/CcGAN/train_128_output_10/train_cgan.py,sha256=bYJbBskTpESfC
44
44
  myosotis_researches/CcGAN/train_128_output_10/train_cgan_concat.py,sha256=PYctY3IZiHGh4TshXx3mUZBf9su_8NuV_D8InkxKQZ4,8940
45
45
  myosotis_researches/CcGAN/train_128_output_10/train_net_for_label_embed.py,sha256=4j6r4_o4rXgAN4MdUQL-TXqZJpbhH7d9gWQR8YzBlXw,6976
46
46
  myosotis_researches/CcGAN/train_128_output_10/utils.py,sha256=B-V6ct4WDisVVCOLO0W7VIBL8StPVNJJTZZ2b2NkMFU,3766
47
- myosotis_researches/CcGAN/utils/__init__.py,sha256=Pu9COV4zcXHGXuczhObersyeshVChmlEtwqp8VLUDxw,300
48
- myosotis_researches/CcGAN/utils/concat_image_horizontal.py,sha256=e6WsfO9IiSoP8zkZNz7IGimPUASr9VvyJUJdF-d40iw,954
49
- myosotis_researches/CcGAN/utils/concat_image_vertical.py,sha256=97-SuE8ZWpaeBm_ed6MAEaUOvtpzlYq_X3yWt4OEUTY,951
47
+ myosotis_researches/CcGAN/utils/__init__.py,sha256=b6bOVso_Yx6wa380sk0PPON1vSzjLBPKK1_I2NEFqHk,185
48
+ myosotis_researches/CcGAN/utils/concat_image.py,sha256=zSVFkIgj18m9wKTNWxBmZIdqMgVKF2IB2m1C65l_qyo,2151
50
49
  myosotis_researches/CcGAN/utils/install_datasets.py,sha256=1WAhrzaCsWqI6vbW0awyovU2nqAtJQAEfWOdIRPQ7Jo,1121
51
50
  myosotis_researches/CcGAN/utils/make_h5.py,sha256=Q5OW1JA35ormmsrlAJp6XdC6x0uJBRNjsE31wM3zBiI,1422
52
51
  myosotis_researches/CcGAN/utils/print_hdf5_structure.py,sha256=leaR8H3GhlX6EuIXDMh36xG2zBdV-XlJkaXBuoorl6I,320
53
- myosotis_researches-0.0.29.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
54
- myosotis_researches-0.0.29.dist-info/METADATA,sha256=CiB6dB7zXx9Uvztj_doKSVYEM2-LDgw3pAHmZr4OD8A,765
55
- myosotis_researches-0.0.29.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
56
- myosotis_researches-0.0.29.dist-info/top_level.txt,sha256=zxAiMn5eyZNJM28MewTAkgi_RZJMbfWbzVR-KF0LdZE,20
57
- myosotis_researches-0.0.29.dist-info/RECORD,,
52
+ myosotis_researches-0.0.31.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
53
+ myosotis_researches-0.0.31.dist-info/METADATA,sha256=4b_2L49zDh717Wi710yY_-aE4M8put7HXRFUTDEmeRM,765
54
+ myosotis_researches-0.0.31.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
55
+ myosotis_researches-0.0.31.dist-info/top_level.txt,sha256=zxAiMn5eyZNJM28MewTAkgi_RZJMbfWbzVR-KF0LdZE,20
56
+ myosotis_researches-0.0.31.dist-info/RECORD,,
@@ -1,31 +0,0 @@
1
- from PIL import Image
2
-
3
- def concat_image_horizontal(img_list: list[Image], gap = 2) -> Image:
4
- N = len(img_list)
5
-
6
- # Error 1: no images
7
- if N == 0:
8
- raise ValueError("The length of the image list is 0.")
9
-
10
- # Error 2: Size differs
11
- width = img_list[0].width
12
- height = img_list[0].height
13
- for i in range(1, N):
14
- if img_list[i].width != width:
15
- raise ValueError("All images should have the same width.")
16
- if img_list[i].height != height:
17
- raise ValueError("All images should have the same height.")
18
-
19
- # Create concated image
20
- concated_width = width * N + gap * (N+1)
21
- concated_height = height + gap * 2
22
- concated_image = Image.new("RGB", (concated_width, concated_height))
23
-
24
- # Copy ans paste
25
- for i in range(N):
26
- concated_image.paste(img_list[i], (width * i + gap * (i+1), gap))
27
-
28
- # return
29
- return concated_image
30
-
31
- __all__ = ["concat_image_horizontal"]
@@ -1,31 +0,0 @@
1
- from PIL import Image
2
-
3
- def concat_image_vertical(img_list: list[Image], gap = 2) -> Image:
4
- N = len(img_list)
5
-
6
- # Error 1: no images
7
- if N == 0:
8
- raise ValueError("The length of the image list is 0.")
9
-
10
- # Error 2: Size differs
11
- width = img_list[0].width
12
- height = img_list[0].height
13
- for i in range(1, N):
14
- if img_list[i].width != width:
15
- raise ValueError("All images should have the same width.")
16
- if img_list[i].height != height:
17
- raise ValueError("All images should have the same height.")
18
-
19
- # Create concated image
20
- concated_width = width + gap * 2
21
- concated_height = height * N + gap * (N+1)
22
- concated_image = Image.new("RGB", (concated_width, concated_height))
23
-
24
- # Copy ans paste
25
- for i in range(N):
26
- concated_image.paste(img_list[i], (gap, height * i + gap * (i+1)))
27
-
28
- # return
29
- return concated_image
30
-
31
- __all__ = ["concat_image_vertical"]