nathanjc commited on
Commit
42f7057
·
1 Parent(s): 7392235

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -28,6 +28,7 @@ def detect(opt, save_img=False):
28
  # from utils.plots import plot_one_box
29
  # from utils.torch_utils import select_device, load_classifier, time_synchronized, TracedModel
30
 
 
31
  from yolov7_package.models.experimental import attempt_load
32
  from yolov7_package.utils.general import check_img_size, check_requirements, check_imshow, non_max_suppression, apply_classifier, \
33
  scale_coords, xyxy2xywh, strip_optimizer, set_logging, increment_path
@@ -50,7 +51,9 @@ def detect(opt, save_img=False):
50
  half = device.type != 'cpu' # half precision only supported on CUDA
51
 
52
  # Load model
 
53
  model = attempt_load(weights, map_location=device) # load FP32 model
 
54
  stride = int(model.stride.max()) # model stride
55
  imgsz = check_img_size(imgsz, s=stride) # check img_size
56
 
 
28
  # from utils.plots import plot_one_box
29
  # from utils.torch_utils import select_device, load_classifier, time_synchronized, TracedModel
30
 
31
+ from yolov7_package import Yolov7Detector
32
  from yolov7_package.models.experimental import attempt_load
33
  from yolov7_package.utils.general import check_img_size, check_requirements, check_imshow, non_max_suppression, apply_classifier, \
34
  scale_coords, xyxy2xywh, strip_optimizer, set_logging, increment_path
 
51
  half = device.type != 'cpu' # half precision only supported on CUDA
52
 
53
  # Load model
54
+ det = Yolov7Detector(weights=weights, traced=False)
55
  model = attempt_load(weights, map_location=device) # load FP32 model
56
+ model = TracedModel(model, device, 640)
57
  stride = int(model.stride.max()) # model stride
58
  imgsz = check_img_size(imgsz, s=stride) # check img_size
59