Skip to content

Commit

Permalink
Fix numpy to torch cls streaming bug (#9112)
Browse files Browse the repository at this point in the history
* Fix numpy to torch cls streaming bug

Resolves #9111

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
glenn-jocher and pre-commit-ci[bot] committed Aug 23, 2022
1 parent 51c9f92 commit e6f54c5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion classify/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import sys
from pathlib import Path

import torch
import torch.backends.cudnn as cudnn
import torch.nn.functional as F

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e6f54c5

Please sign in to comment.