glenn-jocher commited on
Commit
ef0b5c9
1 Parent(s): 1b5edb6

On-demand `pycocotools` pip install (#3547)

Browse files
Files changed (5) hide show
  1. detect.py +1 -1
  2. hubconf.py +1 -1
  3. requirements.txt +1 -1
  4. test.py +2 -1
  5. train.py +1 -1
detect.py CHANGED
@@ -175,7 +175,7 @@ if __name__ == '__main__':
175
  parser.add_argument('--half', action='store_true', help='use FP16 half-precision inference')
176
  opt = parser.parse_args()
177
  print(opt)
178
- check_requirements(exclude=('tensorboard', 'pycocotools', 'thop'))
179
 
180
  if opt.update: # update all models (to fix SourceChangeWarning)
181
  for opt.weights in ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt']:
 
175
  parser.add_argument('--half', action='store_true', help='use FP16 half-precision inference')
176
  opt = parser.parse_args()
177
  print(opt)
178
+ check_requirements(exclude=('tensorboard', 'thop'))
179
 
180
  if opt.update: # update all models (to fix SourceChangeWarning)
181
  for opt.weights in ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt']:
hubconf.py CHANGED
@@ -31,7 +31,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
31
  from utils.torch_utils import select_device
32
 
33
  check_requirements(requirements=Path(__file__).parent / 'requirements.txt',
34
- exclude=('tensorboard', 'pycocotools', 'thop', 'opencv-python'))
35
  set_logging(verbose=verbose)
36
 
37
  fname = Path(name).with_suffix('.pt') # checkpoint filename
 
31
  from utils.torch_utils import select_device
32
 
33
  check_requirements(requirements=Path(__file__).parent / 'requirements.txt',
34
+ exclude=('tensorboard', 'thop', 'opencv-python'))
35
  set_logging(verbose=verbose)
36
 
37
  fname = Path(name).with_suffix('.pt') # checkpoint filename
requirements.txt CHANGED
@@ -26,5 +26,5 @@ pandas
26
 
27
  # extras --------------------------------------
28
  # Cython # for pycocotools https://github.com/cocodataset/cocoapi/issues/172
29
- pycocotools>=2.0 # COCO mAP
30
  thop # FLOPs computation
 
26
 
27
  # extras --------------------------------------
28
  # Cython # for pycocotools https://github.com/cocodataset/cocoapi/issues/172
29
+ # pycocotools>=2.0 # COCO mAP
30
  thop # FLOPs computation
test.py CHANGED
@@ -260,6 +260,7 @@ def test(data,
260
  json.dump(jdict, f)
261
 
262
  try: # https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocoEvalDemo.ipynb
 
263
  from pycocotools.coco import COCO
264
  from pycocotools.cocoeval import COCOeval
265
 
@@ -311,7 +312,7 @@ if __name__ == '__main__':
311
  opt.save_json |= opt.data.endswith('coco.yaml')
312
  opt.data = check_file(opt.data) # check file
313
  print(opt)
314
- check_requirements(exclude=('tensorboard', 'pycocotools', 'thop'))
315
 
316
  if opt.task in ('train', 'val', 'test'): # run normally
317
  test(opt.data,
 
260
  json.dump(jdict, f)
261
 
262
  try: # https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocoEvalDemo.ipynb
263
+ check_requirements(['pycocotools'])
264
  from pycocotools.coco import COCO
265
  from pycocotools.cocoeval import COCOeval
266
 
 
312
  opt.save_json |= opt.data.endswith('coco.yaml')
313
  opt.data = check_file(opt.data) # check file
314
  print(opt)
315
+ check_requirements(exclude=('tensorboard', 'thop'))
316
 
317
  if opt.task in ('train', 'val', 'test'): # run normally
318
  test(opt.data,
train.py CHANGED
@@ -495,7 +495,7 @@ if __name__ == '__main__':
495
  set_logging(opt.global_rank)
496
  if opt.global_rank in [-1, 0]:
497
  check_git_status()
498
- check_requirements(exclude=('pycocotools', 'thop'))
499
 
500
  # Resume
501
  wandb_run = check_wandb_resume(opt)
 
495
  set_logging(opt.global_rank)
496
  if opt.global_rank in [-1, 0]:
497
  check_git_status()
498
+ check_requirements(exclude=['thop'])
499
 
500
  # Resume
501
  wandb_run = check_wandb_resume(opt)