Skip to content

Commit

Permalink
remove check_requirements (#37)
Browse files Browse the repository at this point in the history
* remove `check_requirements`

* update to v0.5.7
  • Loading branch information
fcakyon authored Jul 3, 2021
1 parent fb6da21 commit 0b485f8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion yolov5/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from yolov5.helpers import YOLOv5
from yolov5.helpers import load_model as load

__version__ = "5.0.6"
__version__ = "5.0.7"
4 changes: 2 additions & 2 deletions yolov5/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from yolov5.models.experimental import attempt_load
from yolov5.utils.datasets import LoadStreams, LoadImages
from yolov5.utils.general import check_img_size, check_requirements, check_imshow, colorstr, non_max_suppression, \
from yolov5.utils.general import check_img_size, check_imshow, colorstr, non_max_suppression, \
apply_classifier, scale_coords, xyxy2xywh, strip_optimizer, set_logging, increment_path, save_one_box, yolov5_in_syspath
from yolov5.utils.plots import colors, plot_one_box
from yolov5.utils.torch_utils import select_device, load_classifier, time_synchronized
Expand Down Expand Up @@ -213,7 +213,7 @@ def parse_opt():
def main():
opt = parse_opt()
print(colorstr('detect: ') + ', '.join(f'{k}={v}' for k, v in vars(opt).items()))
check_requirements(exclude=('tensorboard', 'thop'))
#check_requirements(exclude=('tensorboard', 'thop'))
run(**vars(opt))


Expand Down
4 changes: 2 additions & 2 deletions yolov5/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from yolov5.models.yolo import Detect
from yolov5.models.experimental import attempt_load
from yolov5.utils.activations import Hardswish, SiLU
from yolov5.utils.general import colorstr, check_img_size, check_requirements, file_size, set_logging
from yolov5.utils.general import colorstr, check_img_size, file_size, set_logging
from yolov5.utils.torch_utils import select_device


Expand Down Expand Up @@ -106,7 +106,7 @@ def run(weights='./yolov5s.pt', # weights path
# Simplify
if simplify:
try:
check_requirements(['onnx-simplifier'])
#check_requirements(['onnx-simplifier'])
import onnxsim

print(f'{prefix} simplifying with onnx-simplifier {onnxsim.__version__}...')
Expand Down
6 changes: 3 additions & 3 deletions yolov5/hubconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
from pathlib import Path

from yolov5.models.yolo import Model, attempt_load
from yolov5.utils.general import check_requirements, set_logging, yolov5_in_syspath
from yolov5.utils.general import set_logging, yolov5_in_syspath
from yolov5.utils.google_utils import attempt_download
from yolov5.utils.torch_utils import select_device

check_requirements(requirements=Path(__file__).parent / 'requirements.txt',
exclude=('tensorboard', 'thop', 'opencv-python'))
#check_requirements(requirements=Path(__file__).parent / 'requirements.txt',
# exclude=('tensorboard', 'thop', 'opencv-python'))
set_logging(verbose=verbose)

fname = Path(name).with_suffix('.pt') # checkpoint filename
Expand Down
6 changes: 3 additions & 3 deletions yolov5/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from yolov5.models.experimental import attempt_load
from yolov5.utils.datasets import create_dataloader
from yolov5.utils.general import coco80_to_coco91_class, check_dataset, check_file, check_img_size, check_requirements, \
from yolov5.utils.general import coco80_to_coco91_class, check_dataset, check_file, check_img_size, \
box_iou, non_max_suppression, scale_coords, xyxy2xywh, xywh2xyxy, set_logging, increment_path, colorstr
from yolov5.utils.metrics import ap_per_class, ConfusionMatrix
from yolov5.utils.plots import plot_images, output_to_target, plot_study_txt
Expand Down Expand Up @@ -274,7 +274,7 @@ def run(data,
json.dump(jdict, f)

try: # https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocoEvalDemo.ipynb
check_requirements(['pycocotools'])
#check_requirements(['pycocotools'])
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval

Expand Down Expand Up @@ -333,7 +333,7 @@ def main():
opt = parse_opt()
set_logging()
print(colorstr('test: ') + ', '.join(f'{k}={v}' for k, v in vars(opt).items()))
check_requirements(exclude=('tensorboard', 'thop'))
#check_requirements(exclude=('tensorboard', 'thop'))

if opt.task in ('train', 'val', 'test'): # run normally
run(**vars(opt))
Expand Down
4 changes: 2 additions & 2 deletions yolov5/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from yolov5.utils.datasets import create_dataloader
from yolov5.utils.general import labels_to_class_weights, increment_path, labels_to_image_weights, init_seeds, \
fitness, strip_optimizer, get_latest_run, check_dataset, check_file, check_git_status, check_img_size, \
check_requirements, print_mutation, set_logging, one_cycle, colorstr, yolov5_in_syspath
print_mutation, set_logging, one_cycle, colorstr, yolov5_in_syspath
from yolov5.utils.google_utils import attempt_download
from yolov5.utils.loss import ComputeLoss
from yolov5.utils.plots import plot_images, plot_labels, plot_results, plot_evolution
Expand Down Expand Up @@ -549,7 +549,7 @@ def main(opt):
if RANK in [-1, 0]:
print(colorstr('train: ') + ', '.join(f'{k}={v}' for k, v in vars(opt).items()))
check_git_status()
check_requirements(exclude=['thop'])
#check_requirements(exclude=['thop'])

# Resume
wandb_run = check_wandb_resume(opt)
Expand Down
4 changes: 2 additions & 2 deletions yolov5/utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from torch.utils.data import Dataset
from tqdm import tqdm

from yolov5.utils.general import check_requirements, check_file, check_dataset, xyxy2xywh, xywh2xyxy, xywhn2xyxy, xyn2xy, \
from yolov5.utils.general import check_file, check_dataset, xyxy2xywh, xywh2xyxy, xywhn2xyxy, xyn2xy, \
segment2box, segments2boxes, resample_segments, clean_str, yolov5_in_syspath
from yolov5.utils.torch_utils import torch_distributed_zero_first

Expand Down Expand Up @@ -283,7 +283,7 @@ def __init__(self, sources='streams.txt', img_size=640, stride=32):
# Start thread to read frames from video stream
print(f'{i + 1}/{n}: {s}... ', end='')
if 'youtube.com/' in s or 'youtu.be/' in s: # if source is YouTube video
check_requirements(('pafy', 'youtube_dl'))
#check_requirements(('pafy', 'youtube_dl'))
import pafy
s = pafy.new(s).getbest(preftype="mp4").url # YouTube URL
s = eval(s) if s.isnumeric() else s # i.e. s = '0' local webcam
Expand Down

0 comments on commit 0b485f8

Please sign in to comment.