Skip to content

Commit

Permalink
Refactor dataset batch-size (ultralytics#9551)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Sep 22, 2022
1 parent 489920a commit b25d5a7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions classify/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ def run(
if webcam:
view_img = check_imshow()
dataset = LoadStreams(source, img_size=imgsz, transforms=classify_transforms(imgsz[0]), vid_stride=vid_stride)
bs = len(dataset) # batch_size
else:
dataset = LoadImages(source, img_size=imgsz, transforms=classify_transforms(imgsz[0]), vid_stride=vid_stride)
bs = 1 # batch_size
bs = len(dataset) # batch_size
vid_path, vid_writer = [None] * bs, [None] * bs

# Run inference
Expand Down
3 changes: 1 addition & 2 deletions detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,9 @@ def run(
if webcam:
view_img = check_imshow()
dataset = LoadStreams(source, img_size=imgsz, stride=stride, auto=pt, vid_stride=vid_stride)
bs = len(dataset) # batch_size
else:
dataset = LoadImages(source, img_size=imgsz, stride=stride, auto=pt, vid_stride=vid_stride)
bs = 1 # batch_size
bs = len(dataset) # batch_size
vid_path, vid_writer = [None] * bs, [None] * bs

# Run inference
Expand Down
3 changes: 1 addition & 2 deletions segment/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ def run(
if webcam:
view_img = check_imshow()
dataset = LoadStreams(source, img_size=imgsz, stride=stride, auto=pt, vid_stride=vid_stride)
bs = len(dataset) # batch_size
else:
dataset = LoadImages(source, img_size=imgsz, stride=stride, auto=pt, vid_stride=vid_stride)
bs = 1 # batch_size
bs = len(dataset) # batch_size
vid_path, vid_writer = [None] * bs, [None] * bs

# Run inference
Expand Down

0 comments on commit b25d5a7

Please sign in to comment.