From 335d0083442c115b7260fea30a2a7e568a65efb1 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 29 Apr 2021 21:16:23 +0200 Subject: [PATCH] Update check_requirements() exclude list (#2974) --- detect.py | 2 +- hubconf.py | 2 +- test.py | 2 +- train.py | 2 +- utils/autoanchor.py | 3 ++- utils/plots.py | 3 ++- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/detect.py b/detect.py index ba42f349dbaf..af1660b6608f 100644 --- a/detect.py +++ b/detect.py @@ -172,7 +172,7 @@ def detect(opt): parser.add_argument('--hide-conf', default=False, action='store_true', help='hide confidences') opt = parser.parse_args() print(opt) - check_requirements(exclude=('pycocotools', 'thop')) + check_requirements(exclude=('tensorboard', 'pycocotools', 'thop')) with torch.no_grad(): if opt.update: # update all models (to fix SourceChangeWarning) diff --git a/hubconf.py b/hubconf.py index e42d0b59bd2a..747f7d41bcec 100644 --- a/hubconf.py +++ b/hubconf.py @@ -15,7 +15,7 @@ from utils.torch_utils import select_device dependencies = ['torch', 'yaml'] -check_requirements(Path(__file__).parent / 'requirements.txt', exclude=('pycocotools', 'thop')) +check_requirements(Path(__file__).parent / 'requirements.txt', exclude=('tensorboard', 'pycocotools', 'thop')) def create(name, pretrained, channels, classes, autoshape, verbose): diff --git a/test.py b/test.py index 2b9e90c05367..0093b8c09f54 100644 --- a/test.py +++ b/test.py @@ -310,7 +310,7 @@ def test(data, opt.save_json |= opt.data.endswith('coco.yaml') opt.data = check_file(opt.data) # check file print(opt) - check_requirements() + check_requirements(exclude=('tensorboard', 'pycocotools', 'thop')) if opt.task in ('train', 'val', 'test'): # run normally test(opt.data, diff --git a/train.py b/train.py index acfc9ef5527b..5bee57fe0bbe 100644 --- a/train.py +++ b/train.py @@ -497,7 +497,7 @@ def train(hyp, opt, device, tb_writer=None): set_logging(opt.global_rank) if opt.global_rank in [-1, 0]: check_git_status() - check_requirements() + check_requirements(exclude=('pycocotools', 'thop')) # Resume wandb_run = check_wandb_resume(opt) diff --git a/utils/autoanchor.py b/utils/autoanchor.py index 75b350da729c..87dc394c832e 100644 --- a/utils/autoanchor.py +++ b/utils/autoanchor.py @@ -3,7 +3,6 @@ import numpy as np import torch import yaml -from scipy.cluster.vq import kmeans from tqdm import tqdm from utils.general import colorstr @@ -76,6 +75,8 @@ def kmean_anchors(path='./data/coco128.yaml', n=9, img_size=640, thr=4.0, gen=10 Usage: from utils.autoanchor import *; _ = kmean_anchors() """ + from scipy.cluster.vq import kmeans + thr = 1. / thr prefix = colorstr('autoanchor: ') diff --git a/utils/plots.py b/utils/plots.py index ab6448aa96eb..e5a2d99e0abd 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -16,7 +16,6 @@ import torch import yaml from PIL import Image, ImageDraw, ImageFont -from scipy.signal import butter, filtfilt from utils.general import xywh2xyxy, xyxy2xywh from utils.metrics import fitness @@ -54,6 +53,8 @@ def hist2d(x, y, n=100): def butter_lowpass_filtfilt(data, cutoff=1500, fs=50000, order=5): + from scipy.signal import butter, filtfilt + # https://stackoverflow.com/questions/28536191/how-to-filter-smooth-with-scipy-numpy def butter_lowpass(cutoff, fs, order): nyq = 0.5 * fs