Brasd99 commited on
Commit
a39331b
·
1 Parent(s): 340a768

Optimizations

Browse files
Files changed (1) hide show
  1. helpers/processor.py +4 -9
helpers/processor.py CHANGED
@@ -30,6 +30,7 @@ class TextureProcessor:
30
  def __init__(self, config, weights):
31
  self.config = self.get_config(config, weights)
32
  self.predictor = DefaultPredictor(self.config)
 
33
 
34
  def process_texture(self, image):
35
  image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
@@ -108,8 +109,7 @@ class TextureProcessor:
108
  tmp = array[6 * i]
109
  for j in range(6 * i + 1, 6 * i + 6):
110
  tmp = np.concatenate((tmp, array[j]), axis=1)
111
- texture = tmp if len(texture) == 0 else np.concatenate(
112
- (texture, tmp), axis=0)
113
  return texture
114
 
115
  def get_texture(self, im, iuv, bbox, tex_part_size=200):
@@ -139,8 +139,7 @@ class TextureProcessor:
139
  tex_v_coo = np.clip(tex_v_coo, 0, tex_part_size - 1)
140
 
141
  for channel in range(3):
142
- generated[channel][tex_v_coo,
143
- tex_u_coo] = im[channel][i == part_id]
144
 
145
  if np.sum(generated) > 0:
146
  generated = self.interpolate_tex(generated)
@@ -184,9 +183,5 @@ class TextureProcessor:
184
  if outputs.has('pred_boxes'):
185
  result['pred_boxes_XYXY'] = outputs.get('pred_boxes').tensor.cpu()
186
  if outputs.has('pred_densepose'):
187
- if isinstance(outputs.pred_densepose, DensePoseChartPredictorOutput):
188
- extractor = DensePoseResultExtractor()
189
- elif isinstance(outputs.pred_densepose, DensePoseEmbeddingPredictorOutput):
190
- extractor = DensePoseOutputsExtractor()
191
- result['pred_densepose'] = extractor(outputs)[0]
192
  context['results'].append(result)
 
30
  def __init__(self, config, weights):
31
  self.config = self.get_config(config, weights)
32
  self.predictor = DefaultPredictor(self.config)
33
+ self.extractor = DensePoseResultExtractor()
34
 
35
  def process_texture(self, image):
36
  image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
 
109
  tmp = array[6 * i]
110
  for j in range(6 * i + 1, 6 * i + 6):
111
  tmp = np.concatenate((tmp, array[j]), axis=1)
112
+ texture = tmp if len(texture) == 0 else np.concatenate((texture, tmp), axis=0)
 
113
  return texture
114
 
115
  def get_texture(self, im, iuv, bbox, tex_part_size=200):
 
139
  tex_v_coo = np.clip(tex_v_coo, 0, tex_part_size - 1)
140
 
141
  for channel in range(3):
142
+ generated[channel][tex_v_coo, tex_u_coo] = im[channel][i == part_id]
 
143
 
144
  if np.sum(generated) > 0:
145
  generated = self.interpolate_tex(generated)
 
183
  if outputs.has('pred_boxes'):
184
  result['pred_boxes_XYXY'] = outputs.get('pred_boxes').tensor.cpu()
185
  if outputs.has('pred_densepose'):
186
+ result['pred_densepose'] = self.extractor(outputs)[0]
 
 
 
 
187
  context['results'].append(result)