Add colab template and minor fixes (#137)
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -47,7 +47,7 @@ dnn: False # use OpenCV DNN for ONNX inference
|
||||
plots: True # show plots during training
|
||||
|
||||
# Prediction settings --------------------------------------------------------------------------------------------------
|
||||
source: "ultralytics/assets" # source directory for images or videos
|
||||
source: null # source directory for images or videos
|
||||
show: False # show results if possible
|
||||
save_txt: False # save results as .txt file
|
||||
save_conf: False # save results with confidence scores
|
||||
|
@ -224,4 +224,5 @@ class YOLO:
|
||||
args.pop("device", None)
|
||||
args.pop("project", None)
|
||||
args.pop("name", None)
|
||||
args.pop("batch_size", None)
|
||||
args.pop("batch", None)
|
||||
args.pop("epochs", None)
|
||||
|
@ -2,7 +2,7 @@ import hydra
|
||||
import torch
|
||||
|
||||
from ultralytics.yolo.engine.predictor import BasePredictor
|
||||
from ultralytics.yolo.utils import DEFAULT_CONFIG, ops
|
||||
from ultralytics.yolo.utils import DEFAULT_CONFIG, ROOT, ops
|
||||
from ultralytics.yolo.utils.checks import check_imgsz
|
||||
from ultralytics.yolo.utils.plotting import Annotator, colors, save_one_box
|
||||
|
||||
@ -83,8 +83,9 @@ class DetectionPredictor(BasePredictor):
|
||||
|
||||
@hydra.main(version_base=None, config_path=str(DEFAULT_CONFIG.parent), config_name=DEFAULT_CONFIG.name)
|
||||
def predict(cfg):
|
||||
cfg.model = cfg.model or "n.pt"
|
||||
cfg.model = cfg.model or "yolov8n.pt"
|
||||
cfg.imgsz = check_imgsz(cfg.imgsz, min_dim=2) # check image size
|
||||
cfg.source = cfg.source or ROOT / "assets"
|
||||
predictor = DetectionPredictor(cfg)
|
||||
predictor()
|
||||
|
||||
|
Reference in New Issue
Block a user