Myosotis-Researches 0.0.7__tar.gz → 0.0.9__tar.gz

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.
Files changed (17) hide show
  1. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9/Myosotis_Researches.egg-info}/PKG-INFO +1 -1
  2. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/Myosotis_Researches.egg-info/SOURCES.txt +1 -0
  3. {myosotis_researches-0.0.7/Myosotis_Researches.egg-info → myosotis_researches-0.0.9}/PKG-INFO +1 -1
  4. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/myosotis_researches/CcGAN/utils/concat_image_horizontal.py +1 -1
  5. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/myosotis_researches/CcGAN/utils/concat_image_vertical.py +1 -1
  6. myosotis_researches-0.0.9/myosotis_researches/CcGAN/utils/make_h5.py +39 -0
  7. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/setup.py +1 -1
  8. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/LICENSE +0 -0
  9. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/Myosotis_Researches.egg-info/dependency_links.txt +0 -0
  10. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/Myosotis_Researches.egg-info/top_level.txt +0 -0
  11. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/README.md +0 -0
  12. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/myosotis_researches/CcGAN/__init__.py +0 -0
  13. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/myosotis_researches/CcGAN/utils/__init__.py +0 -0
  14. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/myosotis_researches/CcGAN/utils/print_hdf5_structure.py +0 -0
  15. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/myosotis_researches/__init__.py +0 -0
  16. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/pyproject.toml +0 -0
  17. {myosotis_researches-0.0.7 → myosotis_researches-0.0.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Myosotis-Researches
3
- Version: 0.0.7
3
+ Version: 0.0.9
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
@@ -11,4 +11,5 @@ myosotis_researches/CcGAN/__init__.py
11
11
  myosotis_researches/CcGAN/utils/__init__.py
12
12
  myosotis_researches/CcGAN/utils/concat_image_horizontal.py
13
13
  myosotis_researches/CcGAN/utils/concat_image_vertical.py
14
+ myosotis_researches/CcGAN/utils/make_h5.py
14
15
  myosotis_researches/CcGAN/utils/print_hdf5_structure.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Myosotis-Researches
3
- Version: 0.0.7
3
+ Version: 0.0.9
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
@@ -18,7 +18,7 @@ def concat_image_horizontal(img_list: list[Image], gap = 2) -> Image:
18
18
 
19
19
  # Create concated image
20
20
  concated_width = width * N + gap * (N+1)
21
- concated_height = height * N + gap * 2
21
+ concated_height = height + gap * 2
22
22
  concated_image = Image.new("RGB", (concated_width, concated_height))
23
23
 
24
24
  # Copy ans paste
@@ -17,7 +17,7 @@ def concat_image_vertical(img_list: list[Image], gap = 2) -> Image:
17
17
  raise ValueError("All images should have the same height.")
18
18
 
19
19
  # Create concated image
20
- concated_width = width * N + gap * 2
20
+ concated_width = width + gap * 2
21
21
  concated_height = height * N + gap * (N+1)
22
22
  concated_image = Image.new("RGB", (concated_width, concated_height))
23
23
 
@@ -0,0 +1,39 @@
1
+ import h5py
2
+ import numpy as np
3
+ import os
4
+ from PIL import Image
5
+ from print_hdf5_structure import print_hdf5_structure
6
+
7
+ # Make all images to a HDF5 file
8
+ def make_h5(image_dir: str, h5_path: str, image_names: list[str], image_labels, image_types):
9
+
10
+ N = len(image_names)
11
+
12
+ # Get image data
13
+ image_datas = []
14
+ for i in range(N):
15
+ image_name = image_names[i]
16
+ image_path = os.path.join(image_dir, image_name)
17
+ image = Image.open(image_path).convert("RGB")
18
+ rgb_array = np.array(image).transpose((2, 0, 1))
19
+ image_datas.append(rgb_array)
20
+ img_datas = np.array(img_datas, dtype=np.uint8)
21
+
22
+ # Set train_idx = 1, 3, 5, ...
23
+ train_idx = np.array(range(1, N, 2), dtype=np.int32)
24
+
25
+ # Set val_idx = 0, 2, 4, ...
26
+ val_idx = np.array(range(0, N, 2), dtype=np.int32)
27
+
28
+ # Create a new HDF5 file
29
+ with h5py.File(h5_path, "w") as f:
30
+ f.create_dataset("images", data=image_datas)
31
+ f.create_dataset("indx_train", data=train_idx)
32
+ f.create_dataset("indx_valid", data=val_idx)
33
+ f.create_dataset("labels", data=image_labels)
34
+ f.create_dataset("types", data=image_types)
35
+
36
+ # Visualize
37
+ f.visititems(print_hdf5_structure)
38
+
39
+ __all__ = ["make_h5"]
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="Myosotis-Researches",
5
- version="0.0.7",
5
+ version="0.0.9",
6
6
  description="A repository for storing my progress of researches.",
7
7
  long_description=open("README.md").read(),
8
8
  long_description_content_type="text/markdown",