Skip to content

Commit

Permalink
add conf/iou to args
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh committed Aug 31, 2021
1 parent dfd979a commit bb61350
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions edgetpumodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def __init__(self, model_file, names_file, conf_thresh=0.25, iou_thresh=0.45, fi
self.agnostic_nms = agnostic_nms
self.max_det = 1000

logger.info("Confidence threshold: {}".format(conf_thresh))
logger.info("IOU threshold: {}".format(iou_thresh))

self.inference_time = None
self.nms_time = None
self.interpreter = None
Expand Down Expand Up @@ -102,6 +105,7 @@ def make_interpreter(self):
logger.debug("Output scale: {}".format(self.output_scale))
logger.debug("Output zero: {}".format(self.output_zero))

logger.info("Successfully loaded {}".format(self.model_file))

def get_image_size(self):
"""
Expand Down
4 changes: 3 additions & 1 deletion test_edgetpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
parser.add_argument("--model", "-m", help="weights file", required=True)
parser.add_argument("--bench_speed", action='store_true', help="run speed test on dummy data")
parser.add_argument("--bench_image", action='store_true', help="run detection test")
parser.add_argument("--conf_thresh", type=float, default=0.25, help="model confidence threshold")
parser.add_argument("--iou_thresh", type=float, default=0.45, help="NMS IOU threshold")
parser.add_argument("--names", type=str, default='data/coco.yaml', help="Names file")
parser.add_argument("--image", "-i", type=str, help="Image file to run detection on")
parser.add_argument("--device", type=int, default=0, help="Image capture device to run live detection")
Expand All @@ -42,7 +44,7 @@
logger.error("Please select either an input image or a stream")
exit(1)

model = EdgeTPUModel(args.model, args.names)
model = EdgeTPUModel(args.model, args.names, conf_thresh=args.conf_thresh, iou_thresh=args.iou_thresh)
input_size = model.get_image_size()

x = (255*np.random.random((3,*input_size))).astype(np.uint8)
Expand Down

0 comments on commit bb61350

Please sign in to comment.