Unverified 提交 482af479 authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

Add `detect.py` GIF video inference (#6410)

* Add detect.py GIF video inference * Cleanup
上级 8efe9771
...@@ -199,7 +199,7 @@ def run(weights=ROOT / 'yolov5s.pt', # model.pt path(s) ...@@ -199,7 +199,7 @@ def run(weights=ROOT / 'yolov5s.pt', # model.pt path(s)
h = int(vid_cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) h = int(vid_cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
else: # stream else: # stream
fps, w, h = 30, im0.shape[1], im0.shape[0] fps, w, h = 30, im0.shape[1], im0.shape[0]
save_path += '.mp4' save_path = str(Path(save_path).with_suffix('.mp4')) # force *.mp4 suffix on results videos
vid_writer[i] = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (w, h)) vid_writer[i] = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (w, h))
vid_writer[i].write(im0) vid_writer[i].write(im0)
......
...@@ -33,8 +33,8 @@ from utils.torch_utils import torch_distributed_zero_first ...@@ -33,8 +33,8 @@ from utils.torch_utils import torch_distributed_zero_first
# Parameters # Parameters
HELP_URL = 'https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data' HELP_URL = 'https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data'
IMG_FORMATS = ['bmp', 'jpg', 'jpeg', 'png', 'tif', 'tiff', 'dng', 'webp', 'mpo'] # acceptable image suffixes IMG_FORMATS = ['bmp', 'dng', 'jpeg', 'jpg', 'mpo', 'png', 'tif', 'tiff', 'webp'] # include image suffixes
VID_FORMATS = ['mov', 'avi', 'mp4', 'mpg', 'mpeg', 'm4v', 'wmv', 'mkv'] # acceptable video suffixes VID_FORMATS = ['avi', 'gif', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'wmv'] # include video suffixes
DEVICE_COUNT = max(torch.cuda.device_count(), 1) DEVICE_COUNT = max(torch.cuda.device_count(), 1)
# Get orientation exif tag # Get orientation exif tag
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论