franzi2505 commited on
Commit
44bdae7
1 Parent(s): 73dd662

fix memory issue

Browse files
Files changed (1) hide show
  1. PanopticQuality.py +4 -12
PanopticQuality.py CHANGED
@@ -105,7 +105,7 @@ class PQMetric(evaluate.Metric):
105
  'MARITIME_ANIMAL': 18}
106
 
107
  DEFAULT_STUFF = ["WATER", "SKY", "LAND", "CONSTRUCTION", "ICE", "OWN_BOAT"]
108
-
109
  self.label2id = label2id if label2id is not None else DEFAULT_LABEL2ID
110
  self.stuff = stuff if stuff is not None else DEFAULT_STUFF
111
  self.pq_metric = PanopticQuality(
@@ -173,14 +173,6 @@ class PQMetric(evaluate.Metric):
173
 
174
  def _postprocess(self, np_array):
175
  """Converts the numpy arrays to lists for type checking"""
176
- return self._np_to_lists(np_array)
177
-
178
- def _np_to_lists(self, d):
179
- """datasets does not support numpy arrays for type checking"""
180
- if isinstance(d, np.ndarray):
181
- if d.ndim == 1:
182
- return d.tolist()
183
- else:
184
- return [self._np_to_lists(sub_arr) for sub_arr in d]
185
- else:
186
- return d
 
105
  'MARITIME_ANIMAL': 18}
106
 
107
  DEFAULT_STUFF = ["WATER", "SKY", "LAND", "CONSTRUCTION", "ICE", "OWN_BOAT"]
108
+
109
  self.label2id = label2id if label2id is not None else DEFAULT_LABEL2ID
110
  self.stuff = stuff if stuff is not None else DEFAULT_STUFF
111
  self.pq_metric = PanopticQuality(
 
173
 
174
  def _postprocess(self, np_array):
175
  """Converts the numpy arrays to lists for type checking"""
176
+ # add fake data to avoid out of memory problem
177
+ # only reuqired for interface, not used by metric anyway
178
+ return np.zeros((1,1,1,1)).tolist()