Update apply_net.py

#13
by karade12 - opened
Files changed (1) hide show
  1. apply_net.py +7 -3
apply_net.py CHANGED
@@ -77,6 +77,7 @@ class InferenceAction(Action):
77
  super(InferenceAction, cls).add_arguments(parser)
78
  parser.add_argument("cfg", metavar="<config>", help="Config file")
79
  parser.add_argument("model", metavar="<model>", help="Model file")
 
80
  parser.add_argument(
81
  "--opts",
82
  help="Modify config options using the command-line 'KEY VALUE' pairs",
@@ -273,18 +274,21 @@ class ShowAction(InferenceAction):
273
  ):
274
  import cv2
275
  import numpy as np
 
 
276
  visualizer = context["visualizer"]
277
  extractor = context["extractor"]
278
  # image_fpath = entry["file_name"]
279
  # logger.info(f"Processing {image_fpath}")
280
- image = cv2.cvtColor(entry["image"], cv2.COLOR_BGR2GRAY)
281
- image = np.tile(image[:, :, np.newaxis], [1, 1, 3])
 
282
  data = extractor(outputs)
283
  image_vis = visualizer.visualize(image, data)
284
 
285
  return image_vis
286
  entry_idx = context["entry_idx"] + 1
287
- out_fname = './image-densepose/' + image_fpath.split('/')[-1]
288
  out_dir = './image-densepose'
289
  out_dir = os.path.dirname(out_fname)
290
  if len(out_dir) > 0 and not os.path.exists(out_dir):
 
77
  super(InferenceAction, cls).add_arguments(parser)
78
  parser.add_argument("cfg", metavar="<config>", help="Config file")
79
  parser.add_argument("model", metavar="<model>", help="Model file")
80
+ logger.info(f"[DEBUG] DensePose output for input shape {human_img.shape}: {outputs}")
81
  parser.add_argument(
82
  "--opts",
83
  help="Modify config options using the command-line 'KEY VALUE' pairs",
 
274
  ):
275
  import cv2
276
  import numpy as np
277
+ import os
278
+
279
  visualizer = context["visualizer"]
280
  extractor = context["extractor"]
281
  # image_fpath = entry["file_name"]
282
  # logger.info(f"Processing {image_fpath}")
283
+ image = entry["image"] # Already in BGR
284
+ # image = cv2.cvtColor(entry["image"], cv2.COLOR_BGR2GRAY)
285
+ # image = np.tile(image[:, :, np.newaxis], [1, 1, 3])
286
  data = extractor(outputs)
287
  image_vis = visualizer.visualize(image, data)
288
 
289
  return image_vis
290
  entry_idx = context["entry_idx"] + 1
291
+ out_fname = os.path.join('./image-densepose', os.path.basename(image_fpath))
292
  out_dir = './image-densepose'
293
  out_dir = os.path.dirname(out_fname)
294
  if len(out_dir) > 0 and not os.path.exists(out_dir):