Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _inference(self):
# prepare for inference
from chunkflow.block_inference_engine import BlockInferenceEngine
from chunkflow.frameworks.pznet_patch_inference_engine import PZNetPatchInferenceEngine
patch_engine = PZNetPatchInferenceEngine(self.convnet_path)
self.block_inference_engine = BlockInferenceEngine(
patch_inference_engine=patch_engine,
patch_size=self.patch_size,
overlap=self.patch_overlap,
output_key=self.output_key,
output_channels=self.num_output_channels)
# inference engine input is a OffsetArray rather than normal numpy array
# it is actually a numpy array with global offset
from chunkflow.offset_array import OffsetArray
input_offset = tuple(s.start for s in self.input_slices)
input_chunk = OffsetArray(self.image, global_offset=input_offset)
self.output = self.block_inference_engine(input_chunk)