dennistrujillo commited on
Commit
02aaceb
·
1 Parent(s): ef78074

Added normalize_patches()

Browse files
Files changed (1) hide show
  1. dataset.py +9 -0
dataset.py CHANGED
@@ -11,6 +11,15 @@ from time import time
11
  import gc
12
  #from torch.utils.data import TensorDataset,Dataloader
13
 
 
 
 
 
 
 
 
 
 
14
  def connected_components_torch(images,crop_size=15,NrPixels = 2048):
15
  window=int(crop_size/2)
16
  start = torch.cuda.Event(enable_timing=True)
 
11
  import gc
12
  #from torch.utils.data import TensorDataset,Dataloader
13
 
14
+ def normalize_patches(patches):
15
+ normalized_patches = []
16
+ for patch in patches:
17
+ # normalize the patch by subtracting the mean and dividing by the standard deviation
18
+ normalized_patch = (patch - patch.mean()) / patch.std()
19
+ normalized_patches.append(normalized_patch)
20
+ return normalized_patches
21
+
22
+
23
  def connected_components_torch(images,crop_size=15,NrPixels = 2048):
24
  window=int(crop_size/2)
25
  start = torch.cuda.Event(enable_timing=True)