Myosotis-Researches 0.1.35__py3-none-any.whl → 0.1.37__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.
- myosotis_researches/CcGAN/utils/similarity.py +52 -11
- {myosotis_researches-0.1.35.dist-info → myosotis_researches-0.1.37.dist-info}/METADATA +1 -1
- {myosotis_researches-0.1.35.dist-info → myosotis_researches-0.1.37.dist-info}/RECORD +6 -6
- {myosotis_researches-0.1.35.dist-info → myosotis_researches-0.1.37.dist-info}/WHEEL +0 -0
- {myosotis_researches-0.1.35.dist-info → myosotis_researches-0.1.37.dist-info}/licenses/LICENSE +0 -0
- {myosotis_researches-0.1.35.dist-info → myosotis_researches-0.1.37.dist-info}/top_level.txt +0 -0
@@ -59,19 +59,25 @@ def PSNR(images):
|
|
59
59
|
PSNR_sum += _PSNR(images[i], images[j])
|
60
60
|
return PSNR_sum / (n * (n - 1) / 2)
|
61
61
|
|
62
|
+
|
62
63
|
# Cross-correlation
|
63
64
|
|
65
|
+
|
64
66
|
def _cross_correlation(image_1, image_2):
|
65
|
-
array_1 = np.array(image_1)
|
66
|
-
array_2 = np.array(image_2)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
67
|
+
array_1 = np.array(image_1).astype(np.float32) / 255
|
68
|
+
array_2 = np.array(image_2).astype(np.float32) / 255
|
69
|
+
correlations = []
|
70
|
+
for c in range(3):
|
71
|
+
channel1 = array_1[..., c]
|
72
|
+
channel2 = array_2[..., c]
|
73
|
+
channel1 -= channel1.mean()
|
74
|
+
channel2 -= channel2.mean()
|
75
|
+
numerator = np.sum(channel1 * channel2)
|
76
|
+
denominator = np.sqrt(np.sum(channel1**2) * np.sum(channel2**2))
|
77
|
+
corr = numerator / denominator if denominator != 0 else 0
|
78
|
+
correlations.append(corr)
|
79
|
+
return np.mean(correlations)
|
80
|
+
|
75
81
|
|
76
82
|
def cross_correlation(images):
|
77
83
|
cross_correlation_sum = 0
|
@@ -81,8 +87,43 @@ def cross_correlation(images):
|
|
81
87
|
cross_correlation_sum += _cross_correlation(images[i], images[j])
|
82
88
|
return cross_correlation_sum / (n * (n - 1) / 2)
|
83
89
|
|
90
|
+
|
91
|
+
# Histogram intersection
|
92
|
+
def _rgb_histogram(image, bins=32):
|
93
|
+
"""
|
94
|
+
image: numpy array of shape (H, W, 3), RGB format
|
95
|
+
returns: concatenated histogram for R, G, B channels
|
96
|
+
"""
|
97
|
+
hist_r, _ = np.histogram(image[:, :, 0], bins=bins, range=(0, 255), density=True)
|
98
|
+
hist_g, _ = np.histogram(image[:, :, 1], bins=bins, range=(0, 255), density=True)
|
99
|
+
hist_b, _ = np.histogram(image[:, :, 2], bins=bins, range=(0, 255), density=True)
|
100
|
+
hist = np.concatenate([hist_r, hist_g, hist_b])
|
101
|
+
return hist
|
102
|
+
|
103
|
+
|
104
|
+
def _histogram_intersection(image_1, image_2):
|
105
|
+
hist_1 = _rgb_histogram(image_1)
|
106
|
+
hist_2 = _rgb_histogram(image_2)
|
107
|
+
return np.sum(np.minimum(hist_1, hist_2))
|
108
|
+
|
109
|
+
|
110
|
+
def histogram_intersection(images):
|
111
|
+
histogram_intersection_sum = 0
|
112
|
+
n = len(images)
|
113
|
+
for i in range(n):
|
114
|
+
for j in range(i + 1, n):
|
115
|
+
histogram_intersection_sum += _histogram_intersection(images[i], images[j])
|
116
|
+
return histogram_intersection_sum / (n * (n - 1) / 2)
|
117
|
+
|
118
|
+
|
84
119
|
# Similarity
|
85
|
-
_method_dict = {
|
120
|
+
_method_dict = {
|
121
|
+
"MSE": MSE,
|
122
|
+
"SSIM": SSIM,
|
123
|
+
"PSNR": PSNR,
|
124
|
+
"cross-correlation": cross_correlation,
|
125
|
+
"histogram-intersection": histogram_intersection,
|
126
|
+
}
|
86
127
|
|
87
128
|
|
88
129
|
def similarity(images, method):
|
@@ -29,13 +29,13 @@ myosotis_researches/CcGAN/train/train_net_for_label_embed.py,sha256=4j6r4_o4rXgA
|
|
29
29
|
myosotis_researches/CcGAN/utils/__init__.py,sha256=yH4I2QzSoBsjcdjvOH0YKLTeEji_oWrzBGm5EkVZpoI,146
|
30
30
|
myosotis_researches/CcGAN/utils/concat_image.py,sha256=BIGKz52Inn9S7M5fBFKye2V9bLJ0DqEQILoOVWAXUiE,2165
|
31
31
|
myosotis_researches/CcGAN/utils/dataset.py,sha256=TXJSLMpwI1h0xb6lXpq5iUjjurheKPZnPbR2KIU-Py4,4216
|
32
|
-
myosotis_researches/CcGAN/utils/similarity.py,sha256=
|
32
|
+
myosotis_researches/CcGAN/utils/similarity.py,sha256=piqT2XipooFcpSrT7femKUr3RPu0P7zGYaL355i9okk,3458
|
33
33
|
myosotis_researches/CcGAN/utils/src/style.css,sha256=bNp3_nlpg0W5qA7Rx8MM5ayeprEbYH3_6AIDRTN8UhM,566
|
34
34
|
myosotis_researches/CcGAN/utils/src/style.css.map,sha256=GTGPet_xXnKQnsz-E2CMUWtrgu3D5t0g4J_A_amFdvw,246
|
35
35
|
myosotis_researches/CcGAN/utils/src/style.scss,sha256=_Wa7VPmFzCkEHtrzdG35tj89QNwPd-fpiT-YL4ohcMs,526
|
36
36
|
myosotis_researches/CcGAN/utils/src/template.html,sha256=S35ak_uJ0Zd3_PhX-YoCRBP2TMKxdFPMMaBdpARdKcU,3890
|
37
|
-
myosotis_researches-0.1.
|
38
|
-
myosotis_researches-0.1.
|
39
|
-
myosotis_researches-0.1.
|
40
|
-
myosotis_researches-0.1.
|
41
|
-
myosotis_researches-0.1.
|
37
|
+
myosotis_researches-0.1.37.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
38
|
+
myosotis_researches-0.1.37.dist-info/METADATA,sha256=7gCdoiiquizLVqgF88yubO5qIkv088uXb07m9ecrKJY,3484
|
39
|
+
myosotis_researches-0.1.37.dist-info/WHEEL,sha256=wXxTzcEDnjrTwFYjLPcsW_7_XihufBwmpiBeiXNBGEA,91
|
40
|
+
myosotis_researches-0.1.37.dist-info/top_level.txt,sha256=zxAiMn5eyZNJM28MewTAkgi_RZJMbfWbzVR-KF0LdZE,20
|
41
|
+
myosotis_researches-0.1.37.dist-info/RECORD,,
|
File without changes
|
{myosotis_researches-0.1.35.dist-info → myosotis_researches-0.1.37.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|