77
88from models .experimental import attempt_load
99from utils .datasets import LoadStreams , LoadImages
10- from utils .general import check_img_size , \
10+ from utils .general import check_img_size , check_requirements , \
1111 check_imshow , non_max_suppression , apply_classifier , \
1212 scale_coords , strip_optimizer , set_logging , \
1313 increment_path
@@ -281,7 +281,6 @@ def detect():
281281 parser = argparse .ArgumentParser ()
282282 parser .add_argument ('--weights' , nargs = '+' , type = str , default = 'yolov7.pt' , help = 'model.pt path(s)' )
283283 parser .add_argument ('--download' , action = 'store_true' , help = 'download model weights automatically' )
284- parser .add_argument ('--no-download' , dest = 'download' , action = 'store_false' ,help = 'not download model weights if already exist' )
285284 parser .add_argument ('--source' , type = str , default = None , help = 'source' ) # file/folder, 0 for webcam
286285 parser .add_argument ('--img-size' , type = int , default = 640 , help = 'inference size (pixels)' )
287286 parser .add_argument ('--conf-thres' , type = float , default = 0.25 , help = 'object confidence threshold' )
@@ -306,8 +305,22 @@ def detect():
306305 parser .set_defaults (download = True )
307306 opt = parser .parse_args ()
308307 print (opt )
309- #check_requirements(exclude=('pycocotools', 'thop'))
310- if opt .download and not os .path .exists ('' .join (opt .weights )):
308+ check_requirements ([
309+ "matplotlib>=3.2.2" ,
310+ "numpy>=1.18.5" ,
311+ "opencv-python>=4.1.1" ,
312+ "Pillow>=7.1.2" ,
313+ "PyYAML>=5.3.1" ,
314+ "requests>=2.23.0" ,
315+ "scipy>=1.4.1" ,
316+ "torch>=1.7.0,!=1.12.0" ,
317+ "torchvision>=0.8.1,!=0.13.0" ,
318+ "tqdm>=4.41.0" ,
319+ "protobuf==4.25.8" ,
320+ "filterpy" ,
321+ "scikit-image"
322+ ])
323+ if not os .path .exists ('' .join (opt .weights )):
311324 print ('Model weights not found. Attempting to download now...' )
312325 download ('./' )
313326
0 commit comments