Skip to content

Commit d9fbe36

Browse files
Support dynamic batch_size based on sources (#6)
Signed-off-by: Muhammad Rizwan Munawar <muhammadrizwanmunawar123@gmail.com>
1 parent 4afb541 commit d9fbe36

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

streamgrid/grid.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class StreamGrid:
1111

1212
def __init__(self, sources, model=None, batch_size=4):
1313
self.sources = sources
14-
self.max_sources = len(sources)
14+
self.max_sources = self.batch_size = len(sources)
1515
self.cols = int(math.ceil(math.sqrt(self.max_sources)))
1616
self.rows = int(math.ceil(self.max_sources / self.cols))
1717

@@ -32,7 +32,6 @@ def __init__(self, sources, model=None, batch_size=4):
3232

3333
# Batch processing
3434
self.model = model
35-
self.batch_size = batch_size
3635
self.frame_queue = queue.Queue(maxsize=50)
3736

3837
# Colors
@@ -222,4 +221,4 @@ def update_display(self):
222221

223222
def stop(self):
224223
"""Stop display."""
225-
self.running = False
224+
self.running = False

0 commit comments

Comments
 (0)