Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
egeakman committed Mar 1, 2023
1 parent c362f40 commit 9ed10a8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

# Project specific
yolov5_obb/runs/
runs/
config.ini

# pycache
**/__pycache__/
Expand Down
2 changes: 1 addition & 1 deletion yolov5_obb/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def run(
if webcam:
view_img = check_imshow() and view_img
cudnn.benchmark = True # set True to speed up constant image size inference
dataset = LoadStreams(source, img_size=imgsz, stride=stride, auto=pt)
dataset = LoadStreams(source, img_size=imgsz, stride=stride, auto=pt, set_fps=30)
bs = len(dataset) # batch_size
else:
dataset = LoadImages(source, img_size=imgsz, stride=stride, auto=pt)
Expand Down
6 changes: 2 additions & 4 deletions yolov5_obb/utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def __len__(self):

class LoadStreams:
# YOLOv5 streamloader, i.e. `python detect.py --source 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP streams`
def __init__(self, sources="streams.txt", img_size=640, stride=32, auto=True):
def __init__(self, sources="streams.txt", img_size=640, stride=32, auto=True, set_fps=30):
self.mode = "stream"
self.img_size = img_size
self.stride = stride
Expand Down Expand Up @@ -397,9 +397,7 @@ def __init__(self, sources="streams.txt", img_size=640, stride=32, auto=True):
s = pafy.new(s).getbest(preftype="mp4").url # YouTube URL
s = eval(s) if s.isnumeric() else s # i.e. s = '0' local webcam
cap = cv2.VideoCapture(s)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, config.getint("default", "input_size"))
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, config.getint("default", "input_size") / 8 * 5)
cap.set(cv2.CAP_PROP_FPS, 30)
cap.set(cv2.CAP_PROP_FPS, set_fps)
assert cap.isOpened(), f"{st}Failed to open {s}"
w = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
h = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
Expand Down

0 comments on commit 9ed10a8

Please sign in to comment.