hank1996 commited on
Commit
68d30a1
·
1 Parent(s): ceea5d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -103,11 +103,11 @@ def detect(img,model):
103
  normalize,
104
  ])
105
  model = get_net(cfg)
106
- checkpoint = torch.load(opt.weights, map_location= device)
107
  model.load_state_dict(checkpoint['state_dict'])
108
  model = model.to(device)
109
 
110
- dataset = LoadImages(opt.source, img_size=opt.img_size)
111
  bs = 1 # batch_size
112
 
113
  # Get names and colors
@@ -118,7 +118,7 @@ def detect(img,model):
118
  t0 = time.time()
119
 
120
  vid_path, vid_writer = None, None
121
- img = torch.zeros((1, 3, opt.img_size, opt.img_size), device=device) # init img
122
  _ = model(img.half() if half else img) if device.type != 'cpu' else None # run once
123
  model.eval()
124
 
 
103
  normalize,
104
  ])
105
  model = get_net(cfg)
106
+ checkpoint = torch.load(weights, map_location= device)
107
  model.load_state_dict(checkpoint['state_dict'])
108
  model = model.to(device)
109
 
110
+ dataset = LoadImages(source, img_size=imgsz)
111
  bs = 1 # batch_size
112
 
113
  # Get names and colors
 
118
  t0 = time.time()
119
 
120
  vid_path, vid_writer = None, None
121
+ img = torch.zeros((1, 3, imgsz, imgsz), device=device) # init img
122
  _ = model(img.half() if half else img) if device.type != 'cpu' else None # run once
123
  model.eval()
124