Skip to content

Commit 3fd4747

Browse files
committed
rem file; optimizations; bug fix
1 parent 80250e0 commit 3fd4747

3 files changed

Lines changed: 9 additions & 217 deletions

File tree

‎src/modules/ObjectDetectionCoral/modulesettings.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"RuntimeLocation": "Local", // Can be Local, Shared or System
2626
"PostStartPauseSecs": 1, // Generally 1 if using GPU, 0 for CPU
2727
"Queue": "objectdetection_queue", // We make all Object detectors use the same queue.
28-
"Parallelism": 1 // 0 = Default = number of CPUs / 2
28+
"Parallelism": 16 // 0 = Default = number of CPUs / 2
2929
},
3030

3131
"ModelRequirements" : [{

‎src/modules/ObjectDetectionCoral/pipelined_model_runner.py‎

Lines changed: 0 additions & 210 deletions
This file was deleted.

‎src/modules/ObjectDetectionCoral/tpu_runner.py‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,9 @@ def __init__(self, tpu_limit: int = -1):
428428
self.temp_fname_format = None
429429
self.tpu_limit = tpu_limit
430430

431-
tpu_count = min(len(edgetpu.list_edge_tpus()), tpu_limit)
431+
tpu_count = len(edgetpu.list_edge_tpus())
432+
if tpu_limit >= 0:
433+
tpu_count = min(tpu_count, tpu_limit)
432434

433435
if platform.system() == "Linux":
434436
for fn in temp_fname_formats:
@@ -1139,6 +1141,11 @@ def to_numpy(im, shape, typestr):
11391141
if s < 0:
11401142
raise RuntimeError("encoder error %d in tobytes" % s)
11411143
return data
1144+
1145+
# Chop & resize image piece
1146+
if image.mode != 'RGB':
1147+
image = image.convert('RGB')
1148+
image.thumbnail((resamp_x, resamp_y), Image.LANCZOS)
11421149

11431150
# It'd be useful to print this once at the beginning of the run
11441151
key = "{} {}".format(*image.size)
@@ -1147,11 +1154,6 @@ def to_numpy(im, shape, typestr):
11471154
"Mapping {} image to {}x{} tiles".format(image.size, tiles_x, tiles_y))
11481155
self.printed_shape_map[key] = True
11491156

1150-
# Chop & resize image piece
1151-
if image.mode != 'RGB':
1152-
image = image.convert('RGB')
1153-
image.thumbnail((resamp_x, resamp_y), Image.LANCZOS)
1154-
11551157
# Do chunking
11561158
tiles = []
11571159
for x_off in range(0, resamp_x - options.tile_overlap, m_width - options.tile_overlap):

0 commit comments

Comments
 (0)