Resolve Memory Leak
We had an issue of running out of memory for very large iterations during the inference step. It turned out that two segments of code were caching numpy arrays across all iterations:
pred[img_names[0]][values[v]] = counts[v]
self.imgs_to_tensorboard.append(to_tensorboard)
These segments have been commented out without any issue of functionality.
Tile Background Black and Symlink
A base black array is used as a placeholder for empty or missing tiles, and instead of writing empty black tiles to file, a symlink to the black tile array is made.
if loc.any():
src = self.black.__fspath__()
for path in paths[loc]:
os.symlink(src, path)
logger.debug(
f'{loc.sum():,} tiles were not found and returned 404 from the server '
f'so they were set as symlinks to {src}.'
)
Resolve Memory Leak We had an issue of running out of memory for very large iterations during the inference step. It turned out that two segments of code were caching numpy arrays across all iterations:
self.imgs_to_tensorboard.append(to_tensorboard)
These segments have been commented out without any issue of functionality.Tile Background Black and Symlink A base black array is used as a placeholder for empty or missing tiles, and instead of writing empty black tiles to file, a symlink to the black tile array is made.