sofieneb commited on
Commit
5423ac8
·
verified ·
1 Parent(s): 56c631e

readme parameter sample_aug_params correction

Browse files
Files changed (1) hide show
  1. README.md +5 -5
README.md CHANGED
@@ -51,7 +51,7 @@ patch_embeddings = torch.randn((num_patches, embedding_dim), device="cuda")
51
  # mode="wsi_wise" applies the same transformation across the whole slide
52
  # mode="instance_wise" applies different transformations per patch
53
  aug_params = model.sample_aug_params(
54
- n=num_patches,
55
  device=patch_embeddings.device,
56
  mode="wsi_wise"
57
  )
@@ -115,7 +115,7 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
115
  num_to_sample = 5
116
 
117
  # start: sample once and inspect current config
118
- sample_1 = model.sample_aug_params(n=num_to_sample, device=device, mode="wsi_wise")
119
  print("initial sample:\n", sample_1, "\n")
120
 
121
  print("initial transforms_parameters:\n", model.histaug.transforms_parameters, "\n")
@@ -127,7 +127,7 @@ model.histaug.transforms_parameters.pop("hue", None)
127
  # pop a discrete transform: remove "rotation" (probability-based)
128
  model.histaug.transforms_parameters.pop("rotation", None)
129
 
130
- sample_2 = model.sample_aug_params(n=num_to_sample, device=device, mode="wsi_wise")
131
  print("after popping 'hue' (continuous) and 'rotation' (discrete):\n", sample_2, "\n")
132
 
133
  # change param examples
@@ -137,7 +137,7 @@ model.histaug.transforms_parameters["brightness"] = [-0.25, 0.25]
137
  # change a discrete transform probability: lower 'h_flip' from 0.75 to 0.10
138
  model.histaug.transforms_parameters["h_flip"] = 0.10
139
 
140
- sample_3 = model.sample_aug_params(n=num_to_sample, device=device, mode="wsi_wise")
141
  print("after changing 'brightness' interval and 'h_flip' probability:\n", sample_3, "\n")
142
 
143
  ````
@@ -171,7 +171,7 @@ def maybe_augment_bag(bag_features: torch.Tensor,
171
  return bag_features
172
  with torch.no_grad():
173
  aug_params = histaug.sample_aug_params(
174
- n=bag_features.size(0),
175
  device=bag_features.device,
176
  mode=mode # "wsi_wise" or "instance_wise"
177
  )
 
51
  # mode="wsi_wise" applies the same transformation across the whole slide
52
  # mode="instance_wise" applies different transformations per patch
53
  aug_params = model.sample_aug_params(
54
+ batch_size=num_patches,
55
  device=patch_embeddings.device,
56
  mode="wsi_wise"
57
  )
 
115
  num_to_sample = 5
116
 
117
  # start: sample once and inspect current config
118
+ sample_1 = model.sample_aug_params(batch_size=num_to_sample, device=device, mode="wsi_wise")
119
  print("initial sample:\n", sample_1, "\n")
120
 
121
  print("initial transforms_parameters:\n", model.histaug.transforms_parameters, "\n")
 
127
  # pop a discrete transform: remove "rotation" (probability-based)
128
  model.histaug.transforms_parameters.pop("rotation", None)
129
 
130
+ sample_2 = model.sample_aug_params(batch_size=num_to_sample, device=device, mode="wsi_wise")
131
  print("after popping 'hue' (continuous) and 'rotation' (discrete):\n", sample_2, "\n")
132
 
133
  # change param examples
 
137
  # change a discrete transform probability: lower 'h_flip' from 0.75 to 0.10
138
  model.histaug.transforms_parameters["h_flip"] = 0.10
139
 
140
+ sample_3 = model.sample_aug_params(batch_size=num_to_sample, device=device, mode="wsi_wise")
141
  print("after changing 'brightness' interval and 'h_flip' probability:\n", sample_3, "\n")
142
 
143
  ````
 
171
  return bag_features
172
  with torch.no_grad():
173
  aug_params = histaug.sample_aug_params(
174
+ batch_size=bag_features.size(0),
175
  device=bag_features.device,
176
  mode=mode # "wsi_wise" or "instance_wise"
177
  )