Skip to content

Commit 5a4c374

Browse files
committed
Comments
1 parent c1fb90a commit 5a4c374

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

src/modules/ObjectDetectionCoral/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def __init__(self):
163163

164164
self.MAX_PIPELINE_QUEUE_LEN = 1000 # Multi-only
165165
self.TILE_OVERLAP = 15 # Multi-only.
166-
self.DOWNSAMPLE_BY = 5.2 # Multi-only. Smaller number results in more tiles generated
166+
self.DOWNSAMPLE_BY = 6.0 # Multi-only. Smaller number results in more tiles generated
167167
self.IOU_THRESHOLD = 0.1 # Multi-only
168168

169169
# ----------------------------------------------------------------------

src/modules/ObjectDetectionCoral/tpu_runner.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(self, fname_list: list, tpu_name: str, queues: list, rebalancing_lo
9090

9191

9292
def start(self, seg_idx: int, fbytes: bytes):
93-
logging.info(f"Loading into {self.tpu_name}: {self.fname_list[seg_idx]}")
93+
logging.info(f"Loading {self.tpu_name}: {self.fname_list[seg_idx]}")
9494

9595
try:
9696
self.interpreter = edgetpu.make_interpreter(fbytes, delegate=self.delegate)
@@ -1095,8 +1095,6 @@ def _resize_and_chop_tiles(self,
10951095
m_width: int,
10961096
m_height: int):
10971097
"""
1098-
Run the image resizing in an independent process pool.
1099-
11001098
Image resizing is one of the more expensive things we're doing here.
11011099
It's expensive enough that it may take as much CPU time as inference
11021100
under some circumstances. The Lanczos resampling kernel in particular
@@ -1148,6 +1146,7 @@ def _resize_and_chop_tiles(self,
11481146
tiles = []
11491147
for x_off in range(0, resamp_x - options.tile_overlap, m_width - options.tile_overlap):
11501148
for y_off in range(0, resamp_y - options.tile_overlap, m_height - options.tile_overlap):
1149+
# Adjust contrast on a per-chunk basis; we will likely be quantizing the image during scaling
11511150
image_chunk = ImageOps.autocontrast(image.crop((x_off,
11521151
y_off,
11531152
x_off + m_width,
@@ -1160,6 +1159,10 @@ def _resize_and_chop_tiles(self,
11601159

11611160
tiles.append((cropped_arr.astype(self.input_details['dtype']), resamp_info))
11621161

1162+
# Check again with various scales
1163+
#Image.fromarray((tiles[-1][0] + 128).astype(np.uint8)).save("test.png")
1164+
1165+
11631166
return tiles
11641167

11651168

0 commit comments

Comments
 (0)