JadeRay-42 commited on
Commit
5d3adef
·
1 Parent(s): 0613c20
CustomAnchorShape.py CHANGED
@@ -2,7 +2,6 @@
2
 
3
  from typing import List, Union
4
  import numpy as np
5
- from PIL import Image
6
 
7
  import datasets
8
  from .CustomAnchorShapeGenerator import CustomAnchorShape, filled_anchors
@@ -134,14 +133,11 @@ class CustomAnchorShapeDataset(datasets.GeneratorBasedBuilder):
134
  height,
135
  custom_data=custom_data,
136
  )
137
-
138
- im = Image.fromarray(np.full((1, 1), 300), mode='L')
139
 
140
  for idx, data in enumerate(custom_shape.custom_data):
141
  yield idx, {
142
  'image_id': idx,
143
- # 'image': custom_shape.get_distribution(data, type='img').convert('RGB'),
144
- 'image': im,
145
  'width': width,
146
  'height': height,
147
  'object': {
 
2
 
3
  from typing import List, Union
4
  import numpy as np
 
5
 
6
  import datasets
7
  from .CustomAnchorShapeGenerator import CustomAnchorShape, filled_anchors
 
133
  height,
134
  custom_data=custom_data,
135
  )
 
 
136
 
137
  for idx, data in enumerate(custom_shape.custom_data):
138
  yield idx, {
139
  'image_id': idx,
140
+ 'image': custom_shape.get_distribution(data, type='img'),
 
141
  'width': width,
142
  'height': height,
143
  'object': {
CustomAnchorShapeGenerator.py CHANGED
@@ -129,7 +129,7 @@ class AnchorDistributor(DataDistributor, AnchorExpander):
129
  """Return the Image filled distribution of anchors."""
130
  assert self.depth == 1 or self.depth == 3, "Only support depth 1 (GRAY) or 3(RGB)."
131
  img = filled_anchors(anchors, self.width, self.height)
132
- gray_img = Image.fromarray(img)
133
  if self.depth == 1:
134
  return gray_img
135
  else:
 
129
  """Return the Image filled distribution of anchors."""
130
  assert self.depth == 1 or self.depth == 3, "Only support depth 1 (GRAY) or 3(RGB)."
131
  img = filled_anchors(anchors, self.width, self.height)
132
+ gray_img = Image.fromarray(img, mode='L')
133
  if self.depth == 1:
134
  return gray_img
135
  else: