Myosotis-Researches 0.1.33__tar.gz → 0.1.35__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 (48) hide show
  1. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35/Myosotis_Researches.egg-info}/PKG-INFO +1 -1
  2. {myosotis_researches-0.1.33/Myosotis_Researches.egg-info → myosotis_researches-0.1.35}/PKG-INFO +1 -1
  3. myosotis_researches-0.1.35/myosotis_researches/CcGAN/utils/similarity.py +92 -0
  4. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/setup.py +1 -1
  5. myosotis_researches-0.1.33/myosotis_researches/CcGAN/utils/similarity.py +0 -52
  6. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/LICENSE +0 -0
  7. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/MANIFEST.in +0 -0
  8. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/Myosotis_Researches.egg-info/SOURCES.txt +0 -0
  9. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/Myosotis_Researches.egg-info/dependency_links.txt +0 -0
  10. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/Myosotis_Researches.egg-info/top_level.txt +0 -0
  11. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/README.md +0 -0
  12. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/__init__.py +0 -0
  13. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_128/CcGAN_SAGAN.py +0 -0
  14. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_128/ResNet_class_eval.py +0 -0
  15. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_128/ResNet_embed.py +0 -0
  16. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_128/ResNet_regre_eval.py +0 -0
  17. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_128/__init__.py +0 -0
  18. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_128/autoencoder.py +0 -0
  19. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_128/cGAN_SAGAN.py +0 -0
  20. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_128/cGAN_concat_SAGAN.py +0 -0
  21. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_256/CcGAN_SAGAN.py +0 -0
  22. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_256/ResNet_class_eval.py +0 -0
  23. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_256/ResNet_embed.py +0 -0
  24. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_256/ResNet_regre_eval.py +0 -0
  25. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_256/__init__.py +0 -0
  26. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_256/autoencoder.py +0 -0
  27. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_256/cGAN_SAGAN.py +0 -0
  28. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/models_256/cGAN_concat_SAGAN.py +0 -0
  29. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/old/IMGs_dataset.py +0 -0
  30. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/old/SimpleProgressBar.py +0 -0
  31. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/old/__init__.py +0 -0
  32. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/old/opts.py +0 -0
  33. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/old/train.py +0 -0
  34. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/train/__init__.py +0 -0
  35. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/train/train_ccgan.py +0 -0
  36. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/train/train_cgan.py +0 -0
  37. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/train/train_cgan_concat.py +0 -0
  38. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/train/train_net_for_label_embed.py +0 -0
  39. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/utils/__init__.py +0 -0
  40. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/utils/concat_image.py +0 -0
  41. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/utils/dataset.py +0 -0
  42. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/utils/src/style.css +0 -0
  43. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/utils/src/style.css.map +0 -0
  44. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/utils/src/style.scss +0 -0
  45. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/CcGAN/utils/src/template.html +0 -0
  46. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/myosotis_researches/__init__.py +0 -0
  47. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/pyproject.toml +0 -0
  48. {myosotis_researches-0.1.33 → myosotis_researches-0.1.35}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Myosotis-Researches
3
- Version: 0.1.33
3
+ Version: 0.1.35
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Myosotis-Researches
3
- Version: 0.1.33
3
+ Version: 0.1.35
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
@@ -0,0 +1,92 @@
1
+ import cv2
2
+ import math
3
+ import numpy as np
4
+ from PIL import Image
5
+ from skimage.metrics import structural_similarity as ssim
6
+
7
+
8
+ # MSE
9
+ def _MSE(image_1, image_2):
10
+ array_1 = np.array(image_1) / 255
11
+ array_2 = np.array(image_2) / 255
12
+ n, m, _ = array_1.shape
13
+ return np.sum((array_1 - array_2) ** 2) / (n * m * 3)
14
+
15
+
16
+ def MSE(images):
17
+ MSE_sum = 0
18
+ n = len(images)
19
+ for i in range(n):
20
+ for j in range(i + 1, n):
21
+ MSE_sum += _MSE(images[i], images[j])
22
+ return MSE_sum / (n * (n - 1) / 2)
23
+
24
+
25
+ # SSIM
26
+
27
+
28
+ def _SSIM(image_1, image_2):
29
+
30
+ array_1 = np.array(image_1)
31
+ array_2 = np.array(image_2)
32
+ score, _ = ssim(array_1, array_2, channel_axis=-1, full=True)
33
+ return score
34
+
35
+
36
+ def SSIM(images):
37
+ SSIM_sum = 0
38
+ n = len(images)
39
+ for i in range(n):
40
+ for j in range(i + 1, n):
41
+ SSIM_sum += _SSIM(images[i], images[j])
42
+ return SSIM_sum / (n * (n - 1) / 2)
43
+
44
+
45
+ # PSNR
46
+ def _PSNR(image_1, image_2):
47
+ mse = _MSE(image_1, image_2)
48
+ if mse == 0:
49
+ return float("inf")
50
+ else:
51
+ return 20 * math.log10(1.0 / math.sqrt(mse))
52
+
53
+
54
+ def PSNR(images):
55
+ PSNR_sum = 0
56
+ n = len(images)
57
+ for i in range(n):
58
+ for j in range(i + 1, n):
59
+ PSNR_sum += _PSNR(images[i], images[j])
60
+ return PSNR_sum / (n * (n - 1) / 2)
61
+
62
+ # Cross-correlation
63
+
64
+ def _cross_correlation(image_1, image_2):
65
+ array_1 = np.array(image_1)
66
+ array_2 = np.array(image_2)
67
+ channels_1 = cv2.split(array_1)
68
+ channels_2 = cv2.split(array_2)
69
+ scores = []
70
+ for c1, c2 in zip(channels_1, channels_2):
71
+ result = cv2.matchTemplate(c1, c2, method=cv2.TM_CCOEFF_NORMED)
72
+ _, max_val, _, _ = cv2.minMaxLoc(result)
73
+ scores.append(max_val)
74
+ return sum(scores) / len(scores)
75
+
76
+ def cross_correlation(images):
77
+ cross_correlation_sum = 0
78
+ n = len(images)
79
+ for i in range(n):
80
+ for j in range(i + 1, n):
81
+ cross_correlation_sum += _cross_correlation(images[i], images[j])
82
+ return cross_correlation_sum / (n * (n - 1) / 2)
83
+
84
+ # Similarity
85
+ _method_dict = {"MSE": MSE, "SSIM": SSIM, "PSNR": PSNR, "cross-correlation": cross_correlation}
86
+
87
+
88
+ def similarity(images, method):
89
+ return _method_dict[method](images)
90
+
91
+
92
+ __all__ = ["similarity"]
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="Myosotis-Researches",
5
- version="0.1.33",
5
+ version="0.1.35",
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",
@@ -1,52 +0,0 @@
1
- import cv2
2
- import numpy as np
3
- from PIL import Image
4
- from skimage.metrics import structural_similarity as ssim
5
-
6
-
7
- # MSE
8
- def _MSE(image_1, image_2):
9
- array_1 = np.array(image_1) / 255
10
- array_2 = np.array(image_2) / 255
11
- n, m, _ = array_1.shape
12
- return np.sum((array_1 - array_2) ** 2) / (n * m * 3)
13
-
14
-
15
- def MSE(images):
16
- MSE_sum = 0
17
- n = len(images)
18
- for i in range(n):
19
- for j in range(i + 1, n):
20
- MSE_sum += _MSE(images[i], images[j])
21
- return MSE_sum / (n * (n - 1) / 2)
22
-
23
-
24
- # SSIM
25
-
26
-
27
- def _SSIM(image_1, image_2):
28
-
29
- array_1 = np.array(image_1)
30
- array_2 = np.array(image_2)
31
- score, _ = ssim(array_1, array_2, channel_axis=-1, full=True)
32
- return score
33
-
34
-
35
- def SSIM(images):
36
- SSIM_sum = 0
37
- n = len(images)
38
- for i in range(n):
39
- for j in range(i + 1, n):
40
- SSIM_sum += _SSIM(images[i], images[j])
41
- return SSIM_sum / (n * (n - 1) / 2)
42
-
43
-
44
- # Similarity
45
- _method_dict = {"MSE": MSE, "SSIM": SSIM}
46
-
47
-
48
- def similarity(images, method):
49
- return _method_dict[method](images)
50
-
51
-
52
- __all__ = ["similarity"]