noise repair, fingerprint check

This commit is contained in:
Si11ium
2020-05-15 19:23:03 +02:00
parent d929149a15
commit 5a940e8a6a
3 changed files with 7 additions and 4 deletions
+2 -2
View File
@@ -13,8 +13,8 @@ class NoiseInjection(object):
def __call__(self, x: np.ndarray): def __call__(self, x: np.ndarray):
if self.noise_factor: if self.noise_factor:
noise = np.random.normal(loc=self.mu, scale=self.sigma, size=x.shape) noise = np.random.uniform(0, self.noise_factor, size=x.shape)
augmented_data = x + self.noise_factor * noise augmented_data = x + x * noise
# Cast back to same data type # Cast back to same data type
augmented_data = augmented_data.astype(x.dtype) augmented_data = augmented_data.astype(x.dtype)
return augmented_data return augmented_data
+1
View File
@@ -39,6 +39,7 @@ class Config(ConfigParser, ABC):
h = hashlib.md5() h = hashlib.md5()
params = deepcopy(self.as_dict) params = deepcopy(self.as_dict)
del params['model']['type'] del params['model']['type']
del params['model']['secondary_type']
del params['data']['worker'] del params['data']['worker']
del params['main'] del params['main']
h.update(str(params).encode()) h.update(str(params).encode())
+4 -2
View File
@@ -14,8 +14,10 @@ class Plotter(object):
if naked: if naked:
plt.axis('off') plt.axis('off')
fig.savefig(path, bbox_inches='tight', transparent=True, pad_inches=0) fig.savefig(path, bbox_inches='tight', transparent=True, pad_inches=0)
fig.savefig(path) fig.clf()
fig.clf() else:
fig.savefig(path)
fig.clf()
def show_current_figure(self): def show_current_figure(self):
fig, _ = plt.gcf(), plt.gca() fig, _ = plt.gcf(), plt.gca()