hank1996 commited on
Commit
4c0c74d
·
1 Parent(s): 5517bc1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -59,9 +59,9 @@ def detect(img,model):
59
  img.save("Inference/test.jpg")
60
  source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size, opt.trace
61
  save_img = True # save inference images
62
- webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(
63
- ('rtsp://', 'rtmp://', 'http://', 'https://'))
64
- print(webcam)
65
  # Directories
66
  save_dir = Path(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok)) # increment run
67
  (save_dir / 'labels' if save_txt else save_dir).mkdir(parents=True, exist_ok=True) # make dir
@@ -86,12 +86,12 @@ def detect(img,model):
86
 
87
  # Set Dataloader
88
  vid_path, vid_writer = None, None
89
- if webcam:
90
- view_img = check_imshow()
91
- cudnn.benchmark = True # set True to speed up constant image size inference
92
- dataset = LoadStreams(source, img_size=imgsz, stride=stride)
93
- else:
94
- dataset = LoadImages(source, img_size=imgsz, stride=stride)
95
 
96
  # Get names and colors
97
  names = model.module.names if hasattr(model, 'module') else model.names
@@ -119,10 +119,10 @@ def detect(img,model):
119
 
120
  # Process detections
121
  for i, det in enumerate(pred): # detections per image
122
- if webcam: # batch_size >= 1
123
- p, s, im0, frame = path[i], '%g: ' % i, im0s[i].copy(), dataset.count
124
- else:
125
- p, s, im0, frame = path, '', im0s, getattr(dataset, 'frame', 0)
126
 
127
  p = Path(p) # to Path
128
  save_path = str(save_dir / p.name) # img.jpg
 
59
  img.save("Inference/test.jpg")
60
  source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size, opt.trace
61
  save_img = True # save inference images
62
+ #webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(
63
+ #('rtsp://', 'rtmp://', 'http://', 'https://'))
64
+ #print(webcam)
65
  # Directories
66
  save_dir = Path(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok)) # increment run
67
  (save_dir / 'labels' if save_txt else save_dir).mkdir(parents=True, exist_ok=True) # make dir
 
86
 
87
  # Set Dataloader
88
  vid_path, vid_writer = None, None
89
+ #if webcam:
90
+ #view_img = check_imshow()
91
+ #cudnn.benchmark = True # set True to speed up constant image size inference
92
+ #dataset = LoadStreams(source, img_size=imgsz, stride=stride)
93
+ #else:
94
+ dataset = LoadImages(source, img_size=imgsz, stride=stride)
95
 
96
  # Get names and colors
97
  names = model.module.names if hasattr(model, 'module') else model.names
 
119
 
120
  # Process detections
121
  for i, det in enumerate(pred): # detections per image
122
+ #if webcam: # batch_size >= 1
123
+ #p, s, im0, frame = path[i], '%g: ' % i, im0s[i].copy(), dataset.count
124
+ #else:
125
+ p, s, im0, frame = path, '', im0s, getattr(dataset, 'frame', 0)
126
 
127
  p = Path(p) # to Path
128
  save_path = str(save_dir / p.name) # img.jpg