Skip to content

Commit

Permalink
Update detect.py
Browse files Browse the repository at this point in the history
Added support for full integer models
  • Loading branch information
sebastianfis authored Mar 19, 2024
1 parent d493d7b commit 927a0ad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
parser.add_argument("--bench_coco", action='store_true', help="Process a stream")
parser.add_argument("--coco_path", type=str, help="Path to COCO 2017 Val folder")
parser.add_argument("--quiet","-q", action='store_true', help="Disable logging (except errors)")
parser.add_argument("--int8", action='store_true', help="Datatype of model int8?")

args = parser.parse_args()

Expand All @@ -44,10 +45,13 @@
logger.error("Please select either an input image or a stream")
exit(1)

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

x = (255*np.random.random((3,*input_size))).astype(np.uint8)
if args.int8:
x = (255*np.random.random((3,*input_size))).astype(np.int8)
else:
x = (255*np.random.random((3,*input_size))).astype(np.uint8)
model.forward(x)

conf_thresh = 0.25
Expand Down

0 comments on commit 927a0ad

Please sign in to comment.