scribble-annotation-generator 0.1.0__tar.gz → 0.1.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scribble-annotation-generator
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Programmatically generate semi-realistic synthetic scribble annotations based on statistics from existing scribble datasets
5
5
  Project-URL: Homepage, https://github.com/alexsenden/scribble-annotation-generator
6
6
  Project-URL: Repository, https://github.com/alexsenden/scribble-annotation-generator
@@ -54,11 +54,13 @@ class GMMRandomGenerator:
54
54
  num_components: int = 5,
55
55
  random_state: int = 0,
56
56
  class_names: Optional[List[str]] = None,
57
+ colour_map: Optional[dict[tuple[int, int, int], int]] = None,
57
58
  ) -> None:
58
59
  self.num_classes = num_classes
59
60
  self.num_components = num_components
60
61
  self.random_state = random_state
61
62
  self.class_names = class_names or [f"class_{i}" for i in range(num_classes)]
63
+ self.colour_map = colour_map
62
64
 
63
65
  self.class_gmms: Dict[int, GaussianMixture] = {}
64
66
  self.class_stats: Dict[int, Dict[str, float]] = {}
@@ -193,7 +195,6 @@ class GMMRandomGenerator:
193
195
  def sample_image(
194
196
  self,
195
197
  image_shape: Tuple[int, int],
196
- colour_map: Optional[dict[tuple[int, int, int], int]] = None,
197
198
  overlap_iters: int = 40,
198
199
  overlap_margin: float = 0.05,
199
200
  ) -> Tuple[np.ndarray, str]:
@@ -220,7 +221,7 @@ class GMMRandomGenerator:
220
221
  image_shape=image_shape,
221
222
  objects=objects,
222
223
  classes=classes,
223
- colour_map=colour_map,
224
+ colour_map=self.colour_map,
224
225
  )
225
226
 
226
227
  # Generate description string
@@ -579,6 +580,7 @@ def train_gmm_model(data_dir: str) -> GMMRandomGenerator:
579
580
  num_classes=num_classes,
580
581
  num_components=5,
581
582
  class_names=class_names,
583
+ colour_map=colour_map,
582
584
  ).fit(dataset)
583
585
 
584
586
  return generator
@@ -617,6 +619,7 @@ def main(argv: Optional[List[str]] = None) -> None:
617
619
  num_classes=args.num_classes,
618
620
  num_components=args.num_components,
619
621
  class_names=class_names,
622
+ colour_map=colour_map,
620
623
  ).fit(dataset)
621
624
  print()
622
625
 
@@ -626,7 +629,6 @@ def main(argv: Optional[List[str]] = None) -> None:
626
629
  for idx in range(args.num_samples):
627
630
  image, description = generator.sample_image(
628
631
  image_shape=(args.height, args.width),
629
- colour_map=colour_map,
630
632
  overlap_iters=args.overlap_iters,
631
633
  overlap_margin=args.overlap_margin,
632
634
  )