Myosotis-Researches 0.1.7__py3-none-any.whl → 0.1.9__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/train/__init__.py +4 -0
- myosotis_researches/CcGAN/{train_128_output_10 → train}/train_ccgan.py +4 -4
- myosotis_researches/CcGAN/{train_128 → train}/train_cgan.py +1 -3
- myosotis_researches/CcGAN/{train_128 → train}/train_cgan_concat.py +1 -3
- myosotis_researches/CcGAN/utils/__init__.py +2 -1
- myosotis_researches/CcGAN/utils/train.py +94 -3
- {myosotis_researches-0.1.7.dist-info → myosotis_researches-0.1.9.dist-info}/METADATA +1 -1
- myosotis_researches-0.1.9.dist-info/RECORD +24 -0
- myosotis_researches/CcGAN/models_128/CcGAN_SAGAN.py +0 -301
- myosotis_researches/CcGAN/models_128/ResNet_class_eval.py +0 -141
- myosotis_researches/CcGAN/models_128/ResNet_embed.py +0 -188
- myosotis_researches/CcGAN/models_128/ResNet_regre_eval.py +0 -175
- myosotis_researches/CcGAN/models_128/__init__.py +0 -7
- myosotis_researches/CcGAN/models_128/autoencoder.py +0 -119
- myosotis_researches/CcGAN/models_128/cGAN_SAGAN.py +0 -276
- myosotis_researches/CcGAN/models_128/cGAN_concat_SAGAN.py +0 -245
- myosotis_researches/CcGAN/models_256/CcGAN_SAGAN.py +0 -303
- myosotis_researches/CcGAN/models_256/ResNet_class_eval.py +0 -142
- myosotis_researches/CcGAN/models_256/ResNet_embed.py +0 -188
- myosotis_researches/CcGAN/models_256/ResNet_regre_eval.py +0 -178
- myosotis_researches/CcGAN/models_256/__init__.py +0 -7
- myosotis_researches/CcGAN/models_256/autoencoder.py +0 -133
- myosotis_researches/CcGAN/models_256/cGAN_SAGAN.py +0 -280
- myosotis_researches/CcGAN/models_256/cGAN_concat_SAGAN.py +0 -249
- myosotis_researches/CcGAN/train_128/DiffAugment_pytorch.py +0 -76
- myosotis_researches/CcGAN/train_128/__init__.py +0 -0
- myosotis_researches/CcGAN/train_128/eval_metrics.py +0 -205
- myosotis_researches/CcGAN/train_128/opts.py +0 -87
- myosotis_researches/CcGAN/train_128/pretrain_AE.py +0 -268
- myosotis_researches/CcGAN/train_128/pretrain_CNN_class.py +0 -251
- myosotis_researches/CcGAN/train_128/pretrain_CNN_regre.py +0 -255
- myosotis_researches/CcGAN/train_128/train_ccgan.py +0 -303
- myosotis_researches/CcGAN/train_128/utils.py +0 -120
- myosotis_researches/CcGAN/train_128_output_10/DiffAugment_pytorch.py +0 -76
- myosotis_researches/CcGAN/train_128_output_10/__init__.py +0 -0
- myosotis_researches/CcGAN/train_128_output_10/eval_metrics.py +0 -205
- myosotis_researches/CcGAN/train_128_output_10/opts.py +0 -87
- myosotis_researches/CcGAN/train_128_output_10/pretrain_AE.py +0 -268
- myosotis_researches/CcGAN/train_128_output_10/pretrain_CNN_class.py +0 -251
- myosotis_researches/CcGAN/train_128_output_10/pretrain_CNN_regre.py +0 -255
- myosotis_researches/CcGAN/train_128_output_10/train_cgan.py +0 -254
- myosotis_researches/CcGAN/train_128_output_10/train_cgan_concat.py +0 -242
- myosotis_researches/CcGAN/train_128_output_10/train_net_for_label_embed.py +0 -181
- myosotis_researches/CcGAN/train_128_output_10/utils.py +0 -120
- myosotis_researches-0.1.7.dist-info/RECORD +0 -59
- /myosotis_researches/CcGAN/{train_128 → train}/train_net_for_label_embed.py +0 -0
- {myosotis_researches-0.1.7.dist-info → myosotis_researches-0.1.9.dist-info}/WHEEL +0 -0
- {myosotis_researches-0.1.7.dist-info → myosotis_researches-0.1.9.dist-info}/licenses/LICENSE +0 -0
- {myosotis_researches-0.1.7.dist-info → myosotis_researches-0.1.9.dist-info}/top_level.txt +0 -0
@@ -1,120 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Some helpful functions
|
3
|
-
|
4
|
-
"""
|
5
|
-
import numpy as np
|
6
|
-
import torch
|
7
|
-
import torch.nn as nn
|
8
|
-
import torchvision
|
9
|
-
import matplotlib.pyplot as plt
|
10
|
-
import matplotlib as mpl
|
11
|
-
from torch.nn import functional as F
|
12
|
-
import sys
|
13
|
-
import PIL
|
14
|
-
from PIL import Image
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# ################################################################################
|
19
|
-
# Progress Bar
|
20
|
-
class SimpleProgressBar():
|
21
|
-
def __init__(self, width=50):
|
22
|
-
self.last_x = -1
|
23
|
-
self.width = width
|
24
|
-
|
25
|
-
def update(self, x):
|
26
|
-
assert 0 <= x <= 100 # `x`: progress in percent ( between 0 and 100)
|
27
|
-
if self.last_x == int(x): return
|
28
|
-
self.last_x = int(x)
|
29
|
-
pointer = int(self.width * (x / 100.0))
|
30
|
-
sys.stdout.write( '\r%d%% [%s]' % (int(x), '#' * pointer + '.' * (self.width - pointer)))
|
31
|
-
sys.stdout.flush()
|
32
|
-
if x == 100:
|
33
|
-
print('')
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
################################################################################
|
38
|
-
# torch dataset from numpy array
|
39
|
-
class IMGs_dataset(torch.utils.data.Dataset):
|
40
|
-
def __init__(self, images, labels=None, normalize=False):
|
41
|
-
super(IMGs_dataset, self).__init__()
|
42
|
-
|
43
|
-
self.images = images
|
44
|
-
self.n_images = len(self.images)
|
45
|
-
self.labels = labels
|
46
|
-
if labels is not None:
|
47
|
-
if len(self.images) != len(self.labels):
|
48
|
-
raise Exception('images (' + str(len(self.images)) +') and labels ('+str(len(self.labels))+') do not have the same length!!!')
|
49
|
-
self.normalize = normalize
|
50
|
-
|
51
|
-
|
52
|
-
def __getitem__(self, index):
|
53
|
-
|
54
|
-
image = self.images[index]
|
55
|
-
|
56
|
-
if self.normalize:
|
57
|
-
image = image/255.0
|
58
|
-
image = (image-0.5)/0.5
|
59
|
-
|
60
|
-
if self.labels is not None:
|
61
|
-
label = self.labels[index]
|
62
|
-
return (image, label)
|
63
|
-
else:
|
64
|
-
return image
|
65
|
-
|
66
|
-
def __len__(self):
|
67
|
-
return self.n_images
|
68
|
-
|
69
|
-
|
70
|
-
def PlotLoss(loss, filename):
|
71
|
-
x_axis = np.arange(start = 1, stop = len(loss)+1)
|
72
|
-
plt.switch_backend('agg')
|
73
|
-
mpl.style.use('seaborn')
|
74
|
-
fig = plt.figure()
|
75
|
-
ax = plt.subplot(111)
|
76
|
-
ax.plot(x_axis, np.array(loss))
|
77
|
-
plt.xlabel("epoch")
|
78
|
-
plt.ylabel("training loss")
|
79
|
-
plt.legend()
|
80
|
-
#ax.legend(loc='upper center', bbox_to_anchor=(0.5, 1.15), shadow=True, ncol=3)
|
81
|
-
#plt.title('Training Loss')
|
82
|
-
plt.savefig(filename)
|
83
|
-
|
84
|
-
|
85
|
-
# compute entropy of class labels; labels is a numpy array
|
86
|
-
def compute_entropy(labels, base=None):
|
87
|
-
value,counts = np.unique(labels, return_counts=True)
|
88
|
-
norm_counts = counts / counts.sum()
|
89
|
-
base = np.e if base is None else base
|
90
|
-
return -(norm_counts * np.log(norm_counts)/np.log(base)).sum()
|
91
|
-
|
92
|
-
def predict_class_labels(net, images, batch_size=500, verbose=False, num_workers=0):
|
93
|
-
net = net.cuda()
|
94
|
-
net.eval()
|
95
|
-
|
96
|
-
n = len(images)
|
97
|
-
if batch_size>n:
|
98
|
-
batch_size=n
|
99
|
-
dataset_pred = IMGs_dataset(images, normalize=False)
|
100
|
-
dataloader_pred = torch.utils.data.DataLoader(dataset_pred, batch_size=batch_size, shuffle=False, num_workers=num_workers)
|
101
|
-
|
102
|
-
class_labels_pred = np.zeros(n+batch_size)
|
103
|
-
with torch.no_grad():
|
104
|
-
nimgs_got = 0
|
105
|
-
if verbose:
|
106
|
-
pb = SimpleProgressBar()
|
107
|
-
for batch_idx, batch_images in enumerate(dataloader_pred):
|
108
|
-
batch_images = batch_images.type(torch.float).cuda()
|
109
|
-
batch_size_curr = len(batch_images)
|
110
|
-
|
111
|
-
outputs,_ = net(batch_images)
|
112
|
-
_, batch_class_labels_pred = torch.max(outputs.data, 1)
|
113
|
-
class_labels_pred[nimgs_got:(nimgs_got+batch_size_curr)] = batch_class_labels_pred.detach().cpu().numpy().reshape(-1)
|
114
|
-
|
115
|
-
nimgs_got += batch_size_curr
|
116
|
-
if verbose:
|
117
|
-
pb.update((float(nimgs_got)/n)*100)
|
118
|
-
#end for batch_idx
|
119
|
-
class_labels_pred = class_labels_pred[0:n]
|
120
|
-
return class_labels_pred
|
@@ -1,59 +0,0 @@
|
|
1
|
-
myosotis_researches/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
myosotis_researches/CcGAN/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
myosotis_researches/CcGAN/internal/__init__.py,sha256=b-63yANNRQXgLF9k9yGdrm7mlULqGic1HTQTzg9wIME,209
|
4
|
-
myosotis_researches/CcGAN/internal/install_datasets.py,sha256=jJwLOZrDnHMrJSUhXxSIFobdeWK5N6eitPmjeBW9FyA,1144
|
5
|
-
myosotis_researches/CcGAN/internal/show_datasets.py,sha256=BWtQ6vdiEUOTrOs8aMBv6utuUN0IiaLKcK5iXq9y2qI,363
|
6
|
-
myosotis_researches/CcGAN/internal/uninstall_datasets.py,sha256=7pxPZcSe9RHncF0I_4rf8ZdI7eQwv-sFVfxzSVZfYHQ,297
|
7
|
-
myosotis_researches/CcGAN/models_128/CcGAN_SAGAN.py,sha256=uYDngtHoB7frPg2Vs7YCFXeUh7Y7MjaAXbRWHXO_xvw,10629
|
8
|
-
myosotis_researches/CcGAN/models_128/ResNet_class_eval.py,sha256=wa5CPkYzrS0X6kZ6pGHM-GxcGNkSpBdTTqgy5dKVKkU,5131
|
9
|
-
myosotis_researches/CcGAN/models_128/ResNet_embed.py,sha256=HKSY-5WWa9jGniOgRoR1WOTfWhR1Dcj6cq2sgznZEbE,6344
|
10
|
-
myosotis_researches/CcGAN/models_128/ResNet_regre_eval.py,sha256=VJYJiiwrjf9DvfZrlwOMJJAPu3PlwgFgIddDaRlGsac,6190
|
11
|
-
myosotis_researches/CcGAN/models_128/__init__.py,sha256=PJQP7ozE9vY23k01he5qvEuGndPZKqxiWWxvgbLDhqg,449
|
12
|
-
myosotis_researches/CcGAN/models_128/autoencoder.py,sha256=ugOwBNoSNP4-WiATVkhC4-igRjj6yEY91qU0egpX744,3827
|
13
|
-
myosotis_researches/CcGAN/models_128/cGAN_SAGAN.py,sha256=JDr0Ss5osf9m-u34bVN_PvMsvMXkmi2jwPOAnls6EOA,11240
|
14
|
-
myosotis_researches/CcGAN/models_128/cGAN_concat_SAGAN.py,sha256=GHAmrNjORXKu-8UqAdP-A5WG-_3BdQUmWsrWD1NX5-w,9634
|
15
|
-
myosotis_researches/CcGAN/models_256/CcGAN_SAGAN.py,sha256=ju1dBYhqxl722_eeUGc2mKwf1AV_qsv1PlBL3tyOu48,10861
|
16
|
-
myosotis_researches/CcGAN/models_256/ResNet_class_eval.py,sha256=tS5YxIpiFS9tDCNe2IDv1hTZNn40_JBD_nn97MfQJNI,5178
|
17
|
-
myosotis_researches/CcGAN/models_256/ResNet_embed.py,sha256=9OcMQ-8nuWEbEbWc9tGaWQtfV1hdnkl0PrTphoGX77c,6295
|
18
|
-
myosotis_researches/CcGAN/models_256/ResNet_regre_eval.py,sha256=tHAbRNM9XodyfPsu00ac5KMjcgRH8qdx8AtCN9QGXKc,6269
|
19
|
-
myosotis_researches/CcGAN/models_256/__init__.py,sha256=PJQP7ozE9vY23k01he5qvEuGndPZKqxiWWxvgbLDhqg,449
|
20
|
-
myosotis_researches/CcGAN/models_256/autoencoder.py,sha256=Nv3eSWJVrWaOufoVGe04sZ_KiXFLtu3Y0asZcAdyyj0,4382
|
21
|
-
myosotis_researches/CcGAN/models_256/cGAN_SAGAN.py,sha256=wTHVkUcAp07n3lgweKFo6cqd91E_rEqgJrBDbBe6qrg,11510
|
22
|
-
myosotis_researches/CcGAN/models_256/cGAN_concat_SAGAN.py,sha256=ZmGEpprDDlFR3dG32LT3NH5yiA1WR8Hg26rcbz42aCQ,9807
|
23
|
-
myosotis_researches/CcGAN/train_128/DiffAugment_pytorch.py,sha256=HxMZdMpE4KvwY3AsNgci8VNEFV3cNALg3obTyELlCaY,3025
|
24
|
-
myosotis_researches/CcGAN/train_128/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
|
-
myosotis_researches/CcGAN/train_128/eval_metrics.py,sha256=nqDh0xhumSmpMSk2HElCR6LiUtydaFLRy6rGdt39sSg,7169
|
26
|
-
myosotis_researches/CcGAN/train_128/opts.py,sha256=oIScD7A6GdcWI_ptB-k3Df5WWoWglf8bp32v3pNlerY,5374
|
27
|
-
myosotis_researches/CcGAN/train_128/pretrain_AE.py,sha256=VAbe5kSfvTl2k0aV6eV3XnMMV28KrIzB2EglahXEXiU,10746
|
28
|
-
myosotis_researches/CcGAN/train_128/pretrain_CNN_class.py,sha256=tnGH5rKeJyWY29esBXlFJx9Qr30uB6W5cMw1Wge-Leg,9247
|
29
|
-
myosotis_researches/CcGAN/train_128/pretrain_CNN_regre.py,sha256=RSmHQ5Z3Jbq2TKU2D2p-HJriXxKDw4YG-B8gstwefcI,8953
|
30
|
-
myosotis_researches/CcGAN/train_128/train_ccgan.py,sha256=5kXAE7XSMm7Ock_oytE_gQTlaeNvy9tOXPe2MyPLch8,13424
|
31
|
-
myosotis_researches/CcGAN/train_128/train_cgan.py,sha256=bYJbBskTpESfCG2uj52RW9zLh3Zod4e8Uop7rim3dmE,9698
|
32
|
-
myosotis_researches/CcGAN/train_128/train_cgan_concat.py,sha256=PYctY3IZiHGh4TshXx3mUZBf9su_8NuV_D8InkxKQZ4,8940
|
33
|
-
myosotis_researches/CcGAN/train_128/train_net_for_label_embed.py,sha256=4j6r4_o4rXgAN4MdUQL-TXqZJpbhH7d9gWQR8YzBlXw,6976
|
34
|
-
myosotis_researches/CcGAN/train_128/utils.py,sha256=B-V6ct4WDisVVCOLO0W7VIBL8StPVNJJTZZ2b2NkMFU,3766
|
35
|
-
myosotis_researches/CcGAN/train_128_output_10/DiffAugment_pytorch.py,sha256=HxMZdMpE4KvwY3AsNgci8VNEFV3cNALg3obTyELlCaY,3025
|
36
|
-
myosotis_researches/CcGAN/train_128_output_10/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
|
-
myosotis_researches/CcGAN/train_128_output_10/eval_metrics.py,sha256=nqDh0xhumSmpMSk2HElCR6LiUtydaFLRy6rGdt39sSg,7169
|
38
|
-
myosotis_researches/CcGAN/train_128_output_10/opts.py,sha256=oIScD7A6GdcWI_ptB-k3Df5WWoWglf8bp32v3pNlerY,5374
|
39
|
-
myosotis_researches/CcGAN/train_128_output_10/pretrain_AE.py,sha256=VAbe5kSfvTl2k0aV6eV3XnMMV28KrIzB2EglahXEXiU,10746
|
40
|
-
myosotis_researches/CcGAN/train_128_output_10/pretrain_CNN_class.py,sha256=tnGH5rKeJyWY29esBXlFJx9Qr30uB6W5cMw1Wge-Leg,9247
|
41
|
-
myosotis_researches/CcGAN/train_128_output_10/pretrain_CNN_regre.py,sha256=RSmHQ5Z3Jbq2TKU2D2p-HJriXxKDw4YG-B8gstwefcI,8953
|
42
|
-
myosotis_researches/CcGAN/train_128_output_10/train_ccgan.py,sha256=rS69zzfMgQElSr42vF6nK0sH9vfYS7lLCJzSbAm_rGI,13317
|
43
|
-
myosotis_researches/CcGAN/train_128_output_10/train_cgan.py,sha256=bYJbBskTpESfCG2uj52RW9zLh3Zod4e8Uop7rim3dmE,9698
|
44
|
-
myosotis_researches/CcGAN/train_128_output_10/train_cgan_concat.py,sha256=PYctY3IZiHGh4TshXx3mUZBf9su_8NuV_D8InkxKQZ4,8940
|
45
|
-
myosotis_researches/CcGAN/train_128_output_10/train_net_for_label_embed.py,sha256=4j6r4_o4rXgAN4MdUQL-TXqZJpbhH7d9gWQR8YzBlXw,6976
|
46
|
-
myosotis_researches/CcGAN/train_128_output_10/utils.py,sha256=B-V6ct4WDisVVCOLO0W7VIBL8StPVNJJTZZ2b2NkMFU,3766
|
47
|
-
myosotis_researches/CcGAN/utils/IMGs_dataset.py,sha256=i45PBNSCeAEB5uUG0SluYRTuHWZwH_5ldz2wm6afkYs,927
|
48
|
-
myosotis_researches/CcGAN/utils/SimpleProgressBar.py,sha256=S4eD_m6ysHRMHAmRtkTXVRNfXTR8kuHv-d3lUN0BVn4,546
|
49
|
-
myosotis_researches/CcGAN/utils/__init__.py,sha256=6eJdO4qgHefW606C_ATXg8xhjixeTQHkOdNxBOKACwQ,484
|
50
|
-
myosotis_researches/CcGAN/utils/concat_image.py,sha256=BIGKz52Inn9S7M5fBFKye2V9bLJ0DqEQILoOVWAXUiE,2165
|
51
|
-
myosotis_researches/CcGAN/utils/make_h5.py,sha256=VtFYjr_i-JktsEW_BvofpilcDmChRmyLykv0VvlMuY0,963
|
52
|
-
myosotis_researches/CcGAN/utils/opts.py,sha256=pd7-wknNPBO5hWRpO3YAPmmAsPKgZUUpKc4gWMs6Wto,5397
|
53
|
-
myosotis_researches/CcGAN/utils/print_hdf5.py,sha256=VvmNAWtMDmg6D9V6ZbSUXrQTKRh9WIJeC4BR_ORJkco,300
|
54
|
-
myosotis_researches/CcGAN/utils/train.py,sha256=NhUee86SkFT7Cq5RG8Fhy0f6WbZNJ5jmomDlhq9FY5I,2140
|
55
|
-
myosotis_researches-0.1.7.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
56
|
-
myosotis_researches-0.1.7.dist-info/METADATA,sha256=Gde6bmI1QC4CsNsEWxgMZ1Eip-dETkF20Z4y1BZTqTw,2663
|
57
|
-
myosotis_researches-0.1.7.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
58
|
-
myosotis_researches-0.1.7.dist-info/top_level.txt,sha256=zxAiMn5eyZNJM28MewTAkgi_RZJMbfWbzVR-KF0LdZE,20
|
59
|
-
myosotis_researches-0.1.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
{myosotis_researches-0.1.7.dist-info → myosotis_researches-0.1.9.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
File without changes
|