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

Fix numpy to torch cls streaming bug (#9112)

* Fix numpy to torch cls streaming bug Resolves https://github.com/ultralytics/yolov5/issues/9111Signed-off-by: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ciSigned-off-by: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: 's avatarpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
上级 51c9f922
......@@ -30,6 +30,7 @@ import platform
import sys
from pathlib import Path
import torch
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
......@@ -101,7 +102,7 @@ def run(
seen, windows, dt = 0, [], (Profile(), Profile(), Profile())
for path, im, im0s, vid_cap, s in dataset:
with dt[0]:
im = im.to(device)
im = torch.Tensor(im).to(device)
im = im.half() if model.fp16 else im.float() # uint8 to fp16/32
if len(im.shape) == 3:
im = im[None] # expand for batch dim
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论